GNU bug report logs - #22254
[PATCH] sed: do not elide an invalid byte in a substitution RHS

Previous Next

Package: sed;

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

Date: Mon, 28 Dec 2015 06:04:01 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22254 in the body.
You can then email your comments to 22254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-sed <at> gnu.org:
bug#22254; Package sed. (Mon, 28 Dec 2015 06:04:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Meyering <jim <at> meyering.net>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Mon, 28 Dec 2015 06:04:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: bug-sed <at> gnu.org
Subject: [PATCH] sed: do not elide an invalid byte in a substitution RHS
Date: Sun, 27 Dec 2015 22:02:24 -0800
[Message part 1 (text/plain, inline)]
Just after pushing the fix for that heap-clobbering bug,
http://debbugs.gnu.org/22127, I noticed there was another minor
problem: sed would silently elide any invalid byte specified in a
substitution replacement string.

Here's a patch that's not quite complete (no NEWS entry, and I haven't
yet tried to determine when it was introduced).
[0001-sed-do-not-elide-an-invalid-byte-in-a-substitution-R.patch (text/x-patch, attachment)]

Information forwarded to bug-sed <at> gnu.org:
bug#22254; Package sed. (Mon, 28 Dec 2015 06:25:01 GMT) Full text and rfc822 format available.

Message #8 received at 22254 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 22254 <at> debbugs.gnu.org
Subject: Re: bug#22254: [PATCH] sed: do not elide an invalid byte in a
 substitution RHS
Date: Sun, 27 Dec 2015 22:24:13 -0800
On Sun, Dec 27, 2015 at 10:02 PM, Jim Meyering <jim <at> meyering.net> wrote:
> Just after pushing the fix for that heap-clobbering bug,
> http://debbugs.gnu.org/22127, I noticed there was another minor
> problem: sed would silently elide any invalid byte specified in a
> substitution replacement string.
>
> Here's a patch that's not quite complete (no NEWS entry, and I haven't
> yet tried to determine when it was introduced).

This one has a checkered past. I keep a decent sampling of old
versions of sed around.
Running one of the two tests that would be affected shows how
treatment of an invalid byte in a multi-byte locale has differed over
the years:

$ for i in $(env ls -dv /p/p/sed-*); do printf '%-14s: ' $i; echo a
|LC_ALL=ja_JP $i/bin/sed 's/a/b\U\xb2c/'|od -tx1|head -1; done|sed
s/.....//
sed-1.18 : 0000000 62 55 78 62 32 63 0a
sed-2.05 : 0000000 62 55 78 62 32 63 0a
sed-3.01 : 0000000 62 55 78 62 32 63 0a
sed-3.02 : 0000000 62 55 78 62 32 63 0a
sed-4.0a : 0000000 62 00 43 0a
sed-4.0b : 0000000 62 00 43 0a
sed-4.0c : 0000000 62 00 43 0a
sed-4.0d : 0000000 62 00 43 0a
sed-4.0e : 0000000 62 00 43 0a
sed-4.0.6: 0000000 62 b2 43 0a
sed-4.0.7: 0000000 62 b2 43 0a
sed-4.0.8: 0000000 62 b2 43 0a
sed-4.0.9: 0000000 62 b2 43 0a
sed-4.1  : 0000000 62 00 43 0a
sed-4.1c : 0000000 62 00 43 0a
sed-4.1d : 0000000 62 00 43 0a
sed-4.1e : 0000000 62 00 43 0a
sed-4.1f : 0000000 62 00 43 0a
sed-4.1.1: 0000000 62 00 43 0a
sed-4.1.2: 0000000 62 00 43 0a
sed-4.1.3: 0000000 62 00 43 0a
sed-4.1.4: 0000000 62 00 43 0a
sed-4.1.5: 0000000 62 00 43 0a
sed-4.2  : 0000000 62 00 43 0a
sed-4.2.1: 0000000 62 00 43 0a
sed-4.2.2: 0000000 62 00 43 0a

Now, it does what 4.0.6..4.0.9 did.




Information forwarded to bug-sed <at> gnu.org:
bug#22254; Package sed. (Mon, 28 Dec 2015 06:44:01 GMT) Full text and rfc822 format available.

Message #11 received at 22254 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 22254 <at> debbugs.gnu.org
Subject: Re: bug#22254: [PATCH] sed: do not elide an invalid byte in a
 substitution RHS
Date: Sun, 27 Dec 2015 22:42:53 -0800
[Message part 1 (text/plain, inline)]
On Sun, Dec 27, 2015 at 10:24 PM, Jim Meyering <jim <at> meyering.net> wrote:
> On Sun, Dec 27, 2015 at 10:02 PM, Jim Meyering <jim <at> meyering.net> wrote:
>> Just after pushing the fix for that heap-clobbering bug,
>> http://debbugs.gnu.org/22127, I noticed there was another minor
>> problem: sed would silently elide any invalid byte specified in a
>> substitution replacement string.
>>
>> Here's a patch that's not quite complete (no NEWS entry, and I haven't
>> yet tried to determine when it was introduced).
>
> This one has a checkered past. I keep a decent sampling of old
> versions of sed around.
> Running one of the two tests that would be affected shows how
> treatment of an invalid byte in a multi-byte locale has differed over
> the years:
>
> $ for i in $(env ls -dv /p/p/sed-*); do printf '%-14s: ' $i; echo a
> |LC_ALL=ja_JP $i/bin/sed 's/a/b\U\xb2c/'|od -tx1|head -1; done|sed
> s/.....//
> sed-1.18 : 0000000 62 55 78 62 32 63 0a
> sed-2.05 : 0000000 62 55 78 62 32 63 0a
> sed-3.01 : 0000000 62 55 78 62 32 63 0a
> sed-3.02 : 0000000 62 55 78 62 32 63 0a
> sed-4.0a : 0000000 62 00 43 0a
> sed-4.0b : 0000000 62 00 43 0a
> sed-4.0c : 0000000 62 00 43 0a
> sed-4.0d : 0000000 62 00 43 0a
> sed-4.0e : 0000000 62 00 43 0a
> sed-4.0.6: 0000000 62 b2 43 0a
> sed-4.0.7: 0000000 62 b2 43 0a
> sed-4.0.8: 0000000 62 b2 43 0a
> sed-4.0.9: 0000000 62 b2 43 0a
> sed-4.1  : 0000000 62 00 43 0a
> sed-4.1c : 0000000 62 00 43 0a
> sed-4.1d : 0000000 62 00 43 0a
> sed-4.1e : 0000000 62 00 43 0a
> sed-4.1f : 0000000 62 00 43 0a
> sed-4.1.1: 0000000 62 00 43 0a
> sed-4.1.2: 0000000 62 00 43 0a
> sed-4.1.3: 0000000 62 00 43 0a
> sed-4.1.4: 0000000 62 00 43 0a
> sed-4.1.5: 0000000 62 00 43 0a
> sed-4.2  : 0000000 62 00 43 0a
> sed-4.2.1: 0000000 62 00 43 0a
> sed-4.2.2: 0000000 62 00 43 0a
>
> Now, it does what 4.0.6..4.0.9 did.

Here's a complete patch:
[0001-sed-do-not-elide-an-invalid-byte-in-a-substitution-R.patch (text/x-patch, attachment)]

Reply sent to Jim Meyering <jim <at> meyering.net>:
You have taken responsibility. (Tue, 29 Dec 2015 06:19:01 GMT) Full text and rfc822 format available.

Notification sent to Jim Meyering <jim <at> meyering.net>:
bug acknowledged by developer. (Tue, 29 Dec 2015 06:19:01 GMT) Full text and rfc822 format available.

Message #16 received at 22254-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: 22254-done <at> debbugs.gnu.org
Subject: Re: bug#22254: [PATCH] sed: do not elide an invalid byte in a
 substitution RHS
Date: Mon, 28 Dec 2015 22:18:22 -0800
On Sun, Dec 27, 2015 at 10:42 PM, Jim Meyering <jim <at> meyering.net> wrote:
> On Sun, Dec 27, 2015 at 10:24 PM, Jim Meyering <jim <at> meyering.net> wrote:
>> On Sun, Dec 27, 2015 at 10:02 PM, Jim Meyering <jim <at> meyering.net> wrote:
>>> Just after pushing the fix for that heap-clobbering bug,
>>> http://debbugs.gnu.org/22127, I noticed there was another minor
>>> problem: sed would silently elide any invalid byte specified in a
>>> substitution replacement string.
>>>
>>> Here's a patch that's not quite complete (no NEWS entry, and I haven't
>>> yet tried to determine when it was introduced).
>>
>> This one has a checkered past. I keep a decent sampling of old
>> versions of sed around.
>> Running one of the two tests that would be affected shows how
>> treatment of an invalid byte in a multi-byte locale has differed over
>> the years:
>>
>> $ for i in $(env ls -dv /p/p/sed-*); do printf '%-14s: ' $i; echo a
>> |LC_ALL=ja_JP $i/bin/sed 's/a/b\U\xb2c/'|od -tx1|head -1; done|sed
>> s/.....//
>> sed-1.18 : 0000000 62 55 78 62 32 63 0a
>> sed-2.05 : 0000000 62 55 78 62 32 63 0a
>> sed-3.01 : 0000000 62 55 78 62 32 63 0a
>> sed-3.02 : 0000000 62 55 78 62 32 63 0a
>> sed-4.0a : 0000000 62 00 43 0a
...
>> sed-4.0e : 0000000 62 00 43 0a
>> sed-4.0.6: 0000000 62 b2 43 0a
>> sed-4.0.7: 0000000 62 b2 43 0a
>> sed-4.0.8: 0000000 62 b2 43 0a
>> sed-4.0.9: 0000000 62 b2 43 0a
>> sed-4.1  : 0000000 62 00 43 0a
...
>> sed-4.2.2: 0000000 62 00 43 0a
>>
>> Now, it does what 4.0.6..4.0.9 did.
>
> Here's a complete patch:

Pushed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 26 Jan 2016 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 157 days ago.

Previous Next


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