Re: .ONESHELL causes quoting in .SHELLFLAGS to not work as expected

2022-01-12 Thread Dmitry Goncharov
On Tue, Jan 11, 2022 at 3:53 PM Britton Kerin  wrote:
>
> $ cat Makefile
> .ONESHELL:
> SHELL = /usr/bin/perl
> .SHELLFLAGS = -w -E 'use warnings FATAL => "all";' -E
> all:
> print 'it works'
> $ make all
> print 'it works'
> Can't find string terminator "'" anywhere before EOF at -e line 1.
> make: *** [Makefile:5: all] Error 255
> $


Thank you for your report.
I opened https://savannah.gnu.org/bugs/index.php?61805 and attached a fix.

regards, Dmitry



[bug #61805] .ONESHELL causes quoting in .SHELLFLAGS to not work as expected.

2022-01-12 Thread Dmitry Goncharov
Follow-up Comment #2, bug #61805 (project make):

The patch in the attachment has a fix against the current master and a test.

(file #52654, file #52655)
___

Additional Item Attachment:

File name: sv61805_test.diff  Size:0 KB


File name: sv61805.diff   Size:1 KB




___

Reply to this item at:

  

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




[bug #61805] .ONESHELL causes quoting in .SHELLFLAGS to not work as expected.

2022-01-12 Thread Dmitry Goncharov
Follow-up Comment #1, bug #61805 (project make):

There is a dedicated piece of code in job.c for oneshell. This dedicated piece
of code tokenizes the contents of shellflags by white space.


___

Reply to this item at:

  

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




[bug #61805] .ONESHELL causes quoting in .SHELLFLAGS to not work as expected.

2022-01-12 Thread Dmitry Goncharov
URL:
  

 Summary: .ONESHELL causes quoting in .SHELLFLAGS to not work
as expected.
 Project: make
Submitted by: dgoncharov
Submitted on: Thu 13 Jan 2022 12:53:17 AM UTC
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: SCM
Operating System: None
   Fixed Release: None
   Triage Status: None

___

Details:

A user reported the following

.ONESHELL causes quoting in .SHELLFLAGS to not work as expected.

$ cat Makefile
.ONESHELL:
SHELL = /usr/bin/perl
.SHELLFLAGS = -w -E 'use warnings FATAL => "all";' -E
all:
print 'it works'
$ make all
print 'it works'
Can't find string terminator "'" anywhere before EOF at -e line 1.
make: *** [Makefile:5: all] Error 255
$

Without .ONESHELL: the above works as expected.

The original bug report is here
https://lists.gnu.org/archive/html/bug-make/2022-01/msg00024.html.




___

Reply to this item at:

  

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




Re: .SILENT: clobbered by .SILENT: with_target

2022-01-12 Thread Britton Kerin
On Wed, Jan 12, 2022 at 6:17 AM Dmitry Goncharov
 wrote:
>
> On Tue, Jan 11, 2022 at 3:50 PM Britton Kerin  wrote:
> > It looks like the .SILENT: with a recipe clobbers the .SILENT:
> > without
>
> Consider the following
>
> hello.tsk:
> hello.tsk: hello.h
> hello.tsk: hello.o; $(CC) -o $@ $<
>
>
> Here, hello.tsk is the default goal and it depends on hello.o and hello.h.
> Multiple rules can provide different prerequisites to the same target.
> The above is equivalent to
> hello.tsk: hello.o hello.h
> You can see that this example mimics your .silent example.
> Your makefile provided a prerequisite to .SILENT. Make then knows that
> .SILENT has a prerequisite.

I agree that it's consistent syntax, but semantically it's bad.  The
expectation and the manual both imply that .SILENT: will have a global
effect, and a  real union-of-effects would have .SILENT: meaning
everything and .SILENT: some_target redundant.  The root of the
problem is that the rule syntax has been recycled for an unrelated
purpose, especially so for directives without prerequisites.

Britton



Re: Segafult while running make(1) from /lib/init/rc with -j

2022-01-12 Thread Alejandro Colomar (man-pages)

Hi Paul,

On 1/8/22 21:43, Paul Smith wrote:

On Sat, 2022-01-08 at 21:37 +0100, Alejandro Colomar (man-pages) wrote:

Hi Dmitry,
On 1/7/22 17:48, Dmitry Goncharov wrote:

On Thu, Jan 6, 2022 at 2:13 PM Alejandro Colomar (man-pages)
 wrote:

I could try to write a simpler Makefile

That would be good. We need to be able to reproduce the crash.


I couldn't reproduce it with a simple Makefile with a few includes
and a few sleeps.

Would you mind if I send you the script with which I generated the
Makefiles, and you run it in a virtual machine?


If it's not possible to reproduce the crash outside of your environment
then better would be for you to build GNU make with debugging enabled:

   make CFLAGS=-g

then run it so it crashes, then investigate the generated core file
with a debugger (gdb) and generate a stack trace to see where things
are crashing.


Fair enough.  I first tried with normal make debugging info, to see if 
it helps.  I'll continue investigating this, but some news for you, in 
case you may suspect of anything.  The last lines I see in the terminal 
with `make -j2 -d ...` are:


... (many Reading makefile ... lines)
Reading makefile '/etc/rc.mk.d/x11-common.mk' (search path) (no ~ expansion)
Reaping losing child 0x55a30511f050 PID 174
make: *** [Makefile:31: 2] Segmentation fault
Removing child 0x55a30511f050 PID 174 from chain.


Line 31 in the Makefile (and its context) is:


30  2:
31  $(MAKE) 2kall
32  $(MAKE) 2k
33  $(MAKE) 2s
34  $(MAKE) 2sall


So it seems that it fails exactly after reading included makefiles, and 
before running the first task.



Thanks,

Alex





--
Alejandro Colomar
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



Re: .SILENT: clobbered by .SILENT: with_target

2022-01-12 Thread Dmitry Goncharov
On Tue, Jan 11, 2022 at 3:50 PM Britton Kerin  wrote:
> It looks like the .SILENT: with a recipe clobbers the .SILENT:
> without

Consider the following

hello.tsk:
hello.tsk: hello.h
hello.tsk: hello.o; $(CC) -o $@ $<


Here, hello.tsk is the default goal and it depends on hello.o and hello.h.
Multiple rules can provide different prerequisites to the same target.
The above is equivalent to
hello.tsk: hello.o hello.h
You can see that this example mimics your .silent example.
Your makefile provided a prerequisite to .SILENT. Make then knows that
.SILENT has a prerequisite.

regards, Dmitry