bug-grep
[Top][All Lists]
Advanced

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

bug#18987: the bourne shell printf-vs-\xHH portability trap


From: Norihiro Tanaka
Subject: bug#18987: the bourne shell printf-vs-\xHH portability trap
Date: Sat, 08 Nov 2014 07:30:09 +0900

Jim Meyering <address@hidden> wrote:

> I ran grep's tests on a debian system this morning and was
> surprised to see the word-multibyte test fail...
> Until I realized it was because that system was configured
> to use dash for /bin/sh, and this test relied on the unportable
> printf '\xc3\xa1\n' to print an a (A-grave).  Using \xHH
> hexadecimal constants works with bash and zsh, but that
> is not portable, and dash's printf built-in emits the 9 bytes
> rather than the expected three.
> 
> This isn't the first time this has happened, so I'll be writing
> a syntax-check rule to help avoid another repeat.
> 
> Here's how I've fixed it:

Thanks, but it seem that it is also unportable.  On Solaris 10 and AIX 7,
below.  Need Gawk for tests?

$ awk 'BEGIN { printf "\x41" }' </dev/null
\x41

BTW, On Solaris 10, AIX 7, HP-UX 11.23, below.

$ /usr/bin/printf '\x41'
\x41






reply via email to

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