Follow-up Comment #9, bug #40226 (project make):
Eli, it looks like the problem is triggered as soon
as you have some output generated during the
`read_all_makefiles ()` phase, as it causes a call
to `prepare_mutex_handle_string ()`.
And after reading the Makefiles, `main ()` calls
`decode_env_switches ("MAKEFLAGS")` which in turn
calls `decode_switches ()` and the added flag
`--sync-mutex=0x44` is now present.
So in my example at the top of comment #3, the trigger
was the `perror_with_name ()` call for the missing
no-Makefile file.
The problem indeed doesn't happen with simple
Makefiles where make doesn't generate any output
while reading the Makefiles.
Examples:
$ cat Makefile.bug
$(info Hello)
all:
@echo All done
$ WinDebug/make.exe -f Makefile.bug -Otarget
Hello
make: *** internal error: multiple --sync-mutex options. Stop.
$ cat Makefile.ok
all:
$(info Hello)
@echo All done
$ WinDebug/make.exe -f Makefile.ok -Otarget
Hello
All done
Of course, you have to be "lucky" and have that particular
memory layout I described in comment #3, i.e. the initial
xstrdup in `prepare_mutex_handle_string ()` must allocate
the "0x44" string just after the list itself. Otherwise
the memory overwrite that happens in `decode_switches ()`
is likely to remain asymptomatic. For example, when I launch
make from the debugger, the allocation pattern is different
and all seems fine, I could only figure this out by
attaching the debugger to the process...
Also, I just noticed that the problem is only reproducible
with 64-bits builds. I figure it might be difficult to
reproduce with other builds of make (msys, cygwin).
So the bug is likely to remain unnoticed most of the time,
which doesn't mean it's not there ;-)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40226>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-make mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-make