GNU bug report logs - #18186
cat.c needs fixing since 1998

Previous Next

Package: coreutils;

Reported by: "James Simmons" <james <at> pcug.us>

Date: Sun, 3 Aug 2014 20:19:02 UTC

Severity: normal

Tags: moreinfo

Done: Assaf Gordon <assafgordon <at> gmail.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 18186 in the body.
You can then email your comments to 18186 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#18186; Package coreutils. (Sun, 03 Aug 2014 20:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "James Simmons" <james <at> pcug.us>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sun, 03 Aug 2014 20:19:02 GMT) Full text and rfc822 format available.

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

From: "James Simmons" <james <at> pcug.us>
To: <bug-coreutils <at> gnu.org>
Subject: cat.c needs fixing since 1998
Date: Sun, 3 Aug 2014 12:26:54 -0400
[Message part 1 (text/plain, inline)]
Way back in 1998, Earnie Boyd asked about the binary option for concatenating files in Cygwin.
Now, almost 16 years later, I find that I need the binary option for cat, and I also find that cat.c still does NOT have the option! Here is a copy of that long-ago request and the response from Don Baarda.
The work-around that Don suggested is not an option, since I need this in a bash script. (Cygwin automatically runs Bash as it’s shell.)

When will the cat.c code be updated to function as it did in original Unix? ( cat [file1.. file2.. file n] >>output
At the very least, a binary option should be added to the code.

Regards,
James A. Simmons, President & CEO
The Personal Computer User Group, International
james <at> pcug.us
http://www.james-simmons.info
http://www.pcug.us


Re: best way to append binary files together?
  a.. To: "BAARDA, Don" <dbaarda at baea dot com dot au> 
  b.. Subject: Re: best way to append binary files together? 
  c.. From: Earnie Boyd <earnie_boyd at yahoo dot com> 
  d.. Date: Wed, 2 Dec 1998 12:07:21 -0800 (PST) 
  e.. Cc: cygwin users <gnu-win32 at cygnus dot com> 
  f.. Reply-To: earnie_boyd at yahoo dot com

--------------------------------------------------------------------------------

---"BAARDA, Don" <dbaarda <at> baea.com.au> wrote:
>
> 
> I know I can turn off text mode with either the CYGWIN environment
variable
> or by using mount options, but I'd be interested in what the best
way of
> doing this is.
> 

IMHO fix the cat.c source.  The workaround I would use would be to SET
CYGWIN=binmode before starting bash.

==
-                        \\||//
-------------------o0O0--Earnie--0O0o-------------------
--                earnie_boyd <at> yahoo.com               --
-- http://www.freeyellow.com/members5/gw32/index.html --
----------------------ooo0O--O0ooo----------------------

PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

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

Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Sun, 03 Aug 2014 20:44:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: James Simmons <james <at> pcug.us>, 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Sun, 03 Aug 2014 13:42:49 -0700
James Simmons wrote:
> When will the cat.c code be updated to function as it did in original Unix?

It already does that, as far as I can tell.  If not, please supply a 
simple test case illustrating the problem, using the most recent version 
of coreutils.




Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Mon, 04 Aug 2014 13:27:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: James Simmons <james <at> pcug.us>, 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Mon, 04 Aug 2014 07:26:04 -0600
[Message part 1 (text/plain, inline)]
On 08/03/2014 10:26 AM, James Simmons wrote:
> Way back in 1998, Earnie Boyd asked about the binary option for concatenating files in Cygwin.
> Now, almost 16 years later, I find that I need the binary option for cat, and I also find that cat.c still does NOT have the option! Here is a copy of that long-ago request and the response from Don Baarda.
> The work-around that Don suggested is not an option, since I need this in a bash script. (Cygwin automatically runs Bash as it’s shell.)

Have you also asked on the Cygwin list?  I just barely released
coreutils-8.23-1 for cygwin last weekend, and would prefer to have
feedback on the cygwin list before deciding if the problems you are
encountering are an issue with the downstream patches or something that
needs to be pushed upstream.  Most likely, cygwin is already doing the
right thing by _always_ doing the concatenation in binary mode.

-- 
Eric Blake   eblake 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#18186; Package coreutils. (Fri, 08 Aug 2014 00:01:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "James Simmons, President & CEO" <james <at> pcug.us>
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Thu, 07 Aug 2014 17:00:37 -0700
James Simmons, President & CEO wrote:
> cat file1.txt file2.txt >>output.txt
>
> file1.txt contains a single line containing IP addresses.
> file2.txt contains a single line with more IP addresses.
>
> output.txt SHOULD contain a single line

If the input contains two lines, the output should too.  Sorry, I don't 
see a bug here.




Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Fri, 08 Aug 2014 04:53:01 GMT) Full text and rfc822 format available.

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

From: "James Simmons, President & CEO" <james <at> pcug.us>
To: "Paul Eggert" <eggert <at> cs.ucla.edu>
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Fri, 8 Aug 2014 00:52:01 -0400
Each file has 1 line with no newline. concatenation should NOT have a 
newline.
That is the point of concatenation.

-----Original Message----- 
From: Paul Eggert
Sent: Thursday, August 07, 2014 8:00 PM
To: James Simmons, President & CEO
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998

James Simmons, President & CEO wrote:
> cat file1.txt file2.txt >>output.txt
>
> file1.txt contains a single line containing IP addresses.
> file2.txt contains a single line with more IP addresses.
>
> output.txt SHOULD contain a single line

If the input contains two lines, the output should too.  Sorry, I don't
see a bug here. 





Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Fri, 08 Aug 2014 05:35:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: "James Simmons, President & CEO" <james <at> pcug.us>
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Thu, 07 Aug 2014 22:33:49 -0700
James Simmons, President & CEO wrote:
> Each file has 1 line with no newline.

Ah, that wasn't clear from your email.  I'm afraid we still don't have a 
simple, self-contained test case that illustrates the bug so that others 
can easily reproduce it.  It may be helpful to browse the "Bug Reports" 
section of:

http://www.gnu.org/software/coreutils/




Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Fri, 08 Aug 2014 12:28:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: "James Simmons, President & CEO" <james <at> pcug.us>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Fri, 08 Aug 2014 06:27:41 -0600
[Message part 1 (text/plain, inline)]
On 08/07/2014 10:52 PM, James Simmons, President & CEO wrote:
> Each file has 1 line with no newline. concatenation should NOT have a
> newline.
> That is the point of concatenation.

The POSIX definition of line requires a newline at the end; if you have
text but no newline, the file is not a text file.  However, cat is not a
line-oriented utility, so it should not be caring whether the input
files are text based, and should not be injecting newlines into the
output if the input did not have newlines.

Please show us the content of the files you claim are being
mis-concatentated using something like 'od -tx1z', as well as the
contents of the output file, so that we can try to reproduce your issue.

-- 
Eric Blake   eblake 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#18186; Package coreutils. (Fri, 08 Aug 2014 13:16:01 GMT) Full text and rfc822 format available.

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

From: Bernhard Voelker <mail <at> bernhard-voelker.de>
To: "James Simmons, President & CEO" <james <at> pcug.us>, 
 Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Fri, 08 Aug 2014 15:14:52 +0200
On 08/08/2014 06:52 AM, James Simmons, President & CEO wrote:
> Each file has 1 line with no newline. concatenation should NOT have a newline.
> That is the point of concatenation.

As you referred to Cygwin - here's the case on that platform:

  $ uname -a
  CYGWIN_NT-6.1 xxxxxxxx 1.7.31(0.272/5/3) 2014-07-25 11:26 x86_64 Cygwin

  $ $ cat --version | sed 1q
  cat (GNU coreutils) 8.15

  $ printf 1234 > file1

  $ printf 5678 > file2

  $ cat file1 file2 > file12

  $ file file1 file2 file12
  file1:  ASCII text, with no line terminators
  file2:  ASCII text, with no line terminators
  file12: ASCII text, with no line terminators

  $ od -An -tx1z file12
   31 32 33 34 35 36 37 38                          >12345678<

I don't see a bug here either.

Have a nice day,
Berny




Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Fri, 08 Aug 2014 18:05:01 GMT) Full text and rfc822 format available.

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

From: Linda Walsh <coreutils <at> tlinx.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 18186 <at> debbugs.gnu.org, "James Simmons, President & CEO" <james <at> pcug.us>
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Fri, 08 Aug 2014 11:04:31 -0700
Paul Eggert wrote:
> James Simmons, President & CEO wrote:
>> cat file1.txt file2.txt >>output.txt
>>
>> file1.txt contains a single line containing IP addresses.
>> file2.txt contains a single line with more IP addresses.
>>
>> output.txt SHOULD contain a single line
>
> If the input contains two lines, the output should too.  Sorry, I 
> don't see a bug here.
---
If he is using an editor like Vim,
it will not show you the last linefeeds in the file because
it always inserts them automatically unless you are in binary mode.

I had a similar problem with vim force inserting an LF on a file update,
just to "help me".  The problem comes when you want to concatenate
text fields, where neither are terminated by an LF.  I think that may be
what the OP is expecting, not knowing that the problem may be in their text
editor that won't inhibit LF <at> EOF in text mode even though it has a flag 
for it.








Information forwarded to bug-coreutils <at> gnu.org:
bug#18186; Package coreutils. (Fri, 19 Oct 2018 00:53:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 18186 <at> debbugs.gnu.org
Subject: Re: bug#18186: cat.c needs fixing since 1998
Date: Thu, 18 Oct 2018 18:52:47 -0600
tags 18186 moreinfo
close 18186
stop

(triaging old bugs)

On 08/08/14 07:14 AM, Bernhard Voelker wrote:
> On 08/08/2014 06:52 AM, James Simmons, President & CEO wrote:
>> Each file has 1 line with no newline. concatenation should NOT have a 
>> newline.
>> That is the point of concatenation.
> 
> As you referred to Cygwin - here's the case on that platform:
[...]
> I don't see a bug here either.

with no further follow-ups in 4 years, I'm closing this bug.

regards,
 - assaf





Added tag(s) moreinfo. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 00:53:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 18186 <at> debbugs.gnu.org and "James Simmons" <james <at> pcug.us> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 00:53:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 16 Nov 2018 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 215 days ago.

Previous Next


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