Follow-up Comment #1, bug #66037 (group make):

Make enters an infinite loop when some option and MAKEFLAGS=<value> are
specified on the command line.

Sometimes rather than entering an infinite loop, make exits with an error
message, because internal state of getopt is messed up.
Here is an example of a bogus error message.


$ make -r MAKEFLAGS=-k
/home/dgoncharov/src/gmake/make/m64/make: invalid option -- ''
Usage: make [options] [target] ...
Options:
...


Here is an example of the infinite loop.

$ time make -r MAKEFLAGS=hello=world
^C

real    0m8.461s
user    0m7.387s
sys     0m1.074s


As soon as make begins to process argv the following (simplified) sequence of
calls takes place.
decode_switches calls handle_non_switch_argument to process
MAKEFLAGS=<value>.
handle_non_switch_argument calls decode_switches through
try_variable_definition, set_special_var, reset_makeflags.  This recursive
call to decode_switches calls getopt and messes up state (optind, nextchar,
etc) of the outer call to getopt.

The makefile can be anything, make does not get to read it.

The patch in the attachment calls handle_non_switch_argument after getopt is
done.



    _______________________________________________________

Reply to this item at:

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

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

Attachment: signature.asc
Description: PGP signature

Reply via email to