Discussion:
[bug #51267] Improve error handling after a special command
Markus Elfring
2017-06-19 16:08:35 UTC
Permalink
URL:
<http://savannah.gnu.org/bugs/?51267>

Summary: Improve error handling after a special command
Project: make
Submitted by: elfring
Submitted on: Mon 19 Jun 2017 06:08:34 PM CEST
Severity: 3 - Normal
Item Group: Bug
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 4.2.1
Operating System: Any
Fixed Release: None
Triage Status: None

_______________________________________________________

Details:

I have noticed the following code fragment in a recipe which is mentioned in
the section “Generating prerequisites automatically” of the
documentation.
https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html#index-make-depend


$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \


The semicolon indicates at the end that the return value is ignored there. I
imagine that further data processing should usually only be performed if this
command succeeded.
Would you like to improve the exception handling for such a situation?




_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?51267>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Henrik Carlqvist
2017-06-19 17:45:23 UTC
Permalink
On Mon, 19 Jun 2017 12:08:35 -0400 (EDT)
Post by Markus Elfring
The semicolon indicates at the end that the return value is ignored
there. I imagine that further data processing should usually only be
performed if this command succeeded.
Would you like to improve the exception handling for such a situation?
If you really think that is a bug you should file that bug to the writers
of the shell. Make calls commands in a shell and the result is as in the
shell.

Try the following at your shell prompt:

true && echo everything is fine
echo $?
false && echo evertyhing is fine
echo $?
false ; echo everything is fine
echo $?

regards Henrik
Paul Smith
2017-06-19 17:51:03 UTC
Permalink
Post by Henrik Carlqvist
On Mon, 19 Jun 2017 12:08:35 -0400 (EDT)
Post by Markus Elfring
The semicolon indicates at the end that the return value is ignored
there. I imagine that further data processing should usually only
be performed if this command succeeded.
Would you like to improve the exception handling for such a
situation?
If you really think that is a bug you should file that bug to the
writers of the shell. Make calls commands in a shell and the result
is as in the shell.
I think Markus is suggesting that the example in the documentation be
improved to not have this problem regarding losing the return value.

That's probably a good idea, although this entire method of managing
automatically generated dependencies is essentially obsolete. Arguably this entire section should be rewritten from scratch to use more modern methods.
Paul D. Smith
2017-07-02 15:13:05 UTC
Permalink
Update of bug #51267 (project make):

Item Group: Bug => Documentation


_______________________________________________________

Reply to this item at:

<http://savannah.gnu.org/bugs/?51267>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
Paul D. Smith
2018-09-15 20:17:59 UTC
Permalink
Update of bug #51267 (project make):

Status: None => Not A Bug
Open/Closed: Open => Closed

_______________________________________________________

Follow-up Comment #1:

The very first line in the recipe command in that example is:


set -e; ...


This means that any command that fails in the recipe command immediately exits
that command with an error. There is no need to check every command
individually for errors.

_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?51267>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...