On 18 Sep 2010, at 13:40, Ralf Wildenhues wrote: > * Gary V. Vaughan wrote on Sat, Sep 18, 2010 at 07:20:18AM CEST: >> * README.alpha: Deleted. It was mostly identical to README. >> * libltdl/config/edit-readme-alpha: New script to edit the >> contents of README in the dist tree prior to tarring up. >> * Makefile.am (dist-hook): Run it before rolling alpha release >> tarball. > > For what it's worth ... > >> --- /dev/null >> +++ b/libltdl/config/edit-readme-alpha > >> +for file in "$@"; do >> + trap 'x=$?; rm $file.T; exit $x' 1 2 13 15 >> + >> + sed -e '/^This is GNU Libtool,/,/^interface.$/c\ >> +This is an alpha testing release of GNU Libtool, a generic library\ >> +support script. Libtool hides the complexity of using shared libraries\ >> +behind a consistent, portable interface.' $file > $file.T \ > > this script will wrongly exit with status 0 if the stdout redirection > fails at this point.
Ah, true. I was trying to keep the script simple, and overdid it a bit. In light of that, and my having noticed that the script also didn't complain if sed was unable to match any text to edit, I've now improved the script thus: > EXIT_SUCCESS=0 > EXIT_FAILURE=1 > > # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh > # is ksh but when the shell is invoked as "sh" and the current value of > # the _XPG environment variable is not equal to 1 (one), the special > # positional parameter $0, within a function call, is the name of the > # function. > progpath="$0" > > # The name of this program: > progname=`echo "$progpath" |sed 's|^.*/||'` > > > # func_fatal_error ARG... > # ----------------------- > # Echo program name prefixed message to standard error, and exit. > func_fatal_error () > { > echo "$progname: $*" >&2 > exit $EXIT_FAILURE > } > > > for file in "$@"; do > # Make sure the paragraph we are matching has not been edited since > # this script was written. > matched=`sed -n -e '/^This is GNU Libtool,/,/^interface.$/p' $file \ > |wc -l |sed 's|^ *||'` > test 3 = "$matched" \ > || func_fatal_error "$file format has changed, please fix \`$0'" > > # Don't leave file droppings. > trap 'x=$?; rm $file.T; exit $x' 1 2 13 15 > > # Edit the first paragraph to be suitable for an alpha release. > sed -e '/^This is GNU Libtool,/,/^interface.$/c\ > This is an alpha testing release of GNU Libtool, a generic library\ > support script. Libtool hides the complexity of using shared libraries\ > behind a consistent, portable interface.' $file > $file.T > > # Diagnose redirection failure. > test -f $file.T || func_fatal_error "Unable to write $file.T" > > # Overwrite the original file with our edited version. > mv $file.T $file || func_fatal_error "Unable to edit $file" > done > > exit $EXIT_SUCCESS Retested with version 2.2.11a and version 2.4.0 before pushing. Cheers, -- Gary V. Vaughan (g...@gnu.org)
PGP.sig
Description: This is a digitally signed message part