Opened 3 months ago

Closed 2 months ago

#20977 closed enhancement (fixed)

Consider archiving unzip and provide it as a symlink to bsdunzip (from libarchive)

Reported by: Xi Ruoyao Owned by: Xi Ruoyao
Priority: elevated Milestone: 12.3
Component: BOOK Version: git
Severity: normal Keywords:
Cc:

Description

I cannot see any advantage of the old and unmaintained unzip comparing to bsdunzip.

Change History (27)

comment:1 by Douglas R. Reno, 3 months ago

I'm in fair of doing this as well, but we'll need to do some testing for packages like libreoffice which use it during it's build process.

comment:2 by zeckma, 3 months ago

I can do some testing myself in a bit for packages like Firefox and Thunderbird. I want to test the Node.js dependency anyway.

in reply to:  2 comment:3 by zeckma, 3 months ago

Replying to zeckma:

I can do some testing myself in a bit for packages like Firefox and Thunderbird. I want to test the Node.js dependency anyway.

Firefox, Thunderbird, and Seamonkey built fine after deleting the UnZip binaries, then making unzip symlink pointing to bsdunzip from libarchive.

comment:4 by Xi Ruoyao, 3 months ago

Some git tests fails with the symlink, I'll investigate it later once I set up my working environment in the newly built system (I'm typing this in Lynx). Those tests can be suppressed with GIT_UNZIP=nonexist. And now our Git page does not list unzip as a dependency at all...

Last edited 3 months ago by Xi Ruoyao (previous) (diff)

comment:5 by Xi Ruoyao, 3 months ago

Priority: normalelevated

Doing so will also "fix" CVE-2021-4217.

comment:6 by Xi Ruoyao, 3 months ago

Owner: changed from blfs-book to Xi Ruoyao
Status: newassigned

Going to do this (also adding GIT_UNZIP=nonexist for Git test suite) if no further objection, considering we have a security issue here.

comment:7 by Douglas R. Reno, 3 months ago

That sounds good to me, but please test building Libreoffice with the symlink, as it uses unzip very heavily throughout it's build process to unzip it's downloaded tarballs. I can test this instead if you'd like, just let me know since I'll probably update Libreoffice at the same time as testing it if we do this :)

in reply to:  7 comment:8 by Joe Locash, 3 months ago

Replying to Douglas R. Reno:

That sounds good to me, but please test building Libreoffice with the symlink, as it uses unzip very heavily throughout it's build process to unzip it's downloaded tarballs. I can test this instead if you'd like, just let me know since I'll probably update Libreoffice at the same time as testing it if we do this :)

I just finished a test build of libreoffice-25.2.0.3 with the symlink and there were no issues.

comment:9 by Xi Ruoyao, 3 months ago

The progress:

Tested:

  • Mozilla trios
  • libreoffice
  • Git (test only, need to be disabled)
    • unzip -a is documented as "auto-convert any text files" but bsdunzip -a is documented as "convert DOS‐style line endings to Unix‐style line endings" (i.e. old Mac style isn't converted).
  • fontconfig (test only)
  • docbook-45-xml
  • docbook5
  • perl-archive-zip (test)
  • sqlite (doc)
  • docbook-4.5-dtd
  • docbook-3.1-dtd
  • ark
  • file-roller
  • lynx
  • openjdk
  • mc
  • opencv

Need to be adapted:

  • xarchiver (make 7zip the default, change the dependency to external)
  • libgsf (test only, change the dependency to external)

Untested:

  • gucharmap

Help needed for testing the remaining packages and/or providing the method to test them.

Version 8, edited 2 months ago by Xi Ruoyao (previous) (next) (diff)

comment:10 by Joe Locash, 3 months ago

mc, libgsf, opencv, gucharmap, and lynx all build fine using the symlink.

With libgsf I saw no mention of unzip at all in the logs and in the make check 2 valgrind tests were skipped instead of failing. It happens if valgrind is installed or not.

in reply to:  10 comment:11 by Xi Ruoyao, 3 months ago

Replying to Joe Locash:

mc, libgsf, opencv, gucharmap, and lynx all build fine using the symlink.

With libgsf I saw no mention of unzip at all in the logs and in the make check 2 valgrind tests were skipped instead of failing. It happens if valgrind is installed or not.

libgsf needs both p7zip and unzip or these tests won't run.

The problem with lynx is unzip is used at runtime (for the "directory editor") so we need to manually test it. Similarly for things like xarchiver or file-roller.

comment:12 by Douglas R. Reno, 2 months ago

Getting lynx to do this required a bit of configuration

  • Edit /etc/lynx/lynx.cfg
  • Run something like "lynx file:///sources/sqlite/"
  • Select sqlite-doc-{something}.zip and then press F
  • Press Enter on Uncompress

That being said, lynx works with the symbolic link. I'm testing the others on another system while I wait on Libreoffice to finish on my main one.

Last edited 2 months ago by Douglas R. Reno (previous) (diff)

comment:13 by Douglas R. Reno, 2 months ago

JDK builds and runs with the symlink

comment:14 by Douglas R. Reno, 2 months ago

file-roller and Ark work well.

xarchiver on the other hand has some issues. It returns an error message saying "Zipinfo mode needs additional options".

comment:15 by Douglas R. Reno, 2 months ago

I ran xarchiver from a terminal and it looks like it's running the following command:

/usr/bin/unzip -Z -l /home/renodr/sqlite-doc-3370200.zip

comment:16 by Xi Ruoyao, 2 months ago

I'll take a look at xarchiver.

comment:17 by Douglas R. Reno, 2 months ago

That sounds good, I think after that the archival and then replacement symlink should be good to go

comment:18 by Xi Ruoyao, 2 months ago

If I read the xarchiver code correctly, when 7za (from p7zip or 7zip, see also #21047) is available it's preferred over unzip for the zip files. Thus maybe we can recommend p7zip/7zip for xarchiver for zip files.

Another option is adapting xarchiver to support bsdtar --list --verbose -f instead of unzip -Z -l but it would be more difficult.

comment:19 by Douglas R. Reno, 2 months ago

It looks like users will need to uncheck the "Prefer unzip for zip files (requires restart)" option in Preferences, but after doing that and restarting xarchiver, it now works with p7zip!

in reply to:  19 comment:20 by Xi Ruoyao, 2 months ago

Replying to Douglas R. Reno:

It looks like users will need to uncheck the "Prefer unzip for zip files (requires restart)" option in Preferences, but after doing that and restarting xarchiver, it now works with p7zip!

I also tried 7zip and it works as well. But I need to figure out how to make the default of this option off...

comment:21 by Xi Ruoyao, 2 months ago

sed '/TOGGLE.*prefer_unzip/s/TRUE/FALSE/' -i src/pref_dialog.c

comment:22 by Xi Ruoyao, 2 months ago

libgsf test suite wants the "zipinfo" command, which won't be available with the symlink.

comment:23 by Xi Ruoyao, 2 months ago

mc checks if unzip supports the -Z flag at the build time, and it falls back to unzip -qq -v if -Z is not usable. bsdunzip supports the latter properly.

comment:24 by Xi Ruoyao, 2 months ago

opencv tested. It seems only used for extracting a download file at build time.

comment:25 by Xi Ruoyao, 2 months ago

gucharmap tested. Only used for extracting UCD.zip and Unihan.zip.

comment:26 by Xi Ruoyao, 2 months ago

Fixed r12.2-1247-g32863364dd. I'll write the SA later.

comment:27 by Xi Ruoyao, 2 months ago

Resolution: fixed
Status: assignedclosed

SA 12.2-084.

Note: See TracTickets for help on using tickets.