GNU bug report logs - #12019
join command - wrong column moved to start of line with the -v2 option

Previous Next

Package: coreutils;

Reported by: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>

Date: Sat, 21 Jul 2012 21:17:06 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12019 in the body.
You can then email your comments to 12019 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#12019; Package coreutils. (Sat, 21 Jul 2012 21:17:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 21 Jul 2012 21:17:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: join command - wrong column moved to start of line with the -v2 option
Date: Sat, 21 Jul 2012 20:20:38 +0200
[Message part 1 (text/plain, inline)]
Hello Maintainer,

I am using join v8.5 from debian squeeze.

When using the -v2 option with different join fields in files 1 and 2, the
join field which gets moved to the beginning of the result lines is the one
identified by the -1 option, not the one identified by the -2 option.


Here are my test files:
==== file a ====
axx111  keyX    axx222
ayy111  keyY    ayy222

==== file b ====
xxx111  xxx222  keyX    xxx333
zzz111  zzz222  keyZ    zzz333

now, the command:
   join   -v 2   -1 2   -2 3   a   b
produces
==== wrong output ====
zzz222 zzz111 keyZ zzz333

instead of
==== expected output ====
keyZ zzz111 zzz222 zzz333


The two following other commands work as expected:
   join    -v 1    -1 2    -2 3    a b
   join    -1 2    -2 3    a b

I did not find this problem in your database - or am I mistaken ?
Best regards,

-- 
Jean-Pierre Tosoni
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12019; Package coreutils. (Sat, 21 Jul 2012 22:18:01 GMT) Full text and rfc822 format available.

Message #8 received at 12019 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>
Cc: 12019 <at> debbugs.gnu.org
Subject: Re: bug#12019: join command - wrong column moved to start of line
	with the -v2 option
Date: Sat, 21 Jul 2012 16:11:23 -0600
[Message part 1 (text/plain, inline)]
tag 12019 moreinfo
thanks

On 07/21/2012 12:20 PM, Jean-Pierre Tosoni wrote:
> Hello Maintainer,
> 
> I am using join v8.5 from debian squeeze.
> 

> now, the command:
>    join   -v 2   -1 2   -2 3   a   b
> produces
> ==== wrong output ====
> zzz222 zzz111 keyZ zzz333

I tried reproducing this with coreutils 8.17:

$ cat a b
axx111 keyX axx222
ayy111 keyY ayy222
xxx111 xxx222 keyX xxx333
zzz111 zzz222 keyZ zzz333
$ join -v2 -1 2 -2 3 a b
keyZ zzz111 zzz222 zzz333

but I get the expected order.  I don't see a specific mention of a fix
for this in NEWS, so I have to wonder if this might be a bug in a
debian-specific patch.  Can you do some more investigating, such as
compiling upstream coreutils to see if the problem still persists for you?

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12019; Package coreutils. (Sat, 21 Jul 2012 23:29:01 GMT) Full text and rfc822 format available.

Message #11 received at 12019 <at> debbugs.gnu.org (full text, mbox):

From: "Alan Curry" <pacman-cu <at> kosh.dhis.org>
To: eblake <at> redhat.com (Eric Blake)
Cc: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>, 12019 <at> debbugs.gnu.org
Subject: Re: bug#12019: join command - wrong column moved to start of line with
Date: Sat, 21 Jul 2012 18:22:29 -0500 (GMT+5)
Eric Blake writes:
> 
> On 07/21/2012 12:20 PM, Jean-Pierre Tosoni wrote:
> > Hello Maintainer,
> >=20
> > I am using join v8.5 from debian squeeze.
> >=20
> 
> > now, the command:
> >    join   -v 2   -1 2   -2 3   a   b
> > produces
> > =3D=3D=3D=3D wrong output =3D=3D=3D=3D
> > zzz222 zzz111 keyZ zzz333
> 
> I tried reproducing this with coreutils 8.17:
> 
> $ cat a b
> axx111 keyX axx222
> ayy111 keyY ayy222
> xxx111 xxx222 keyX xxx333
> zzz111 zzz222 keyZ zzz333
> $ join -v2 -1 2 -2 3 a b
> keyZ zzz111 zzz222 zzz333
> 
> but I get the expected order.  I don't see a specific mention of a fix
> for this in NEWS, so I have to wonder if this might be a bug in a
> debian-specific patch.  Can you do some more investigating, such as
> compiling upstream coreutils to see if the problem still persists for you=
> ?

It's not a Debian-specific problem. I can reproduce the bug with unaltered
coreutils 8.9. It was apparently fixed by accident as a side effect of some
other work on the join program.

commit d4db0cb1827730ed5536c12c0ebd024283b3a4db
Author: Pádraig Brady <P <at> draigBrady.com>
Date:   Wed Jan 5 11:52:54 2011 +0000

    join: add -o 'auto' to output a constant number of fields per line

d4db0cb1827730ed5536c12c0ebd024283b3a4db can be cherry-picked and applied to
older coreutils to fix the bug. I tested this with upstream 8.9 and Debian's
8.5, both applied with fuzz but worked correctly.

-- 
Alan Curry




Information forwarded to bug-coreutils <at> gnu.org:
bug#12019; Package coreutils. (Sun, 22 Jul 2012 15:20:01 GMT) Full text and rfc822 format available.

Message #14 received at 12019 <at> debbugs.gnu.org (full text, mbox):

From: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: 12019 <at> debbugs.gnu.org
Subject: Re: bug#12019: join command - wrong column moved to start of line
	with the -v2 option
Date: Sun, 22 Jul 2012 17:12:49 +0200
[Message part 1 (text/plain, inline)]
Hello again,

I investigated against various sources at gnu.org.
The bug exists at least in versions 8.5 to 8.9, and was corrected in
version 8.10, probably by chance during implementation of output formatting
extensions.

Hence the problem comes from debian-squeeze using an old release, and this
issue can be closed, as far as I am concerned.

Thanks for taking the time to test it anyway.

Jean-Pierre
[Message part 2 (text/html, inline)]

Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Mon, 23 Jul 2012 09:08:02 GMT) Full text and rfc822 format available.

Notification sent to Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>:
bug acknowledged by developer. (Mon, 23 Jul 2012 09:08:03 GMT) Full text and rfc822 format available.

Message #19 received at 12019-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Alan Curry <pacman-cu <at> kosh.dhis.org>
Cc: Jean-Pierre Tosoni <jpt.7196 <at> gmail.com>, Eric Blake <eblake <at> redhat.com>,
	12019-done <at> debbugs.gnu.org
Subject: Re: bug#12019: join command - wrong column moved to start of line with
Date: Mon, 23 Jul 2012 10:01:05 +0100
[Message part 1 (text/plain, inline)]
On 07/22/2012 12:22 AM, Alan Curry wrote:
> Eric Blake writes:
>>
>> On 07/21/2012 12:20 PM, Jean-Pierre Tosoni wrote:
>>> Hello Maintainer,
>>> =20
>>> I am using join v8.5 from debian squeeze.
>>> =20
>>
>>> now, the command:
>>>    join   -v 2   -1 2   -2 3   a   b
>>> produces
>>> =3D=3D=3D=3D wrong output =3D=3D=3D=3D
>>> zzz222 zzz111 keyZ zzz333
>>
>> I tried reproducing this with coreutils 8.17:
>>
>> $ cat a b
>> axx111 keyX axx222
>> ayy111 keyY ayy222
>> xxx111 xxx222 keyX xxx333
>> zzz111 zzz222 keyZ zzz333
>> $ join -v2 -1 2 -2 3 a b
>> keyZ zzz111 zzz222 zzz333
>>
>> but I get the expected order.  I don't see a specific mention of a fix
>> for this in NEWS, so I have to wonder if this might be a bug in a
>> debian-specific patch.  Can you do some more investigating, such as
>> compiling upstream coreutils to see if the problem still persists for you=
>> ?
> 
> It's not a Debian-specific problem. I can reproduce the bug with unaltered
> coreutils 8.9. It was apparently fixed by accident as a side effect of some
> other work on the join program.
> 
> commit d4db0cb1827730ed5536c12c0ebd024283b3a4db
> Author: Pádraig Brady <P <at> draigBrady.com>
> Date:   Wed Jan 5 11:52:54 2011 +0000
> 
>     join: add -o 'auto' to output a constant number of fields per line
> 
> d4db0cb1827730ed5536c12c0ebd024283b3a4db can be cherry-picked and applied to
> older coreutils to fix the bug. I tested this with upstream 8.9 and Debian's
> 8.5, both applied with fuzz but worked correctly.
> 

Thanks for looking into that Alan, and thanks for reporting this Jean-Pierre.
I've installed the attached to document the fix and add a test.

cheers,
Pádraig.


[join-v2-test.diff (text/plain, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#12019; Package coreutils. (Mon, 23 Jul 2012 09:52:01 GMT) Full text and rfc822 format available.

Message #22 received at 12019 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 12019 <at> debbugs.gnu.org
Cc: P <at> draigBrady.com
Subject: Re: bug#12019: join command - wrong column moved to start of line with
Date: Mon, 23 Jul 2012 11:44:36 +0200
Pádraig Brady wrote:
...
> Thanks for looking into that Alan, and thanks for reporting this Jean-Pierre.
> I've installed the attached to document the fix and add a test.
...
> Subject: [PATCH] tests: add a test for a previously fixed output format bug
>  in join
>
> Add a test and NEWS entry for a bug inadvertently fixed in
> a refactoring in commit v8.9-32-gd4db0cb
>
> * tests/misc/join (v2-format): Add a new test.
> * THANKS.in: Add the reporter.
> * NEWS: Mention the old bug.
> * cfg.mk (old_NEWS_hash): Update.
>
> Reported-by: Jean-Pierre Tosoni
> ---
>  NEWS            |    4 ++++
>  THANKS.in       |    1 +
>  cfg.mk          |    2 +-
>  tests/misc/join |    4 ++++

Nice work.
Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 20 Aug 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 25 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.