[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: carriage return line endings vs. literal ^M in status.m4
From: |
Jim Meyering |
Subject: |
Re: carriage return line endings vs. literal ^M in status.m4 |
Date: |
Sat, 05 Apr 2008 14:26:40 +0200 |
Ralf Wildenhues <address@hidden> wrote:
> * Jim Meyering wrote on Sat, Apr 05, 2008 at 01:14:30PM CEST:
>>
>> Just got a clarification (stale Subject was misleading).
>> This is for OS/2 (www.ecomstation.com Ecs v2 rc4), not Maemo/OS2008.
>
> Thanks.
>
>> Elbert just replied privately.
>> My patch didn't help.
>> It's failing with sed's unterminated `s' command,
>> which makes me think this related code is the true culprit:
>>
>> cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
>> sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" < "$tmp/subs1.awk" >
>> "$tmp/subs.awk" \
>
> Sounds like it, yes.
>
>> When $ac_cr is ^M on a system where that is also the EOL marker,
>> that's exactly the error you'd get,
>
> How do we find out portably whether carriage return is the EOL marker?
> In that case we should skip the above sed script.
That's the question. I think this will do the job:
sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1 \
&& echo CR is not the EOL marker \
|| echo CR is the EOL marker
Complete patch below.
I'll point Elbert at a coreutils snapshot to test this.
The above-quoted use of sed also makes a point of converting ^M bytes
that are not at end of line. Any idea if/why that's needed?
I've confirmed that it serves no purpose in coreutils; i.e.,
its subs1.awk contains no embedded CR.
>> Now, I wonder if this is a fundamental violation of assumptions.
>
> Dunno, but I don't think this will be the last issue found on this
> system. IOW, testing should be iterated until we have something that
> really works.
Of course.
> Unfortunately, that may mean that what we have in the end may need to be
> retested on other systems. Not sure what to decide for 2.62 here, but
> if Eric has a preference I would certainly respect his decision on this
> matter.
I agree.
I'd prefer not to make such a change right now.
It's not even completed, it's for a very unusual target, and there's
been too much testing effort that would potentially be invalidated.
--------------------------------------------------------
>From 754efdebd34cc6e4ea6bbe90e4b516ce4fbe5ac6 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 5 Apr 2008 11:27:06 +0200
Subject: [PATCH] Work around CR EOL markers on OS/2 (www.ecomstation.com Ecs v2
rc4)
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): When CR
is the EOL marker, skip a step that would remove and translate
carriage return bytes. Reported by Elbert Pol.
Signed-off-by: Jim Meyering <address@hidden>
---
ChangeLog | 8 ++++++++
lib/autoconf/status.m4 | 11 +++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index df454bc..6703cc3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-05 Jim Meyering <address@hidden>
+
+ Do not use a literal carriage return (it may be the EOL marker).
+ * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Rather than
+ a literal ^M, derive the byte using echo and tr.
+ Using the literal would not work on a system using carriage
+ return as end-of-line marker.
+
2008-04-03 Eric Blake <address@hidden>
Fix version number generation in man pages.
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index b4dec08..09ec312 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -539,9 +539,16 @@ m4_ifdef([_AC_SUBST_FILES],
[\$ac_cs_awk_pipe_fini])
_ACAWK
_ACEOF
+dnl See if CR is the EOL marker. If not, remove any EOL-related
+dnl ^M bytes and escape any remaining ones. If so, just use mv.
cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" < "$tmp/subs1.awk" >
"$tmp/subs.awk" \
- || AC_MSG_ERROR([could not setup config files machinery])
+ac_awk_err=0
+sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1 \
+ && { sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" \
+ < "$tmp/subs1.awk" > "$tmp/subs.awk" || ac_awk_err=1; } \
+ || { mv "$tmp/subs1.awk" "$tmp/subs.awk" || ac_awk_err=1; }
+test $ac_awk_err = 1 \
+ && AC_MSG_ERROR([could not setup config files machinery])
_ACEOF
# VPATH may cause trouble with some makes, so we remove $(srcdir),
--
1.5.5.rc3.1.gaece
- carriage return line endings vs. literal ^M in status.m4, Jim Meyering, 2008/04/05
- Re: carriage return line endings vs. literal ^M in status.m4, Ralf Wildenhues, 2008/04/05
- Re: carriage return line endings vs. literal ^M in status.m4, Ralf Wildenhues, 2008/04/05
- Re: carriage return line endings vs. literal ^M in status.m4, Ralf Wildenhues, 2008/04/05
- Working os/2 configuratie, Elbert Pol, 2008/04/05
- Re: Working os/2 configuratie, Eric Blake, 2008/04/05
- Re: carriage return line endings vs. literal ^M in status.m4, Jim Meyering, 2008/04/05
- Re: carriage return line endings vs. literal ^M in status.m4, Ralf Wildenhues, 2008/04/05