bzdiff does not pass -I option to diff

Bug #735675 reported by Pablo Englebienne
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bzip2 (Ubuntu)

Bug Description

Binary package hint: bzip2

When trying to use bzdiff with the -I option (ignore regex), the options are not properly passed to diff. I have 2 files (MySQL dumps) that differ in only one line:

$ bzdiff tmp1.bz2 tmp2.bz2
< -- Dump completed on 2011-03-11 1:06:50
> -- Dump completed on 2011-03-11 0:40:11

However, when trying to avoid that line from matching a problem arises:

$ ./bzdiff_orig -I'Dump completed' tmp1.bz2 tmp2.bz2
diff: extra operand `/tmp/bzdiff.JnwGRlHnMM'
diff: Try `diff --help' for more information.

After some attempts at quoting and unquoting, I solved the problem by modifying the bzdiff shell script at /bin/bzdiff.

The issues were 2: i) the options were not correctly parsed, a space was added before the first option, and ii) the options were not passed quoted to diff, therefore they were incorrectly interpreted as a file and not an option. Will include a patch.

Version info:
$ lsb_release -rd
Description: Ubuntu 10.10

$ apt-cache policy bzip2
  Installed: 1.0.5-4ubuntu1

Revision history for this message
Pablo Englebienne (pablo-englebienne) wrote :
tags: added: bzdiff bzip2
tags: added: patch
Revision history for this message
Ben Hutchings (benh-debian) wrote :

This patch is broken:

1. $OPTIONS is used (unquoted) in 4 different places but this patch only updates one of them
2. Quoting $OPTIONS prevents use of multiple options

Unfortunately I don't see a reasonable way to fix this while using only POSIX shell features.

- If bzdiff is changed to use bash then the options can be accumulated into an array variable. This would be fine in Debian and Ubuntu, but not upstream.
- POSIX allows positional arguments to be used in an array-like way, but we already use them for the filenames.
- This could be done by escaping, quoting and concatenating the options and then using eval to expand to multiple arguments. But this is not what I would consider reasonable!

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

Other bug subscribers