Skip to content

Do not blindly trust UNIX file attributes from MS-DOS.#183

Open
sesse wants to merge 1 commit intoMacPaw:masterfrom
sesse:master
Open

Do not blindly trust UNIX file attributes from MS-DOS.#183
sesse wants to merge 1 commit intoMacPaw:masterfrom
sesse:master

Conversation

@sesse
Copy link
Copy Markdown

@sesse sesse commented Apr 29, 2026

Several archives made with old MS-DOS archivers will contain garbage in the UNIX permissions field. unar does not trust such file permissions in general for regular files, but it does if they are directories or special files (like symlinks). This can cause issues, e.g.:

http://checkpoint.untergrund.net/files/ReBoy_v1.1a.zip unpacks successfully, but directories do not have the appropriate permissions and the result is basically unreadable without further chmod-ing.

https://ftp.untergrund.net/users/irokos/magz/canadian_born_coders/aft-11.zip fails unpacking; it believes two of the files are symlinks, and one of them has a file name that is so long that symlink() fails.

Both unpack successfully using unzip, which verifies UNIX permissions against MS-DOS permissions; all files must be user-readable, directories must always be user-executable, and the read-only bit must be the opposite of the
user-writable permission. If they do not match, the UNIX permissions are ignored. Implement the same logic, so that the two files above extract successfully.

Several archives made with old MS-DOS archivers will contain
garbage in the UNIX permissions field. unar does not trust
such file permissions in general for regular files, but it does
if they are directories or special files (like symlinks).
This can cause issues, e.g.:

http://checkpoint.untergrund.net/files/ReBoy_v1.1a.zip unpacks
successfully, but directories do not have the appropriate
permissions and the result is basically unreadable without
further chmod-ing.

https://ftp.untergrund.net/users/irokos/magz/canadian_born_coders/aft-11.zip
fails unpacking; it believes two of the files are symlinks,
and one of them has a file name that is so long that symlink()
fails.

Both unpack successfully using unzip, which verifies UNIX
permissions against MS-DOS permissions; all files must be
user-readable, directories must always be user-executable,
and the read-only bit must be the opposite of the
user-writable permission. If they do not match, the UNIX
permissions are ignored. Implement the same logic, so that
the two files above extract successfully.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant