#3328 closed defect (fixed)

bootstrap uses non-POSIX compliant echo -e

Reported by: Amaan Cheval Owned by:
Priority: normal Milestone: 5.1
Component: build Version: 5
Severity: normal Keywords:
Cc: Joel Sherrill Blocked By:
Blocking:

Description (last modified by Joel Sherrill)

On certain shells, the "-e" option is not supported, and causes echo to output the flag along with the quoted text.

-> % sh
$ echo -e "foo bar"
-e foo bar
$

This varies by shell, and is not even consistent between sh or bash.

It was introduced while removing the make preinstall stage here, and may still work on most shells, though it didn't for me on sh on Ubuntu 16.04 LTS (4.4.0-78-generic x86_64 GNU/Linux) - as far as I can tell, this bug hasn't made it to any releases yet, so just fixing it on master should be enough.

A patch is attached.

Reference to the POSIX standard which confirms that -n is the only argument supported.

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html

Link to POSIX for printf(1):

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

Attachments (1)

0001-bootstrap-Use-printf-instead-of-echo-e-for-POSIX-she.patch (1.6 KB) - added by Amaan Cheval on Mar 9, 2018 at 5:00:08 PM.
Patch to use printf instead of echo -e

Download all attachments as: .zip

Change History (3)

Changed on Mar 9, 2018 at 5:00:08 PM by Amaan Cheval

Patch to use printf instead of echo -e

comment:1 Changed on Mar 9, 2018 at 7:10:16 PM by Joel Sherrill

Description: modified (diff)

comment:2 Changed on Mar 9, 2018 at 7:26:18 PM by Joel Sherrill

Milestone: 5.1
Resolution: fixed
Status: newclosed
Version: 5
Note: See TracTickets for help on using tickets.