Red Hat Bugzilla – Bug 200663
sed 'y': escape sequences in replacement text behave differently in different locales.
Last modified: 2015-05-04 21:32:33 EDT
Description of problem:
sed 'y': escape sequences in replacement text behave differently in different
Version-Release number of selected component (if applicable):
# echo aka | env LANG=en_US.UTF-8 sed 'y,k,\t,'
# echo aka | env LANG=en_US sed 'y,k,\t,'
# echo aka | env LANG=C sed 'y,k,\t,'
please see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=187574#c9
Created attachment 133402 [details]
fixed y command patch
My bad, I confused C locale with POSIXLY_CORRECT env variable. The problem was
different: I fogot to expand escape sequences in singlebyte modes when creating
patch. With UTF-8 being so prevalent on devel boxes, the mistake went
unnoticed. This updated patch fixes the problem.
In fact, the sed-4.0.7-8.EL3 does not rebuild on my system without tweaking,
because a test fails in the %check section:
> b xa
Test failed: sed doesn't handle escapes.
error: Bad exit status from /var/tmp/rpm-tmp.18907 (%check)
I guess that's due to the same problem?
How could that RPM (in RHEL3 U8) be built correctly at RH?
the problem only shows in single-byte-charset locales, like e.g. C, POSIX, or
en_US.ISO-8859-1. I guess most of RH building hosts run a en_US.UTF-8 default
locale, so the package builds smoothly.
env LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 rpmbuild ...
of course, sed's behaviour will stay broken until you apply Petr's patch.
I'm also using a default en_US.UTF-8 locale, but then only LANG is set, LC_ALL
is empty. When setting LC_ALL too, it indeed builds.
It also builds with Petr's patch, but I had to remove one chunk (that was
already in the code).
Yeah, the patch is meant to be replacement of current 'y' patch.
Petr says patch is in hand.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.