bugmake - Bugs: bug #61805, .ONESHELL causes quoting in...

 
 

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

Submitted by:  Dmitry Goncharov <dgoncharov>
Submitted on:  Thu 13 Jan 2022 12:53:17 AM UTC
 
Severity:  3 - Normal Item Group:  Bug
Status:  Fixed Privacy:  Public
Assigned to:  psmith Open/Closed:  Closed
Component Version:  SCM Operating System:  Any
Fixed Release:  SCM Triage Status:  Medium Effort
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Sun 06 Feb 2022 11:50:20 PM UTC, comment #5: 

I applied this but disabled the extra tests on Windows systems.

At some point we'll have to work on supporting non-standard SHELL values on Windows but that's a larger problem.

Paul D. Smith <psmith>
Project Administrator
Mon 24 Jan 2022 06:24:34 AM UTC, comment #4: 

Thanks Dmitry.

There's already a targets/ONESHELL (ONESHELL is a special target, not a variable) so I added your tests there, except for the first one (we definitely don't want to use echo -n as it's not portable at all; there are no portable arguments to the echo command) which I removed as there are already tests there that can substitute for it.

This is not working on Windows, however.  Windows has some problems because construct_command_argv_internal() assumes that any non-POSIX shell is cmd.exe and creates a cmd.exe batch file which of course does not work with Perl (or Python or whatever).

Really I cannot understand why the command line construction code is so incredibly complicated.  However, of course this new behavior doesn't work in previous versions of make either so it's not a regression.  I'm going to play with fixing this and if it doesn't seem simple enough I may just disable the new ONESHELL tests on Windows, for now.

Paul D. Smith <psmith>
Project Administrator
Thu 13 Jan 2022 11:13:27 PM UTC, comment #3: 

Here is a better version of the fix and more tests in sv61805_fix2.diff and sv61805_test2.diff.

(file #52664, file #52665)

Dmitry Goncharov <dgoncharov>
Thu 13 Jan 2022 01:08:41 AM UTC, comment #2: 

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

(file #52654, file #52655)

Dmitry Goncharov <dgoncharov>
Thu 13 Jan 2022 12:55:24 AM UTC, comment #1: 

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.

Dmitry Goncharov <dgoncharov>
Thu 13 Jan 2022 12:53:17 AM UTC, original submission:  

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.

Dmitry Goncharov <dgoncharov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #52664:  sv61805_test2.diff added by dgoncharov (2KiB - text/x-patch)
file #52665:  sv61805_fix2.diff added by dgoncharov (1KiB - text/x-patch)
file #52654:  sv61805_test.diff added by dgoncharov (925B - text/x-patch)
file #52655:  sv61805.diff added by dgoncharov (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by dgoncharov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

     

     

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-06 psmith StatusNone => Fixed
        Assigned toNone => psmith
        Open/ClosedOpen => Closed
        Operating SystemNone => Any
        Fixed ReleaseNone => SCM
        Triage StatusNone => Medium Effort
    2022-01-13 dgoncharov Attached File- => Added sv61805_test2.diff, #52664
        Attached File- => Added sv61805_fix2.diff, #52665
    2022-01-13 dgoncharov Attached File- => Added sv61805_test.diff, #52654
        Attached File- => Added sv61805.diff, #52655

    Back to the top


    Powered by Savane 3.9