TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

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

Moderators: sheep, Hacker, Stefan2, white

Post Reply
sspear
Junior Member
Junior Member
Posts: 11
Joined: 2017-02-02, 14:51 UTC

TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *sspear »

Adding, deleteing, renaming files in a ZIP archive cause the PINNED file attribute (0x80000) to be unset.

Code: Select all

PS C:\xx> attrib * +p
PS C:\xx> attrib *
A            P       C:\xx\junk.zip
Use TotalCommander 9.51 RC2 to treat the ZIP archive like a directory. Foe example, add a file to junk.zip.

Code: Select all

PS C:\xx> attrib *
A                    C:\xx\junk.zip
siealex
Senior Member
Senior Member
Posts: 245
Joined: 2009-03-22, 16:36 UTC

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *siealex »

Confirmed. Also the added file loses this attribute. But what is the purpose of this attribute? I've never heard about it.
We are not so S.M.A.R.T. as we imagine...
User avatar
petermad
Power Member
Power Member
Posts: 9846
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *petermad »

2siealex
But what is the purpose of this attribute? I've never heard about it.
It is an attribute used mainly in OneDrive. A pinned file or folder is always available locally.
License #524 (1994)
Danish Total Commander Translator
TC 9.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (2004) 64bit, 'Everything' 1.4.1.988 (x64)
TC 3.10 on Android 6.0
Get:
Extended TC Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Usher
Power Member
Power Member
Posts: 887
Joined: 2011-03-11, 10:11 UTC

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *Usher »

Does Windows 10 internal zip keep this attribute unchanged?
Regards from Poland
Andrzej P. Wozniak
sspear
Junior Member
Junior Member
Posts: 11
Joined: 2017-02-02, 14:51 UTC

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *sspear »

Windows 10 internal zip
Assuming you mean the File Explorer tool, I wouldn't even bother with that, given Raymond Chen's May-18 post:
Why is Windows Compressed Folders (Zip folders) support stuck at the turn of the century?

So let's take a look at something more modern, the PowerShell cmdlet Compress-Archive:

Code: Select all

PS C:\xx> compress-archive -path 1 -update -DestinationPath ca1.zip  # create an archive CA1.ZIP
PS C:\xx> attrib *                                                   # show the attributes
A            P       C:\xx\1
A            P       C:\xx\2
A                    C:\xx\ca1.zip

PS C:\xx> attrib ca1.zip +p                                          # set PINNED file attribute for CA1.ZIP
PS C:\xx> attrib *
A            P       C:\xx\1
A            P       C:\xx\2
A            P       C:\xx\ca1.zip

PS C:\xx> compress-archive -path 2 -update -DestinationPath ca1.zip # add a file to CA1.ZIP

PS C:\xx> attrib *                                                  # Yay! CA1.ZIP still had the PINNED file attribute
A            P       C:\xx\1
A            P       C:\xx\2
A            P       C:\xx\ca1.zip
However, going down this rabbit hole we see that compress-archive has its own problems, such as not preserving the PINNED file attribute in the archive:

Code: Select all

PS C:\xx> .\7za.exe l -slt ca1.zip                                 # Use 7za to display the attributes inside the archive.
7-Zip (a) 19.00 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Listing archive: ca1.zip
Attributes =
Okay, let's switch to 7za.. 7za V19.00 keeps the PINNED file attribute inside the archive, but doesn't (in my brief testing) preserve the PINNED file attribute of the archived file.

Code: Select all

PS C:\xx> .\7za.exe a arc.7z 1

7-Zip (a) 19.00 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21

Scanning the drive:
1 file, 13 bytes (1 KiB)
Creating archive: arc.7z
Creating archive: arc.7z
Add new data to archive: 1 file, 13 bytes (1 KiB)
Files read from disk: 1
Archive size: 123 bytes (1 KiB)
Everything is Ok

PS C:\xx> .\7za.exe l -slt arc.7z  # Note output is edited, but PINNED file attribute is inside the archive
Listing archive: arc.7z
Path = 1
Size = 13
Modified = 2020-02-15 15:58:02
Attributes = AP
CRC = DB5BCF1B
Encrypted = -
Method = LZMA2:12
Block = 0

PS C:\xx> attrib *
A            P       C:\xx\1
A            P       C:\xx\2
A            P       C:\xx\3
A            P       C:\xx\7za.exe
A                    C:\xx\arc.7z

PS C:\xx> attrib arc.7z +p
PS C:\xx> attrib *
A            P       C:\xx\1
A            P       C:\xx\2
A            P       C:\xx\3
A            P       C:\xx\7za.exe
A            P       C:\xx\arc.7z

PS C:\xx> .\7za.exe a arc.7z 2  # update the arc.7z archive with file '2' (output is edited)
7-Zip (a) 19.00 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Open archive: arc.7z
Updating archive: arc.7z
Keep old data in archive: 1 file, 13 bytes (1 KiB)
Add new data to archive: 1 file, 13 bytes (1 KiB)
Files read from disk: 1
Archive size: 173 bytes (1 KiB)
Everything is Ok

PS C:\xx> attrib *   # Whoops, the archive file arc.7z lost the PINNED attribute!

A            P       C:\xx\1
A            P       C:\xx\2
A            P       C:\xx\3
A            P       C:\xx\7za.exe
A                    C:\xx\arc.7z
I realize this is probably off topic, but could help other people in picking their poison for trying to use this attribute.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39969
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *ghisler(Author) »

ZIP files are not modified in place. Instead, a new file is created, all files from the ZIP which should be kept are copied to that new ZIP, and then new files are added. Then the old ZIP is deleted and the new renamed to the name of the old. Currently I only copy the attributes read only, hidden and system to the new ZIP. I will add code to also copy "pinned" and "not content indexed".

Btw, before reporting more problems with pinned files, could you please check whether the following has been fixed:
viewtopic.php?f=32&t=57679
Thanks.
Author of Total Commander
http://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39969
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *ghisler(Author) »

This should be fixed in RC3, please test it!
Author of Total Commander
http://www.ghisler.com
sspear
Junior Member
Junior Member
Posts: 11
Joined: 2017-02-02, 14:51 UTC

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *sspear »

Tested 9.51 RC3 32bit(2020-02-26).

Zip file has PINNED attribute.

* Added new file to Zip file.
* Deleted file from Zip file.
* Renamed file in Zip file.

In each of these cases the Zip file retained the PINNED attribute.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 39969
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: TC9.51 RC2:File attribute PINNED is unset by internal ZIP packer

Post by *ghisler(Author) »

Great, thanks!
Author of Total Commander
http://www.ghisler.com
Post Reply