[bug #28092] $(shell false) should break build

2015-07-12 Thread Paul D. Smith
Update of bug #28092 (project make):

  Status:None => Fixed  
 Assigned to:None => psmith 
 Open/Closed:Open => Closed 
   Fixed Release:None => SCM

___

Follow-up Comment #7:

I'm not willing to add the suggested -e option or a new function.  I did add
(in Git now) a new variable .SHELLSTATUS which is set to the exit code from
the most recent shell function, so you can test it to see if there was an
error and do whatever you like.


VAR := $(shell somecommand)
ifneq ($(.SHELLSTATUS),0)
  $(error somecommand failed)
endif



___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-26 Thread Stepan Koltsov

Follow-up Comment #6, bug #28092 (project make):

Timothy, you've proven that you can work around make limitations.

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-26 Thread Timothy N Murphy

Follow-up Comment #5, bug #28092 (project make):

Hi,  

Ok, Mk2 then:

a:=$(shell echo "don't mess up this output"; echo  " $$?")

code:=$(lastword $(a))
output:=$(strip $(patsubst %$(code),%,$(a)))
$(info exit code='$(code)')
$(info output='$(output)')

[tnmur...@4gbl06592 ~]$ make -f t4.mk
exit code='0'
output='don't mess up this output'
make: *** No targets.  Stop.

I think that the $(strip) is a bit of a cheat but it's pretty close to what
should be done.  This could probably be done completely properly with another
patsubst.


___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-26 Thread Stepan Koltsov

Follow-up Comment #4, bug #28092 (project make):

Timothy, echo $$? mixes up command output and exit code in single variable,
it is not acceptable.

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-26 Thread Timothy N Murphy

Follow-up Comment #3, bug #28092 (project make):

To get the exit code: 


a:=$(shell cat fred.txt; echo $$?)
$(info exit=$(a))

make -f t.mk 
cat: fred.txt: No such file or directory
exit=1


___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-25 Thread Stepan Koltsov

Follow-up Comment #2, bug #28092 (project make):

Alternative requests then:

1. Add -e modifier to $(shell)

$(shell -e cat version.txt)

could break build. It mimics -e switch of /bin/sh. This shouldn't be a
problem since there is no "-e" command.

2. Add another "shelle" command:

$(shelle cat version.txt)




___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-25 Thread Paul D. Smith

Update of bug #28092 (project make):

  Item Group:None => Enhancement

___

Follow-up Comment #1:

There's no way $(shell ...) failing can or should cause make to stop.  There
are many legitimate reasons why the shell exiting with an error should not
cause make to fail, and adding this would be an enormous
backward-compatibility break.

For your situation, you can just check to see whether the result of the
variable was valid; this will also catch the situation where there's an empty
file as well as a non-existent one:

a := $(shell cat version.txt)
ifeq (,$(a))
$(error version.txt does not contain a valid version)
endif


I agree it might be useful to find out the exit code of the last $(shell ...)
function invocation, so I'm leaving this open as an enhancement request to
create a variable containing the exit code of the last $(shell ...)
invocation.

___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make


[bug #28092] $(shell false) should break build

2009-11-25 Thread Stepan Koltsov

URL:
  

 Summary: $(shell false) should break build
 Project: make
Submitted by: yozh
Submitted on: Wed 25 Nov 2009 06:06:02 PM GMT
Severity: 3 - Normal
  Item Group: None
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 3.81
Operating System: None
   Fixed Release: None
   Triage Status: None

___

Details:

Currently,

$(shell false) does not break build:

===
a := $(shell false)

x:
echo $(a)
===

completes successfully. Should fail, because in scenario:

a := $(shell cat version.txt)

it is hard to catch a situation if version.txt file does not exist.

Seen on gmake 3.81.




___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make