question about temp file naming scheme

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

question about temp file naming scheme

Post by *dindog »

if two archives have same file name, and some of its content file also has identical name, TC will exact 2 temporary file in same destination, you either overwrite the previous opened temp file, which may not close or even being locked by other application, or can't open the latter one. If users doesn't notice that, he will pack wrong file back to archive.

step to reproduec:
1. there is a foo.zip in C:\ and a foo.zip in D:\, they has the identical name don't share identical content. But each of them has a bar.txt
2. open C:\foo.zip and then open the bar.txt in the archive by Alt+F3, with external program, says, notepad2
3. open the other D:\foo.zip , the try to open the bar.txt in it, TC prompt dialog asking you to overwrite a temp file or not..

My question is, can this naming scheme improve?
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: question about temp file naming scheme

Post by *petermad »

Interesting enough you can compare the two files without TC overwriting anything.
Last edited by petermad on 2019-12-11, 10:15 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: question about temp file naming scheme

Post by *ghisler(Author) »

Sorry, this cannot be avoided. Some external packers cannot change the name of the unpacked file when unpacking. I could use different directories (which I already do in some cases), but this could potentially clutter the temp folder with thousands of undeleted directories. Therefore I'm using one temporary directory for the left panel and one for the right. This is intentional and will not be changed.
Author of Total Commander
https://www.ghisler.com
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

Re: question about temp file naming scheme

Post by *dindog »

ghisler(Author) wrote: 2019-12-11, 07:39 UTC Therefore I'm using one temporary directory for the left panel and one for the right. This is intentional and will not be changed.
do you mean if I open the above mentioned
c:\foo.zip/bar.txt in left panel
d:\foo.zip/bar.txt in right panel
there will be no overwritting problem? well, but it's not the case, at least not in my win10x64 tc9.5b8 x64. I still got the first temp file overwritten.

and the temp path is
%$LOCAL_APPDATA%\temp\_tc\*.*
I don't see which part associate to left or right panel, i didn't notice it before, but I realized it has nothing to do with the archivers name too. One can't open README in foo.zip and README in bar.zip at the same time while keeping track of which is which.
Last edited by dindog on 2019-12-11, 08:40 UTC, edited 1 time in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: question about temp file naming scheme

Post by *ghisler(Author) »

It depends on what you try to do - TC does separate paths when you use "Compare by content".
Author of Total Commander
https://www.ghisler.com
User avatar
dindog
Senior Member
Senior Member
Posts: 315
Joined: 2010-10-18, 07:41 UTC

Re: question about temp file naming scheme

Post by *dindog »

ghisler(Author) wrote: 2019-12-11, 08:36 UTC It depends on what you try to do - TC does separate paths when you use "Compare by content".
just curious. Why winrar or winzip won't have the problem you bring up?

if i open foo.zip/README then another bar.zip/README, both do some changes, WinRAR will have no problem saving the modified README back to where they were.

well, I was shocked when I realize the only way TC will open two file in different archiver is compare by content.... I rather delete temp file now and then.
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: question about temp file naming scheme

Post by *Usher »

dindog wrote: 2019-12-11, 08:36 UTC
ghisler(Author) wrote: 2019-12-11, 07:39 UTC Therefore I'm using one temporary directory for the left panel and one for the right. This is intentional and will not be changed.
do you mean if I open the above mentioned
c:\foo.zip/bar.txt in left panel
d:\foo.zip/bar.txt in right panel
there will be no overwritting problem? well, but it's not the case, I still got the first temp file overwritten.
and the temp path is
%$LOCAL_APPDATA%\temp\_tc\*.*
@ghisler(Author)
As far as I know, TC can use _tc and _tc_ subfolders. Could you always use _tc for the left panel and _tc_ for the right one?
Andrzej P. Wozniak
Polish subforum moderator
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48083
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: question about temp file naming scheme

Post by *ghisler(Author) »

As far as I know, TC can use _tc and _tc_ subfolders. Could you always use _tc for the left panel and _tc_ for the right one?
I would have done that long ago if it were that easy.
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: question about temp file naming scheme

Post by *Usher »

2ghisler(Author)
Other programs generate subfolders with random names or use C:\full\path\to\archive.zip to generate hash as a subfolder name. The path is unique and so is its hash. Windows from NT family use CRC-32 or similar 4 character hash to generate short names, see short names for newly created dirs below:

Code: Select all

c:\Program Files>dir mic*.* /x /od
 Directory: c:\Program Files

2014-05-30  14:47    <DIR>          MICROS~1     microsoft frontpage
2017-02-14  07:14    <DIR>          MICROS~1.NET Microsoft.NET
2017-02-14  07:22    <DIR>          MICROS~3     Microsoft SQL Server
2019-02-01  21:03    <DIR>          MICROS~2     Microsoft Silverlight
2019-04-10  06:15    <DIR>          MICROS~4     Microsoft XNA

2019-12-11  19:04    <DIR>          MI8CC7~1     Microsoft XN
2019-12-11  19:04    <DIR>          MIA7C7~1     Microsoft X
2019-12-11  19:04    <DIR>          MI3FC7~1     Microsoft Xy
2019-12-11  19:04    <DIR>          MI9783~1     Microsoft Xyz
2019-12-11  19:04    <DIR>          MIAE83~1     Microsoft Xyzq
2019-12-11  19:04    <DIR>          MIDE29~1     Microsoft Xyzqvx
2019-12-11  19:04    <DIR>          MI67D3~1     Microsoft Xyzqvxt
Andrzej P. Wozniak
Polish subforum moderator
Post Reply