#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 03/09/18 at 17:00:08.
Patch to use printf instead of echo -e

Download all attachments as: .zip

Change History (3)

Changed on 03/09/18 at 17:00:08 by Amaan Cheval

Patch to use printf instead of echo -e

comment:1 Changed on 03/09/18 at 19:10:16 by Joel Sherrill

Description: modified (diff)

comment:2 Changed on 03/09/18 at 19:26:18 by Joel Sherrill

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