[Top][All Lists]

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

[bug #63667] In POSIX mode, the shell should not be run with -e if error

From: Vincent Lefèvre
Subject: [bug #63667] In POSIX mode, the shell should not be run with -e if errors are ignored
Date: Sat, 14 Jan 2023 20:47:10 -0500 (EST)


                 Summary: In POSIX mode, the shell should not be run with -e
if errors are ignored
                 Project: make
               Submitter: vinc17
               Submitted: dim. 15 janv. 2023 01:47:08
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: None
        Operating System: None
           Fixed Release: None
           Triage Status: None


Follow-up Comments:

Date: dim. 15 janv. 2023 01:47:08    By: Vincent Lefèvre <vinc17>
As said at https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55025#24 (about an
issue with Automake) by Nick Bowler, when ".POSIX:" is used, GNU Make does not
conform to POSIX when errors are ignored. This affects commands like

  @-false; echo hello

where "hello" is not output because the shell is run with -e (the following
applies at least to GNU Make 4.3 and the Git current repository), which is
incorrect. Indeed, job.c contains:

  if (shellflags == 0)
    shellflags = posix_pedantic ? "-ec" : "-c";

i.e. -e is always used in POSIX mode.

The POSIX standard[*] says:

"An execution line is built from the command line by removing any prefix
characters. Except as described under the at-sign prefix, the execution line
shall be written to the standard output, optionally preceded by a <tab>. The
execution line shall then be executed by a shell as if it were passed as the
argument to the system() interface, except that if errors are not being
ignored then the shell -e option shall also be in effect. If errors are being
ignored for the command (as a result of the -i option, a '-' command prefix,
or a .IGNORE special target), the shell -e option shall not be in effect. The
environment for the command being executed shall contain all of the variables
in the environment of make."

[*] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html

If I understand correctly, errors are ignored if child->noerror or
ignore_errors_flag is true. So, in this case, -e should not be used.


Reply to this item at:


Message posté via Savannah

reply via email to

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