Bug 1434468

Summary: /usr/bin/join displays fields in wrong order for unpairable lines
Product: Red Hat Enterprise Linux 6 Reporter: Renaud Métrich <rmetrich>
Component: coreutilsAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.8CC: fsumsal, jaroslaw.polok, jkurik, kdudka, kwalker, mkolbas, rskvaril, tbowling
Target Milestone: rcKeywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: coreutils-8.4-47.el6 Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-19 05:09:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1461138, 1494481    
Attachments:
Description Flags
[PATCH] join: print fields in the correct order for unpaired lines none

Description Renaud Métrich 2017-03-21 14:48:24 UTC
Description of problem:

Per join(1) manpage, the "join" utility is supposed to print the "Join field", then remaining fields from FILE1, then remaining fields from FILE2:

"Default FORMAT outputs  the  join  field, the remaining fields from FILE1, the remaining fields from FILE2, all separated by CHAR."

When printing unpairable lines from FILE2 (using the "-v 2" option) and specifying the second field as "Join field" (using the "-2 2" option), the fields are printed in wrong order.


Version-Release number of selected component (if applicable):

coreutils-8.4-46.el6


How reproducible:

Always

Steps to Reproduce:

$ echo "a b" | join -v 2 -2 2 /dev/null -

Actual results:

"a b"

Expected results:

"b a"

Additional info:

The issue is not present on RHEL7 (coreutils-8.22).
The issue happens only when printing unpaired lines of FILE2.

Everything works with FILE1 as shown below:

$ echo "a b" | join -v 1 -1 1  - /dev/null
a b

Joining on second field, displaying unjoinable lines from first file:
$ echo "a b" | join -v 1 -1 2  - /dev/null
b a

Comment 3 Kamil Dudka 2017-04-03 16:47:53 UTC
Sorry for replying late on this!

This bug seems to be fixed as a side effect of the following upstream commit:

http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.9-32-gd4db0cb

I am able to extract the fix out of the above commit...

Comment 9 Jarek Polok 2018-03-09 09:21:00 UTC
Any new about release date please ?

Thanks

Jarek

Comment 10 Kamil Dudka 2018-03-09 11:23:05 UTC
(In reply to Jarek Polok from comment #9)
> Any new about release date please ?

We do not (and cannot) advertise release dates through Bugzilla.  Anyway, I will attach an unofficial patch for this bug in case you want to rebuild the package on your own.  Needless to say that you are out of support if you take this route.

Comment 11 Kamil Dudka 2018-03-09 11:25:10 UTC
Created attachment 1406245 [details]
[PATCH] join: print fields in the correct order for unpaired lines

Comment 15 errata-xmlrpc 2018-06-19 05:09:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:1862