Bug 200663 - sed 'y': escape sequences in replacement text behave differently in different locales.
sed 'y': escape sequences in replacement text behave differently in different...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: sed (Show other bugs)
3.0
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Petr Machata
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-30 04:26 EDT by giuseppe bonacci
Modified: 2015-05-04 21:32 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2007-0472
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-06-11 14:37:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
fixed y command patch (2.71 KB, patch)
2006-08-01 10:48 EDT, Petr Machata
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 187574 None None None Never

  None (edit)
Description giuseppe bonacci 2006-07-30 04:26:19 EDT
Description of problem:

sed 'y': escape sequences in replacement text behave differently in different
locales.

Version-Release number of selected component (if applicable):
sed-4.0.7-8.EL3

How reproducible:
# echo aka | env LANG=en_US.UTF-8 sed 'y,k,\t,'
a       a
# echo aka | env LANG=en_US       sed 'y,k,\t,'
ata
# echo aka | env LANG=C           sed 'y,k,\t,'
ata
Comment 1 giuseppe bonacci 2006-07-30 04:27:46 EDT
please see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=187574#c9
Comment 2 Petr Machata 2006-08-01 10:48:56 EDT
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.
Comment 3 Jos Vos 2006-08-29 04:20:10 EDT
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:

1c1
< btxa
---
> 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?
Comment 4 Petr Machata 2006-08-29 04:48:30 EDT
Yes, probably.
Comment 5 Jos Vos 2006-08-29 06:44:02 EDT
How could that RPM (in RHEL3 U8) be built correctly at RH?
Comment 6 giuseppe bonacci 2006-08-29 07:01:19 EDT
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.  

try yourself:
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.
Comment 7 Jos Vos 2006-08-30 13:42:06 EDT
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).
Comment 8 Petr Machata 2006-08-31 07:57:54 EDT
Yeah, the patch is meant to be replacement of current 'y' patch.
Comment 10 Frank Ch. Eigler 2007-03-08 07:31:51 EST
Petr says patch is in hand.
Comment 16 Red Hat Bugzilla 2007-06-11 14:37:10 EDT
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.

http://rhn.redhat.com/errata/RHBA-2007-0472.html

Note You need to log in before you can comment on or make changes to this bug.