bzcmp and bzdiff have issues when passing their arguments to the underline cmp and diff commands, issues that are not present in the original script

Bug #1955501 reported by Edinson E. Padrón Urdaneta
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzip2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

Package's information:
$ apt-cache show bzip2
Package: bzip2
Architecture: amd64
Version: 1.0.8-2
Multi-Arch: foreign
Priority: important
Section: utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <email address hidden>
Original-Maintainer: Anibal Monsalve Salazar <email address hidden>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 195
Depends: libbz2-1.0 (= 1.0.8-2), libc6 (>= 2.14)
Suggests: bzip2-doc
Replaces: libbz2 (<< 0.9.5d-3)
Filename: pool/main/b/bzip2/bzip2_1.0.8-2_amd64.deb
Size: 34064
MD5sum: 63ab63d6739fddaa232e534e996d98ed
SHA1: 16dde6d0b0c0d96b2cfe40017058350af4cd459e
SHA256: 9201778f5a3bd4ff685d41cd677660129e57c544b7526f20ff8c48318c63dbe8
Homepage: https://sourceware.org/bzip2/
Description: high-quality block-sorting file compressor - utilities
Description-md5: 1e71313ce794d3de1e3bc63ac58885b5
Task: minimal
Build-Essential: yes

Test data:
$ echo file content > f1 && echo filx content > f2
$ bzip2 f1 f2

Other setup:
$ git clone https://gitlab.com/bzip2/bzip2.git
$ ln -nv ./bzip2/bzdiff bzcmp
$ chmod u+x ./bzcmp

In regards to bzcmp, this is a very simple way to check for the issue:
# ubuntu's
$ bzcmp f1.bz2 f2.bz2
cmp: invalid --ignore-initial value '/tmp/bzdiff.8kHv0B9tBJ'
cmp: Try 'cmp --help' for more information.
# original's (https://gitlab.com/bzip2/bzip2)
$ ./bzcmp f1.bz2 f2.bz2
- /tmp/bzdiff.vpXGvPfv5I differ: char 4, line 1

In regard to bzdiff, this is a very simple way to check for the issue:
# ubuntu's
$ bzdiff -y -W20 f1.bz2 f2.bz2
diff: invalid option -- ' '
diff: Try 'diff --help' for more information.
# original's (https://gitlab.com/bzip2/bzip2)
$ bash bzip2/bzdiff -y -W20 f1.bz2 f2.bz2
file | filx

I think the culprit is the /usr/bin/bzdiff script. Here the difference between ubuntu's and the original one
$ diff -W150 --suppress-common-lines /usr/bin/bzdiff bzip2/bzdiff
27,31c27
< -*) if test -z "$OPTIONS"; then
< OPTIONS="$ARG"
< else
< OPTIONS="$OPTIONS $ARG"
< fi ;;
---
> -*) OPTIONS="$OPTIONS $ARG";;
43a40,43
> tmp=`mktemp ${TMPDIR:-/tmp}/bzdiff.XXXXXXXXXX` || {
> echo 'cannot create a temporary file' >&2
> exit 1
> }
56,61c56,57
< tmp=`mktemp "${TMPDIR:-/tmp}"/bzdiff.XXXXXXXXXX` || {
< echo 'cannot create a temporary file' >&2
< exit 1
< }
< bzip2 -cdfq "$2" > "$tmp"
< bzip2 -cdfq "$1" | $comp "$OPTIONS" - "$tmp"
---
> bzip2 -cdfq "$2" > $tmp
> bzip2 -cdfq "$1" | $comp $OPTIONS - $tmp
63c59
< /bin/rm -f "$tmp";;
---
> /bin/rm -f $tmp;;
75a72
> exit "$STAT"
80d76
< exit "$STAT"

description: updated
description: updated
description: updated
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.