#986634 7zr ignores umask for output directory

Package:
p7zip
Source:
p7zip
Description:
7zr file archiver with high compression ratio
Submitter:
MichaIng
Date:
2025-03-14 14:51:03 UTC
Severity:
normal
Tags:
#986634#5
Date:
2021-04-08 13:58:31 UTC
From:
To:
When extracting a 7z archive to an output directory which does not yet
exist, 7zr creates this directory automatically. While for all files and
directories within the archive, the default umask modes are applied, the
parent output directory is created always with 0700 mode.

As this is different with all other tested packagers (tar, unzip) and at
least IMO not expected or convenient, I suggest to respect the umask for
the newly created parent directory as well.

To replicate:
-------
 > testfile
7zr a testarchive.7z testfile
7zr x testarchive.7z -otestdir
ls -al testdir
-------

The same is true for the following package versions:
- 16.02+dfsg-6 (Buster)
- 16.02+dfsg-3+deb9u1 (Stretch)

And it is true for the 7za and 7z commands, shipped with the p7zip-full
package.

I also tested the alpha version of the new official 7-Zip Linux binaries
(7zz), which are compatible regarding command arguments and options,
where the issue does not exist:
https://sourceforge.net/p/sevenzip/discussion/45797/thread/cec5e63147/

Best regards,

Micha

#986634#10
Date:
2022-03-28 06:19:43 UTC
From:
To:
This bug was reported *13 years ago* on Sourceforge and ignored:
https://sourceforge.net/p/p7zip/bugs/87/

I reported it again today but I am not holding my breath for the developer
to fix it.

It would be great to see this simple patch added by the maintainer.

#986634#15
Date:
2023-01-19 22:55:08 UTC
From:
To:
Thanks for the link with the contained patch. Bumping this as it still
would be great to see it merged:
------- diff FileDir.cpp FileDir_fix.cpp 569c569 < if (mkdir( name, 0700 ) == 0) bret = true; --- > if (mkdir( name, 0777 & gbl_umask.mask ) == 0) bret = true; ------- Best regards, Micha