6.10 glibc bad sed

Chris Buxton cbuxton at menandmice.com
Tue Jun 17 16:19:30 PDT 2008


This is a suggestion for a (very minor) code fix to build glibc in chapter 6.

My build script keeps logging an error with the following sed:

sed 's/#define UNSECURE_ENVVARS.*/&\
  "MUDFLAP_OPTIONS\\0" \\/' -i.orig sysdeps/generic/unsecvars.h

The error message is:

sed: -e expression #1, char 30: unterminated `s' command

The operation seems to complete anyway, and I don't get this error if I manually execute just this one command, but I'd like to eliminate the error message when the command is run from my script. Another sed statement that does exactly the same thing is:

sed '/#define UNSECURE_ENVVARS/a\  "MUDFLAP_OPTIONS\\0" \\' \
  -i.orig sysdeps/generic/unsecvars.h

Instead of performing a search and replace, with the replace value being the search value, a line ending, and another line, this sed searches for the specified line and appends another line after it. The text to be appended begins with whitespace, so the first space character must be escaped to make it be considered string literal rather than separator.

Chris Buxton
Professional Services
Men & Mice



More information about the hlfs-dev mailing list