[bug #62145] Unlink the stdin temporary file on failure to re-execute.

2022-03-06 Thread Dmitry Goncharov
URL:
  

 Summary: Unlink the stdin temporary file on failure to
re-execute.
 Project: make
Submitted by: dgoncharov
Submitted on: Sun 06 Mar 2022 07:36:16 PM 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: POSIX-Based
   Fixed Release: None
   Triage Status: None

___

Details:

Make creates a temporary file to store the make code read from stdin.
If make needs to re-execute itself and this attempt to re-execute fails, make
neglects to unlink the temporary file.


$ cat makefile
def:; $(info hello world)
$(MAKE_RESTARTS)makefile: force; touch $@ && chmod -x $(MAKE)
force::
$ echo 'all: $(info hello)' | ./make -Rd -f makefile -f- 
GNU Make 4.3.90
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'makefile'...
Reading makefile '/tmp/GmjNbYoy'...
hello
Updating makefiles
 Considering target file 'makefile'.
   Considering target file 'force'.
File 'force' does not exist.
Looking for an implicit rule for 'force'.
No implicit rule found for 'force'.
Finished prerequisites of target file 'force'.
   Target 'force' is double-colon and has no prerequisites.
   Must remake target 'force'.
   Successfully remade target file 'force'.
  Finished prerequisites of target file 'makefile'.
  Prerequisite 'force' of target 'makefile' does not exist.
 Must remake target 'makefile'.
makefile:2: update target 'makefile' due to: force
touch makefile && chmod -x /tmp/test/./make
Putting child 0x55abdef52870 (makefile) PID 3695 on the chain.
Live child 0x55abdef52870 (makefile) PID 3695 
Reaping winning child 0x55abdef52870 PID 3695 
Removing child 0x55abdef52870 PID 3695 from chain.
 Successfully remade target file 'makefile'.
 Considering target file '/tmp/GmjNbYoy'.
 File '/tmp/GmjNbYoy' was considered already.
Re-executing[1]: /tmp/test/./make -Rd -f makefile --temp-stdin=/tmp/GmjNbYoy
make: /tmp/test/./make: Permission denied
$ ls /tmp/GmjNbYoy
/tmp/GmjNbYoy





___

Reply to this item at:

  

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




[bug #62145] Unlink the stdin temporary file on failure to re-execute.

2022-03-06 Thread Dmitry Goncharov
Additional Item Attachment, bug #62145 (project make):

File name: sv62145_test.diff  Size:4 KB


File name: sv62145_fix.diff   Size:2 KB




___

Reply to this item at:

  

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




Re: [bug #62118] Fix parsing of command line options -f, --file, --makefile.

2022-03-06 Thread Dmitry Goncharov
On Sun, Feb 27, 2022 at 6:11 PM Paul D. Smith  wrote:
>
> Update of bug #62118 (project make):
...
> When looking at the test results I noticed that we were leaving the temporary
> files behind if we had to re-exec, because the re-exec'd version of make
> didn't realize they were temporary.
>
> I decided to fix this, rather than apply the changes you provided.  However I
> preserved the tests you wrote.

i actually had a patch for this as well. Most of that patch no longer
matters, because you already fixed this. i opened
https://savannah.gnu.org/bugs/index.php?62145 to fix the remaining
scenario when make still fails to remote the file and attached a test.

regards, Dmitry