Bug 200663 - sed 'y': escape sequences in replacement text behave differently in different locales.
Summary: sed 'y': escape sequences in replacement text behave differently in different...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: sed
Version: 3.0
Hardware: i686
OS: Linux
medium
low
Target Milestone: ---
Assignee: Petr Machata
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-30 08:26 UTC by giuseppe bonacci
Modified: 2015-05-05 01:32 UTC (History)
2 users (show)

Fixed In Version: RHBA-2007-0472
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-06-11 18:37:10 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 187574 0 medium CLOSED rhel3: sed y command will not accept the newline escape sequence 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2007:0472 0 normal SHIPPED_LIVE sed bug fix update 2007-06-07 19:57:44 UTC

Description giuseppe bonacci 2006-07-30 08:26:19 UTC
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 08:27:46 UTC
please see https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=187574#c9

Comment 2 Petr Machata 2006-08-01 14:48:56 UTC
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 08:20:10 UTC
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 08:48:30 UTC
Yes, probably.

Comment 5 Jos Vos 2006-08-29 10:44:02 UTC
How could that RPM (in RHEL3 U8) be built correctly at RH?

Comment 6 giuseppe bonacci 2006-08-29 11:01:19 UTC
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 17:42:06 UTC
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 11:57:54 UTC
Yeah, the patch is meant to be replacement of current 'y' patch.

Comment 10 Frank Ch. Eigler 2007-03-08 12:31:51 UTC
Petr says patch is in hand.


Comment 16 Red Hat Bugzilla 2007-06-11 18:37:10 UTC
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.