GNU bug report logs - #18987
the bourne shell printf-vs-\xHH portability trap

Previous Next

Package: grep;

Reported by: Jim Meyering <jim <at> meyering.net>

Date: Fri, 7 Nov 2014 17:15:03 UTC

Severity: normal

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Meyering <jim <at> meyering.net>
Subject: bug#18987: closed (Re: bug#18987: the bourne shell printf-vs-\xHH
 portability trap)
Date: Fri, 07 Nov 2014 20:14:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

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

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 18987 <at> debbugs.gnu.org.

-- 
18987: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18987
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jim Meyering <jim <at> meyering.net>
To: 18987-done <at> debbugs.gnu.org
Subject: Re: bug#18987: the bourne shell printf-vs-\xHH portability trap
Date: Fri, 7 Nov 2014 12:12:55 -0800
I've pushed these, and will make a new snapshot soon.
Holler if there's anything else you think should be included.

[Message part 3 (message/rfc822, inline)]
From: Jim Meyering <jim <at> meyering.net>
To: bug-grep <at> gnu.org
Subject: the bourne shell printf-vs-\xHH portability trap
Date: Fri, 7 Nov 2014 11:14:21 -0600
[Message part 4 (text/plain, inline)]
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-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:
[0001-maint-move-helper-function-hex_printf-to-init.cfg.patch (application/octet-stream, attachment)]
[0002-tests-avoid-printf-xHH-portability-trap.patch (application/octet-stream, attachment)]

This bug report was last modified 10 years and 198 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.