GNU bug report logs - #14493
MSYS line ending problem in t/cxx-demo.sh

Previous Next

Package: automake;

Reported by: Peter Rosin <peda <at> lysator.liu.se>

Date: Tue, 28 May 2013 23:46:02 UTC

Severity: minor

Tags: patch

Done: Stefano Lattarini <stefano.lattarini <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 14493 in the body.
You can then email your comments to 14493 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-automake <at> gnu.org:
bug#14493; Package automake. (Tue, 28 May 2013 23:46:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Rosin <peda <at> lysator.liu.se>:
New bug report received and forwarded. Copy sent to bug-automake <at> gnu.org. (Tue, 28 May 2013 23:46:02 GMT) Full text and rfc822 format available.

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

From: Peter Rosin <peda <at> lysator.liu.se>
To: bug-automake <at> gnu.org
Subject: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 01:43:25 +0200
Hi!

I have this interesting log snippet from a failed run of t/cxx-demo.sh
on the master branch (commit baf8a1c22acce0908):


+ for p in play work
+ ./play
+ cat exp.play
We are playing :-)
Howdy, play!
+ cat got.play
We are playing :-)
Howdy, play!
+ diff exp.play got.play
1,2c1,2
< We are playing :-)
< Howdy, play!
---
> We are playing :-)
> Howdy, play!
+ am_exit_trap 1
+ exit_status=1


This is on MSYS, and I strongly suspect a line ending discrepancy.
The output from ./play is likely to have CRNL line endings, while
exp.play is likely to have NL line endings. diff then barfs.

Cheers,
Peter




Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Wed, 29 May 2013 08:39:02 GMT) Full text and rfc822 format available.

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

From: Peter Rosin <peda <at> lysator.liu.se>
To: 14493 <at> debbugs.gnu.org
Subject: Re: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 10:36:55 +0200
On 2013-05-29 01:43, Peter Rosin wrote:
> This is on MSYS, and I strongly suspect a line ending discrepancy.
> The output from ./play is likely to have CRNL line endings, while
> exp.play is likely to have NL line endings. diff then barfs.

The problem is the same on the micro branch (87e49f4f040c8ab).

Cheers,
Peter





Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Wed, 29 May 2013 08:59:01 GMT) Full text and rfc822 format available.

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

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 14493 <at> debbugs.gnu.org
Subject: Re: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 10:57:06 +0200
On 05/29/2013 01:43 AM, Peter Rosin wrote:
> Hi!
> 
> I have this interesting log snippet from a failed run of t/cxx-demo.sh
> on the master branch (commit baf8a1c22acce0908):
>
And as you noted in your follow-up message, the problem is the same on
the micro branch (87e49f4f040c8ab))

> 
> + for p in play work
> + ./play
> + cat exp.play
> We are playing :-)
> Howdy, play!
> + cat got.play
> We are playing :-)
> Howdy, play!
> + diff exp.play got.play
> 1,2c1,2
> < We are playing :-)
> < Howdy, play!
> ---
>> We are playing :-)
>> Howdy, play!
> + am_exit_trap 1
> + exit_status=1
> 
> 
> This is on MSYS, and I strongly suspect a line ending discrepancy.
> The output from ./play is likely to have CRNL line endings, while
> exp.play is likely to have NL line endings. diff then barfs.
>
Any suggestion on how to easily fix this?

If not, I have a utterly untested idea:

  - Add a new helper function to t/ax/am-test-lib.sh that tells whether
    we are running on MinGW or no (you can steal existing code from the
    'require_tool()' function).

  - Use it in cxx-demo.sh to determine whether we are running under
    MinGW.

  - If that's the case, use perl to normalize the line endings (turning
    all CR-LF into simple LF).

Is this doable?

Thanks,
  Stefano




Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Wed, 29 May 2013 13:42:01 GMT) Full text and rfc822 format available.

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

From: Peter Rosin <peda <at> lysator.liu.se>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 14493 <at> debbugs.gnu.org
Subject: Re: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 15:39:14 +0200
On 2013-05-29 10:57, Stefano Lattarini wrote:
> On 05/29/2013 01:43 AM, Peter Rosin wrote:
>> Hi!
>>
>> I have this interesting log snippet from a failed run of t/cxx-demo.sh
>> on the master branch (commit baf8a1c22acce0908):
>>
> And as you noted in your follow-up message, the problem is the same on
> the micro branch (87e49f4f040c8ab))
> 
>>
>> + for p in play work
>> + ./play
>> + cat exp.play
>> We are playing :-)
>> Howdy, play!
>> + cat got.play
>> We are playing :-)
>> Howdy, play!
>> + diff exp.play got.play
>> 1,2c1,2
>> < We are playing :-)
>> < Howdy, play!
>> ---
>>> We are playing :-)
>>> Howdy, play!
>> + am_exit_trap 1
>> + exit_status=1
>>
>>
>> This is on MSYS, and I strongly suspect a line ending discrepancy.
>> The output from ./play is likely to have CRNL line endings, while
>> exp.play is likely to have NL line endings. diff then barfs.
>>
> Any suggestion on how to easily fix this?
> 
> If not, I have a utterly untested idea:
> 
>   - Add a new helper function to t/ax/am-test-lib.sh that tells whether
>     we are running on MinGW or no (you can steal existing code from the
>     'require_tool()' function).
> 
>   - Use it in cxx-demo.sh to determine whether we are running under
>     MinGW.
> 
>   - If that's the case, use perl to normalize the line endings (turning
>     all CR-LF into simple LF).
> 
> Is this doable?

Yes, but why not always zap all CR characters? Shouldn't weaken the test
by much...

Something like the below change perhaps? (perl seemed a bit heavy)

Cheers,
Peter


diff --git a/t/cxx-demo.sh b/t/cxx-demo.sh
index f6d568d..27d18e1 100644
--- a/t/cxx-demo.sh
+++ b/t/cxx-demo.sh
@@ -165,7 +165,7 @@ END
     Good morning, work.
 END
   for p in play work; do
-    ./$p > got.$p || { cat got.$p; exit 1; }
+    ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
     cat exp.$p
     cat got.$p
     diff exp.$p got.$p






Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Wed, 29 May 2013 14:21:02 GMT) Full text and rfc822 format available.

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

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: Peter Rosin <peda <at> lysator.liu.se>
Cc: 14493 <at> debbugs.gnu.org
Subject: Re: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 16:18:53 +0200
On 05/29/2013 03:39 PM, Peter Rosin wrote:
> On 2013-05-29 10:57, Stefano Lattarini wrote:
>> On 05/29/2013 01:43 AM, Peter Rosin wrote:
>>> Hi!
>>>
>>> I have this interesting log snippet from a failed run of t/cxx-demo.sh
>>> on the master branch (commit baf8a1c22acce0908):
>>>
>> And as you noted in your follow-up message, the problem is the same on
>> the micro branch (87e49f4f040c8ab))
>>
>>>
>>> + for p in play work
>>> + ./play
>>> + cat exp.play
>>> We are playing :-)
>>> Howdy, play!
>>> + cat got.play
>>> We are playing :-)
>>> Howdy, play!
>>> + diff exp.play got.play
>>> 1,2c1,2
>>> < We are playing :-)
>>> < Howdy, play!
>>> ---
>>>> We are playing :-)
>>>> Howdy, play!
>>> + am_exit_trap 1
>>> + exit_status=1
>>>
>>>
>>> This is on MSYS, and I strongly suspect a line ending discrepancy.
>>> The output from ./play is likely to have CRNL line endings, while
>>> exp.play is likely to have NL line endings. diff then barfs.
>>>
>> Any suggestion on how to easily fix this?
>>
>> If not, I have a utterly untested idea:
>>
>>   - Add a new helper function to t/ax/am-test-lib.sh that tells whether
>>     we are running on MinGW or no (you can steal existing code from the
>>     'require_tool()' function).
>>
>>   - Use it in cxx-demo.sh to determine whether we are running under
>>     MinGW.
>>
>>   - If that's the case, use perl to normalize the line endings (turning
>>     all CR-LF into simple LF).
>>
>> Is this doable?
> 
> Yes, but why not always zap all CR characters? Shouldn't weaken the test
> by much...
> 
> Something like the below change perhaps? (perl seemed a bit heavy)
> 
> Cheers,
> Peter
> 
> 
> diff --git a/t/cxx-demo.sh b/t/cxx-demo.sh
> index f6d568d..27d18e1 100644
> --- a/t/cxx-demo.sh
> +++ b/t/cxx-demo.sh
> @@ -165,7 +165,7 @@ END
>      Good morning, work.
>  END
>    for p in play work; do
> -    ./$p > got.$p || { cat got.$p; exit 1; }
> +    ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
>
Yeah, let's got for this (with a comment like "zap carriage-return characters,
for MinGW/MSYS" ;-).  No need to over-complicate stuff.  If in a few days I'll
still be convinced that it's worth making this conditional to MinGW, I'll do
that myself.

>      cat exp.$p
>      cat got.$p
>      diff exp.$p got.$p
> 
> 

Thanks,
  Stefano




Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Wed, 29 May 2013 14:58:02 GMT) Full text and rfc822 format available.

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

From: Peter Rosin <peda <at> lysator.liu.se>
To: "automake-patches <at> gnu.org" <automake-patches <at> gnu.org>
Cc: 14493 <at> debbugs.gnu.org
Subject: Re: bug#14493: MSYS line ending problem in t/cxx-demo.sh
Date: Wed, 29 May 2013 16:56:28 +0200
On 2013-05-29 16:18, Stefano Lattarini wrote:
> Yeah, let's got for this (with a comment like "zap carriage-return characters,
> for MinGW/MSYS" ;-).  No need to over-complicate stuff.  If in a few days I'll
> still be convinced that it's worth making this conditional to MinGW, I'll do
> that myself.

I'm pushing the below patch.

Cheers,
Peter



From 625678d54b616bf5c2db6c803f4b0746f70e3e53 Mon Sep 17 00:00:00 2001
From: Peter Rosin <peda <at> lysator.liu.se>
Date: Wed, 29 May 2013 16:53:55 +0200
Subject: [PATCH] tests: avoid a spurious failure on MSYS

Fixes automake bug#14493.

* t/cxx-demo.sh: Strip CR characters from the program output.

Signed-off-by: Peter Rosin <peda <at> lysator.liu.se>
---
 t/cxx-demo.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/t/cxx-demo.sh b/t/cxx-demo.sh
index f6d568d..f872c43 100644
--- a/t/cxx-demo.sh
+++ b/t/cxx-demo.sh
@@ -165,7 +165,8 @@ END
     Good morning, work.
 END
   for p in play work; do
-    ./$p > got.$p || { cat got.$p; exit 1; }
+    # Strip CR characters catering to MinGW programs on MSYS.
+    ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
     cat exp.$p
     cat got.$p
     diff exp.$p got.$p
-- 
1.7.9






Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Mon, 03 Jun 2013 10:05:01 GMT) Full text and rfc822 format available.

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

From: Stefano Lattarini <stefano.lattarini <at> gmail.com>
To: automake-patches <at> gnu.org
Cc: Peter Rosin <peda <at> lysator.liu.se>, 14493 <at> debbugs.gnu.org
Subject: [FYI] {micro} tests: slightly stricter checks in t/cxx-demo.sh
Date: Mon,  3 Jun 2013 12:02:12 +0200
This is a follow-up to the commit fixing automake bug#14493.

* t/cxx-demo.sh: Also check that the built program returns the
correct (i.e., zero) exit status when run.  And improve comments
a little while at it.

Signed-off-by: Stefano Lattarini <stefano.lattarini <at> gmail.com>
---
 t/cxx-demo.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/t/cxx-demo.sh b/t/cxx-demo.sh
index f872c43..97a46ce 100644
--- a/t/cxx-demo.sh
+++ b/t/cxx-demo.sh
@@ -165,7 +165,11 @@ END
     Good morning, work.
 END
   for p in play work; do
-    # Strip CR characters catering to MinGW programs on MSYS.
+    # The program must run correctly (exit status = 0).
+    ./$p
+    # And it must have the expected output.  Note that we strip extra
+    # CR characters (if any), to cater to MinGW programs on MSYS.
+    # See automake bug#14493.
     ./$p | tr -d '\015' > got.$p || { cat got.$p; exit 1; }
     cat exp.$p
     cat got.$p
-- 
1.8.3.rc3.8.g5e49f30





Added tag(s) patch. Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 03 Jun 2013 10:08:02 GMT) Full text and rfc822 format available.

Severity set to 'minor' from 'normal' Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 03 Jun 2013 10:08:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 14493 <at> debbugs.gnu.org and Peter Rosin <peda <at> lysator.liu.se> Request was from Stefano Lattarini <stefano.lattarini <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 03 Jun 2013 10:08:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-automake <at> gnu.org:
bug#14493; Package automake. (Mon, 03 Jun 2013 13:47:02 GMT) Full text and rfc822 format available.

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

From: Peter Rosin <peda <at> lysator.liu.se>
To: Stefano Lattarini <stefano.lattarini <at> gmail.com>
Cc: 14493 <at> debbugs.gnu.org, automake-patches <at> gnu.org
Subject: Re: bug#14493: [FYI] {micro} tests: slightly stricter checks in
	t/cxx-demo.sh
Date: Mon, 03 Jun 2013 15:45:02 +0200
On 2013-06-03 12:02, Stefano Lattarini wrote:
> This is a follow-up to the commit fixing automake bug#14493.
> 
> * t/cxx-demo.sh: Also check that the built program returns the
> correct (i.e., zero) exit status when run.  And improve comments
> a little while at it.

Good catch!

Cheers,
Peter





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 02 Jul 2013 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 41 days ago.

Previous Next


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