GNU bug report logs -
#32703
echo_man_error
Previous Next
Reported by: "1064240043" <szq1064240043 <at> qq.com>
Date: Tue, 11 Sep 2018 15:19:02 UTC
Severity: normal
Tags: moreinfo
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 11/09/18 11:07, Eric Blake wrote:
> On 9/11/18 11:01 AM, Eric Blake wrote:
>
>> $ POSIXLY_CORRECT=1 /bin/echo a\\nb
>> a\nb
>>
>> Yikes! Even though we asked for POSIX correctness, we are NOT
>> interpreting backslashes. I think this is a bug in GNU coreutils' echo,
>> and could be fixed by the patch below (but the testsuite would also need
>> updates).
>
> And it might even be a regression. Reading through NEWS, I found this
> back in 5.3.0:
>
> echo now conforms to POSIX better. It supports the \0ooo syntax for
> octal escapes, and \c now terminates printing immediately. If
> POSIXLY_CORRECT is set and the first argument is not "-n", echo now
> outputs all option-like arguments instead of treating them as options.
>
> although I haven't actually tested prior versions to see if behavior has
> changed over time.
I agree that we shouldn't be divergent here.
POSIXLY_CORRECT should enable interpretation of escapes.
I don't think it's a regression though.
From a quick review, default interpretation of escapes
was only controllable at compile time, until -e allowed
interpretation as of commit b7bfc2d2 (textutils-1.22).
Author: Jim Meyering <jim <at> meyering.net>
Date: Thu Sep 25 12:58:50 1997 +0000
Make echo conform to POSIX. By default, don't
interpret backslash escape sequences.
POSIX may have changed in the meantime, but POSIXLY_CORRECT
was never used as a condition for enabling interpretation of escapes.
cheers,
Pádraig
This bug report was last modified 6 years and 266 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.