[Top][All Lists]

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

Re: [bug #35580] bootstrap is not portable to OpenBSD

From: Eric Blake
Subject: Re: [bug #35580] bootstrap is not portable to OpenBSD
Date: Fri, 09 Aug 2013 07:31:28 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7

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:

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.

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

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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