autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unbreak Cygwin bash igncr mode with ac_cr


From: Eric Blake
Subject: Re: Unbreak Cygwin bash igncr mode with ac_cr
Date: Tue, 24 Mar 2009 06:42:52 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Aaron W. LaFramboise on 3/22/2009 12:06 AM:
> Please see the attached patch, which as far as I know, should only
> activate if igncr or something like it is in use.  Note it uses a bash
> extension, as discussed previously, but since only bash has igncr, I
> think this is OK.

I'm a little bit wary of this, but think it will work.  We are requesting
to perform an eval that will crash non-bash shells without first testing
that $'' is available, but the eval should only happen if ac_cr is empty,
which in turn should only happen if your shell eats \r inside ``.  Since
the only shell we know that does that is bash on cygwin with igncr mode,
and bash understands $'', I guess it's safe.  At any rate, the testsuite
should catch things if it turned out to not be so smart.  So I'm applying
this patch, which adds some comments, touches up your ChangeLog entry, and
adds you to THANKS.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknI1UwACgkQ84KuGfSFAYBz0ACgwiwXJnqWv/JWOTN3d8DOraEU
qKQAmQHidRIhV1uo8mn4v6bVsv+Y7Ym3
=1S8R
-----END PGP SIGNATURE-----
>From 60e637d68fd3f8595894e7b8155150893e928069 Mon Sep 17 00:00:00 2001
From: Aaron W. LaFramboise <address@hidden>
Date: Sun, 22 Mar 2009 01:06:58 -0500
Subject: [PATCH] Work around cygwin bash igncr mode.

* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Fall back to
bash carriage returns if ac_cr lost \r from ``.
* THANKS: Update.
Suggested by Eric Blake.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog              |    8 ++++++++
 THANKS                 |    1 +
 lib/autoconf/status.m4 |    6 ++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6b82e5..6bb006e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-03-24  Aaron W. LaFramboise  <address@hidden>  (tiny change)
+
+       Work around cygwin bash igncr mode.
+       * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Fall back to
+       bash carriage returns if ac_cr lost \r from ``.
+       * THANKS: Update.
+       Suggested by Eric Blake.
+
 2009-03-24  Eric Blake  <address@hidden>

        Fix underquoted example in manual.
diff --git a/THANKS b/THANKS
index 6c9da3b..019d9fd 100644
--- a/THANKS
+++ b/THANKS
diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 6e5a904..0e118f2 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -377,6 +377,12 @@ else
   ac_cs_awk_pipe_fini='END { print "|#_!!_#|"; print ":" }'
 fi]])
 ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
   ac_cs_awk_cr='\\r'
-- 
1.6.1.2


reply via email to

[Prev in Thread] Current Thread [Next in Thread]