Почему распаковка bsdtar из libarchive сбрасывает биты разрешения при чтении ZIP-архива из stdin, а не напрямую?

Проблема, с которой я столкнулся только с моим новым ПК с Windows 10. Однако я только что нашел решение на немецком веб-сайте, которое на данный момент работает для меня. Нажмите Ctrl + Shift + N, чтобы открыть страницу в режиме инкогнито ... если здесь работает Copy Paste, попробуйте деактивировать некоторые из ваших расширений. Надеюсь, это сработает и для вас.

0
12.12.2018, 12:17
2 ответа

Здесь на багтрекереlibarchiveесть ответ:

Zip archives contains two different ways to describe the content:

  1. A per-entry header
  2. A central directory at the end of the zip file.

libarchive (and bsdtar by extension) will use the central directory if seeking is possible on the input, otherwise it will fall back to the streaming-only logic. The entries are not necessarily consistent as you found out in your test case. There isn't really much we can or want to do about this. Note that you can replace wget with a plain cat and it will still show the same behavior.

The short version is that this is an inherent issue with streaming of zip files and something that won't be fixed.

0
28.01.2020, 04:07

[это еще не совсем ответ, но я опубликую его как таковой, так как в комментариях невозможно ничего отформатировать]

zip— не единственный формат, который создает проблемы при извлечении из файла без -поиска. Вот пример с несколькими ISO-образами сеанса -, но по крайней мере bsdtarпечатает сообщение об ошибке и завершается с ненулевым статусом -. Вероятно, то же самое следует делать с zip-файлами; молча испортить разрешения неприемлемо ИМХО.

$ echo a.out > a.out
$ genisoimage -quiet -R -o a.iso a.out
$ chmod 755 a.out
$ growisofs -M a.iso -R -quiet a.out
Executing 'genisoimage -C 16,176 -M /dev/fd/3 -R -quiet a.out | builtin_dd of=a.iso obs=32k seek=11'
Rock Ridge signatures found
builtin_dd: 176*2KB out @ average infx1352KBps
a.iso: copying volume descriptor(s)

$ cat a.iso | bsdtar xf -
bsdtar: Ignoring out-of-order file @19 (a.out) 51200 < 411648
bsdtar: Error exit delayed from previous errors.
$ ls -l a.out; hd a.out
-rwxr-xr-x 1 ahq ahq 6 Dec 11 19:15 a.out
00000000  00 00 00 00 00 00                                 |......|
00000006

$ bsdtar xf a.iso
$ ls -l a.out; hd a.out
-rwxr-xr-x 1 ahq ahq 6 Dec 11 19:15 a.out
00000000  61 2e 6f 75 74 0a                                 |a.out.|
00000006
0
28.01.2020, 04:07

Теги

Похожие вопросы