On 08/09/2013 06:55 AM, Mike Miller wrote: > Testing against bison has shown one more error in bootstrap on OpenBSD. > The insert_if_absent function fails with the native sed, a file argument > of - is not recognized.
Bummer - I thought that POSIX required that behavior, but it appears to be optional: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html The sed utility shall conform to XBD Utility Syntax Guidelines , except that the order of presentation of the -e and -f options is significant. The standard input shall be used if no file operands are specified, and shall be used if a file operand is '-' and the implementation treats the '-' as meaning standard input. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named -. Where a utility described in the Shell and Utilities volume of POSIX.1-2008 as conforming to these guidelines is required to accept, or not to accept, the operand '-' to mean standard input or output, this usage is explained in the OPERANDS section. Otherwise, if such a utility uses operands to represent files, it is implementation-defined whether the operand '-' stands for standard input (or standard output), or for a file named -. Still, it seems like BSD could be nicer by implementing the common use of '-' to mean stdin. But as we must deal with existing implementations rather than waiting for a fix,... > The following change works for me and now > bootstrap runs completely without coreutils and without aliasing sed to > gsed. > > Thanks, > > diff --git a/build-aux/bootstrap b/build-aux/bootstrap > index 87d1512..9cd9404 100755 > --- a/build-aux/bootstrap > +++ b/build-aux/bootstrap > @@ -322,7 +322,7 @@ insert_if_absent() { > die "Error: Duplicate entries in $file: " $duplicate_entries > fi > linesold=$(gitignore_entries $file | wc -l) > - linesnew=$(echo "$str" | gitignore_entries - $file | sort -u | wc -l) > + linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc > -l) ...Yep, looks like we have to do this. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature