[Top][All Lists]

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

Re: non portable sed scripts

From: Paul Eggert
Subject: Re: non portable sed scripts
Date: Tue, 23 May 2006 01:31:26 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Ralf Wildenhues <address@hidden> writes:

> I'm undecided about this.  Paul has more experience and
> will have to deal with bug reports against coreutils,  ;-)
> so I'd appreciate input on this.

Let's drop it to 50, as a stopgap.  Also, we can trim a few bytes from
the sed scripts, which gives us a slightly bigger safety margin.  I
installed this:

2006-05-23  Paul Eggert  <address@hidden>

        * lib/autoconf/status.m4 (_AC_OUTPUT_HEADER): Simplify ac_dA and
        ac_dB slightly, to save bytes in the script.
        Max out at 50 lines, rather than 96; this is more likely
        (though not guaranteed) to avoid obscure 'sed' failures.

--- lib/autoconf/status.m4      22 May 2006 10:40:42 -0000      1.105
+++ lib/autoconf/status.m4      23 May 2006 08:27:32 -0000      1.106
@@ -608,8 +608,8 @@ m4_define([_AC_OUTPUT_HEADER],
   # just an empty string.
 dnl Quote, for the `[ ]' and `define'.
-[  ac_dA='s,^\([        ]*#[    ]*\)[^  ]*\([   ][      ]*'
-  ac_dB='\)[    (].*$,\1define\2'
+[  ac_dA='s,^\([        #]*\)[^         ]*\([   ]*'
+  ac_dB='\)[    (].*,\1define\2'
   ac_dC=' '
   ac_dD=' ,']
 dnl ac_dD used to contain `;t' at the end, but that was both slow and 
@@ -660,7 +660,15 @@ echo 's/ $//
 [s,^[   #]*u.*,/* & */,]' >>conftest.defines
 # Break up conftest.defines:
-ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
+dnl If we cared only about not exceeding line count limits, we would use this:
+dnl ac_max_sed_lines=m4_eval(_AC_SED_CMD_LIMIT - 3)
+dnl But in practice this can generate scripts that contain too many bytes;
+dnl and this can cause obscure 'sed' failures, e.g.,
+dnl So instead, we use the following, which is about half the size we'd like:
+dnl In the future, let's use awk or sh instead of sed to do substitutions,
+dnl since we have so many problems with sed.
 # First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
 # Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"

reply via email to

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