pkgsrc-Users archive

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

Re: pkgsrc on Ubuntu: recent libtool bash/dash fallout with _bUiLdLiNk_

On Mon, Sep 22, 2014 at 07:47:28PM -0400, Greg Troxel wrote:
> Joerg Sonnenberger <> writes:
> > We don't support dash.
> Well, it seems we aim to have code that works on shells that conform
> to
> POSIX.   Is this a case of something in dash feeling to meet POSIX?

One possible workaround would be to use printf instead of echo.

    echo='printf %s\n'

    $echo "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"

This works with bash and dash as well, and printf is a shell-builtin, at
least in my local versions of bash and dash.

That it doesn't work in dash with echo is a misfeature/bug handling the
\<digit> escapes. This apparently only hits in the command line parser,
not the heredoc parser.  (the latest change in
mk/wrapper/ was to use "echo" instead of "cat"+heredoc)

example line from
                      $echo "s|\([$_sep]\)$1\([$_sep]\)|\1$2\2|g"

dash interprets the "\1" and "\2" as ctrl-a and ctrl-b.

    $ dash -c 'echo "\1\2"'  | hexdump -C
    00000000  01 02 0a                                          |...|

even with double backslash:

    $ dash -c 'echo "\\1\\2"'  | hexdump -C
    00000000  01 02 0a                                          |...|

and even when the backslash is in a variable:

    $ dash -c 'bslash="\\"; echo "${bslash}z"; echo "${bslash}1"' | hexdump -C
    00000000  5c 7a 0a 01 0a                                    |\z...|

From the dash manpage, I understand that this should only apply when
there is a "0" after the backslash:
                    Output the character whose value is given by zero
                    to three octal digits.  If there are zero digits,
                    a nul character is output.

Does that also violate POSIX standards?

And even if this gets fixed in newer dash versions, it will probably not
be backported to existing Debian/Ubuntu distros.


Home | Main Index | Thread Index | Old Index