quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] [patch 6/7] Exit with an error when diffs retcode=2 (err


From: Jean Delvare
Subject: Re: [Quilt-dev] [patch 6/7] Exit with an error when diffs retcode=2 (error) on patch
Date: Fri, 17 Jan 2014 22:11:47 +0100

Hi Martin,

Le Friday 17 January 2014 à 18:55 +0100, Martin Quinson a écrit :
> Hello Jean,
> 
> On Sun, Jan 12, 2014 at 12:28:37PM +0100, Jean Delvare wrote:
> > 
> > > But unfortunately, I fail to put your idea into practice because I
> > > fail to get the right parsing in the test file. If the test file reads
> > >   $ printf "\x02\x00\x01" > test
> > > I get x02x00x01 in the diff. I tried several combination, in vain.
> > > 
> > > Jean, you just rewrote the main loop and variable substitution parts
> > > of test/run. Do you have an idea of how to fix that too, please?
> > 
> > Well, just doubling the backslashes did the trick for me. The following
> > test case works for me (bash versions 3.2.51 and 4.2.45):
> > 
> >     $ printf "\\x02\\x00\\x01" > test.bin
> > 
> >     $ quilt new test2.diff
> >     > Patch %{P}test2.diff is now on top
> >     $ quilt add test.bin
> >     > File test.bin added to patch %{P}test2.diff
> > 
> >     $ printf "\\x03\\x00\\x01" > test.bin
> >     $ quilt diff -pab --no-index
> >     >~ (Files|Binary files) a/test\.bin and b/test\.bin differ
> > 
> > Does it not work for you?
> 
> Nope. It gives me the following, where the printf argument is written
> textually but not interpreted (bash 4.2.45).
> 
> [33] $ quilt diff -pab --no-index -- failed
> --- a/test.bin                        !~ (Files|Binary files) a/test\.bin and 
> b/test\.bin differ
> +++ b/test.bin                        != ~
> @@ -1 +1 @@                           != ~
> -\x02\x00\x01                         != ~
> \ No newline at end of file           != ~
> +\x03\x00\x01                         != ~
> \ No newline at end of file           != ~
> 
> I'm quite puzzled, I must admit. Just in case, my patch is here:
> http://anonscm.debian.org/gitweb/?p=collab-maint/quilt.git;a=blob;f=debian/patches/diff_exit_code;h=8c90d5384fa9962b71107b98eea145addd22514b;hb=HEAD

Hmm. We incorrectly assumed that portability of this construct wasn't an
issue because we were using bash. We aren't. The tester is written in
perl, and except for a few special cases, it blindly execs the commands
in the test cases. So we get /usr/bin/printf called here, not bash's
printf.

I am using GNU coreutils 8.12 and 8.21 on my machine. I suppose you are
using something else on your system.

You can check if your version of printf supports the octal escapes:

$ printf "\\002\\000\\001" > test.bin

If not then I suppose the best we can do is call bash explicitly:

$ bash -c "printf '\\x02\\x00\\x01'" > test.bin

Performance-wise it's suboptimal but I suppose we don't really care.

Or maybe I can special-case printf in the tester script, and have it
call perl's printf. That would perform better, I'll give it a try. (But
don't let this slow you down.)

-- 
Jean Delvare
Suse L3 Support




reply via email to

[Prev in Thread] Current Thread [Next in Thread]