GNU bug report logs - #70699
Possible bug in /usr/bin/paste

Previous Next

Package: coreutils;

Reported by: Art Shelest <ashelest <at> browarddefender.org>

Date: Wed, 1 May 2024 15:23:02 UTC

Severity: normal

To reply to this bug, email your comments to 70699 AT debbugs.gnu.org.

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#70699; Package coreutils. (Wed, 01 May 2024 15:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Art Shelest <ashelest <at> browarddefender.org>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 01 May 2024 15:23:02 GMT) Full text and rfc822 format available.

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

From: Art Shelest <ashelest <at> browarddefender.org>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: Possible bug in /usr/bin/paste
Date: Wed, 1 May 2024 14:28:18 +0000
[Message part 1 (text/plain, inline)]
Good morning,

I am seeing an aberrant behavior from the /usr/bin/paste utility when working with Windows-style CR/LF text files.
The repro is for Mint Mate (Virginia).

If I change the line endings in the first file to Unix format (LF), it works as expected.
If I change the line endings to Max (CR), it breaks even worse.

$ hexdump -C letters.txt
00000000  61 61 09 41 41 0d 0a 62  62 09 42 42 0d 0a        |aa.AA..bb.BB..|

$ cat letters.txt
aa   AA
bb   BB
$ cat numbers.txt
1
2
$ paste letters.txt numbers.txt
aa   1A
bb   2B
$


Expected:
$ paste letters.txt numbers.txt
aa   AA   1
bb   BB   2

Thank you.

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

Information forwarded to bug-coreutils <at> gnu.org:
bug#70699; Package coreutils. (Wed, 01 May 2024 16:26:02 GMT) Full text and rfc822 format available.

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

From: Pádraig Brady <P <at> draigBrady.com>
To: Art Shelest <ashelest <at> browarddefender.org>, 70699 <at> debbugs.gnu.org
Subject: Re: bug#70699: Possible bug in /usr/bin/paste
Date: Wed, 1 May 2024 17:24:46 +0100
On 01/05/2024 15:28, Art Shelest via GNU coreutils Bug Reports wrote:
> Good morning,
> 
> I am seeing an aberrant behavior from the /usr/bin/paste utility when working with Windows-style CR/LF text files.
> The repro is for Mint Mate (Virginia).
> 
> If I change the line endings in the first file to Unix format (LF), it works as expected.
> If I change the line endings to Max (CR), it breaks even worse.
> 
> $ hexdump -C letters.txt
> 00000000  61 61 09 41 41 0d 0a 62  62 09 42 42 0d 0a        |aa.AA..bb.BB..|
> 
> $ cat letters.txt
> aa   AA
> bb   BB
> $ cat numbers.txt
> 1
> 2
> $ paste letters.txt numbers.txt
> aa   1A
> bb   2B
> $
> 
> 
> Expected:
> $ paste letters.txt numbers.txt
> aa   AA   1
> bb   BB   2
> 
> Thank you.
> 

paste(1) is treating the CR like a standard character,
and when outputting that back to the terminal it "messes up" the expected output.
I suggest you convert any such files to unix format before processing.

thanks,
Pádraig




Information forwarded to bug-coreutils <at> gnu.org:
bug#70699; Package coreutils. (Wed, 01 May 2024 16:34:02 GMT) Full text and rfc822 format available.

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

From: Art Shelest <ashelest <at> browarddefender.org>
To: Pádraig Brady <P <at> draigBrady.com>,
 "70699 <at> debbugs.gnu.org" <70699 <at> debbugs.gnu.org>
Subject: RE: [External] Re: bug#70699: Possible bug in /usr/bin/paste
Date: Wed, 1 May 2024 16:32:46 +0000
Yes, this is the bug.

Will you please fix it?


-----Original Message-----
From: Pádraig Brady <pixelbeat <at> gmail.com> On Behalf Of Pádraig Brady
Sent: Wednesday, May 1, 2024 12:25 PM
To: Art Shelest <ashelest <at> browarddefender.org>; 70699 <at> debbugs.gnu.org
Subject: [External] Re: bug#70699: Possible bug in /usr/bin/paste

On 01/05/2024 15:28, Art Shelest via GNU coreutils Bug Reports wrote:
> Good morning,
> 
> I am seeing an aberrant behavior from the /usr/bin/paste utility when working with Windows-style CR/LF text files.
> The repro is for Mint Mate (Virginia).
> 
> If I change the line endings in the first file to Unix format (LF), it works as expected.
> If I change the line endings to Max (CR), it breaks even worse.
> 
> $ hexdump -C letters.txt
> 00000000  61 61 09 41 41 0d 0a 62  62 09 42 42 0d 0a        |aa.AA..bb.BB..|
> 
> $ cat letters.txt
> aa   AA
> bb   BB
> $ cat numbers.txt
> 1
> 2
> $ paste letters.txt numbers.txt
> aa   1A
> bb   2B
> $
> 
> 
> Expected:
> $ paste letters.txt numbers.txt
> aa   AA   1
> bb   BB   2
> 
> Thank you.
> 

paste(1) is treating the CR like a standard character, and when outputting that back to the terminal it "messes up" the expected output.
I suggest you convert any such files to unix format before processing.

thanks,
Pádraig

Information forwarded to bug-coreutils <at> gnu.org:
bug#70699; Package coreutils. (Wed, 01 May 2024 17:01:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Art Shelest <ashelest <at> browarddefender.org>,
 Pádraig Brady <P <at> draigBrady.com>,
 "70699 <at> debbugs.gnu.org" <70699 <at> debbugs.gnu.org>
Subject: Re: bug#70699: Possible bug in /usr/bin/paste
Date: Wed, 1 May 2024 10:00:18 -0700
On 2024-05-01 09:32, Art Shelest via GNU coreutils Bug Reports wrote:
> Yes, this is the bug.
> 
> Will you please fix it?

I don't see a bug here. In the POSIX world, CR is just another character 
and 'paste' is required to paste it like it would paste any other character.

As you mentioned, a simple way to fix it is to remove the CRs first, 
e.g., with the command "tr -d '\r'". In Bash:

paste <(tr -d '\r' letters.txt) <(tr -d '\r' numbers.txt)





This bug report was last modified 206 days ago.

Previous Next


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