Environment variable loop

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Environment variable loop

Post by *MVV »

I've found nice bug...

Easiest steps to reproduce:

1. open command line and execute command: set xx=%xx%
2. start TC from this command line
3. type into command line: echo %xx%
4. press Enter and enjoy hung TC! :D

This example is funny, but it is real that some envvars may point to others and back, so loop may occur. I think it would be good to integrate some counter in resolving loop.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

Sorry, what do you mean?
What should %xx% point to?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

No wonder that this happens when you create an infinite loop...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

If I use such construction in BAT file or in command line, this doesn't happen (they don't loop expanding).
I understand that it is a user fault (of course mine in this case) but TC may show some warning mesage instead of hanging.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I will set a timeout to the function to prevent it, e.g. to catch loops like xx -> yy -> zz -> xx too.
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

That's nice. I meant complex loops too when made this topic.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Works fine in TC 7.55pb2. Thanks :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Thanks for checking!
Author of Total Commander
https://www.ghisler.com
Post Reply