Unzip utility choice decision

Ben Woods woodsb02 at gmail.com
Sat Nov 21 08:02:22 UTC 2015

On Friday, 20 November 2015, Dangling Pointer <danglingpointer at outlook.com>

> Hi,
> The unzip utility which comes OOTB is different than the one which
> installs with `pkg install unzip`. The latter one is the real unzip utility
> which accepts -uoq switches together. The former one complains "unzip: -n,
> -o and -u are contradictory".
> Without being able to -uoq causes a race with two unzips attempting to
> overwrite the same file at the same time. -u prevents existing files from
> being overwritten if they haven't been updated and allows us to run any
> number of unzips in parallel.
> After installing FreeBSD, I have to rename "/usr/bin/unzip" to
> "/usr/bin/unzip2" followed by "pkg install unzip" and then "ln -s
> /usr/local/bin/unzip /usr/bin/unzip".
> If the licensing permits, please consider replacing the default unzip
> utility with the one available in ports. This way it is convenient to write
> a cross-platform build/install scripts for software without additional
> checks.
> Thanks.

Having just read the manpage of both the FreeBSD version and the info-zip
version, it sounds to me like those -o and -u options ARE contradictory.

-o tells unzip to overwrite any existing files.

-u tells unzip to only overwrite any existing files if the version from the
zip is newer.

It doesn't make sense to me to use both of these switches. You should
choose which behaviour you want and only specify one of them. Perhaps
"unzip -uq FILE.zip" will suffice?

Info-zip unzip(1) manpage:

FreeBSD unzip(1) manpage:



From: Benjamin Woods
woodsb02 at gmail.com

More information about the freebsd-questions mailing list