bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incorrect handling of echo in POSIX mode


From: Chet Ramey
Subject: Re: Incorrect handling of echo in POSIX mode
Date: Fri, 15 Mar 2024 11:59:03 -0400
User-agent: Mozilla Thunderbird

On 3/15/24 11:37 AM, Clint Hepner wrote:

Bash Version: 5.2
Patch Level: 26
Release Status: release

Description:
     In POSIX mode, echo incorrectly processes -e as an option unless xpg_echo 
is also enabled.

It always has. I wasn't willing to sacrifice that much compatibility when
bash is run as sh. Bash doesn't claim strict posix conformance unless
xpg_echo is enabled. You can build a version where it's enabled by default.

     This is a regression from 3.2 (or possibly some 4.x versions, haven't 
tested), where --posix caused -e
     to be treated correctly, even if it also enabled backslash processing.

It is not.

$ cat x1
echo -e '\t--\n'
$ ../bash-2.05b-patched/bash --posix ./x1
        --

$ ../bash-3.0-patched/bash --posix ./x1
        --

$ ../bash-3.2-patched/bash --posix ./x1
        --

$ ../bash-4.0-patched/bash --posix ./x1
        --

$ ../bash-4.4-patched/bash --posix ./x1
        --

$ ../bash-5.0-patched/bash --posix ./x1
        --

$ ../bash-5.2-patched/bash --posix ./x1
        --



        ~ % /bin/bash --posix
        [macOS warning elided]
        bash-3.2$ echo -e foo\\nbar
        -e foo
        bar

Apple's version of bash-3.2 is not the sams as the distributed version of
bash-3.2. They made some changes for POSIX certification that I didn't
merge.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]