[bug #35397] make bug with ONESHELL and SHELLFLAGS

2012-03-03 Thread Paul D. Smith
Update of bug #35397 (project make):

  Status:None = Fixed  
 Assigned to:None = psmith 
 Open/Closed:Open = Closed 
   Fixed Release:None = CVS

___

Follow-up Comment #1:

I fixed this although I implemented it differently (using make's
find_next_token() function rather than strtok()).  Also added a test to the
regression suite.

___

Reply to this item at:

  http://savannah.gnu.org/bugs/?35397

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


[bug #35397] make bug with ONESHELL and SHELLFLAGS

2012-01-29 Thread David Boyce
URL:
  http://savannah.gnu.org/bugs/?35397

 Summary: make bug with ONESHELL and SHELLFLAGS
 Project: make
Submitted by: boyski
Submitted on: Sun 29 Jan 2012 08:22:36 PM GMT
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
 Discussion Lock: Any
   Component Version: 3.82
Operating System: Any
   Fixed Release: None
   Triage Status: None

___

Details:

In a thread from the bug-make mailing list
(http://lists.gnu.org/archive/html/bug-make/2011-12/msg00039.html) a bug was
reported and the following patch was provided and reported to work fine. I 'm
filing this report to ensure the issue gets proper review and disposition
before the upcoming release.

The original report said:

SHELL = /bin/bash
.SHELLFLAGS = -e –o pipefail -c
 
Works
 
.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS = -e –o pipefail –c
 
Doesn’t.

When the ONESHELL target is set .SHELLFLAGS must be set to a single value,
i.e. –ec.



Index: job.c
===
RCS file: /sources/make/make/job.c,v
retrieving revision 1.215
diff -u -r1.215 job.c
--- job.c   15 Nov 2011 21:12:54 -  1.215
+++ job.c   22 Dec 2011 21:31:48 -
@@ -2960,12 +2960,21 @@
 *t = '\0';
   }

-   new_argv = xmalloc (4 * sizeof (char *));
-   new_argv[0] = xstrdup(shell);
-   new_argv[1] = xstrdup(shellflags ? shellflags : );
-   new_argv[2] = line;
-   new_argv[3] = NULL;
-   return new_argv;
+   {
+ char *sfcopy;
+ char *sftok;
+ int n = 0;
+
+ sfcopy = xstrdup(shellflags ? shellflags : );
+ new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
+ new_argv[n++] = xstrdup(shell);
+ for (sftok = strtok(sfcopy,  ); sftok; sftok = strtok(NULL,  ))
+   new_argv[n++] = xstrdup(sftok);
+ new_argv[n++] = line;
+ new_argv[n] = NULL;
+ free(sfcopy);
+ return new_argv;
+   }
   }

 new_line = alloca ((shell_len*2) + 1 + sflags_len + 1




___

Reply to this item at:

  http://savannah.gnu.org/bugs/?35397

___
  Message sent via/by Savannah
  http://savannah.gnu.org/


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


make bug with ONESHELL and SHELLFLAGS

2011-12-22 Thread michael_rytting
Sorry if this has already been reported but I haven't found anything searching 
through the archives.

SHELL = /bin/bash
.SHELLFLAGS = -e -o pipefail -c

Works

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS = -e -o pipefail -c

Doesn't

When the ONESHELL target is set .SHELLFLAGS must be set to a single value, i.e. 
-ec.

I am using

Michael Rytting
Agilent Technologies
michael_rytt...@agilent.commailto:michael_rytt...@agilent.com
719-590-3708

___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: make bug with ONESHELL and SHELLFLAGS

2011-12-22 Thread David Boyce
I believe the patch below would fix this. It's up to Paul of course
whether he considers it a bug and considers the patch worthy. The only
concern I have with it is that there may be places where the argv is
assumed to be exactly 4 slots wide (shell, flags, recipe, null) and
only the first 3 slots are freed, but I couldn't find any. Also this
over-allocates new_argv a bit in the cause of simplicity.

-David Boyce

Index: job.c
===
RCS file: /sources/make/make/job.c,v
retrieving revision 1.215
diff -u -r1.215 job.c
--- job.c   15 Nov 2011 21:12:54 -  1.215
+++ job.c   22 Dec 2011 21:31:48 -
@@ -2960,12 +2960,21 @@
 *t = '\0';
   }

-   new_argv = xmalloc (4 * sizeof (char *));
-   new_argv[0] = xstrdup(shell);
-   new_argv[1] = xstrdup(shellflags ? shellflags : );
-   new_argv[2] = line;
-   new_argv[3] = NULL;
-   return new_argv;
+   {
+ char *sfcopy;
+ char *sftok;
+ int n = 0;
+
+ sfcopy = xstrdup(shellflags ? shellflags : );
+ new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
+ new_argv[n++] = xstrdup(shell);
+ for (sftok = strtok(sfcopy,  ); sftok; sftok = strtok(NULL,  ))
+   new_argv[n++] = xstrdup(sftok);
+ new_argv[n++] = line;
+ new_argv[n] = NULL;
+ free(sfcopy);
+ return new_argv;
+   }
   }

 new_line = alloca ((shell_len*2) + 1 + sflags_len + 1

On Thu, Dec 22, 2011 at 12:30 PM,  michael_rytt...@agilent.com wrote:
 Sorry if this has already been reported but I haven’t found anything
 searching through the archives.



 SHELL = /bin/bash

 .SHELLFLAGS = -e –o pipefail -c



 Works



 .ONESHELL:

 SHELL = /bin/bash

 .SHELLFLAGS = -e –o pipefail –c



 Doesn’t



 When the ONESHELL target is set .SHELLFLAGS must be set to a single value,
 i.e. –ec.



 I am using



 Michael Rytting

 Agilent Technologies

 michael_rytt...@agilent.com

 719-590-3708




 ___
 Bug-make mailing list
 Bug-make@gnu.org
 https://lists.gnu.org/mailman/listinfo/bug-make


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


RE: make bug with ONESHELL and SHELLFLAGS

2011-12-22 Thread michael_rytting
Since I build make myself I went ahead and applied this patch and it works 
great.  I'll let you guys decide if this should go into the official release, 
but we are happy.

-Mike

-Original Message-
From: David Boyce [mailto:david.s.bo...@gmail.com] 
Sent: Thursday, December 22, 2011 2:43 PM
To: RYTTING,MICHAEL (A-ColSprings,ex1)
Cc: bug-make@gnu.org
Subject: Re: make bug with ONESHELL and SHELLFLAGS

I believe the patch below would fix this. It's up to Paul of course whether he 
considers it a bug and considers the patch worthy. The only concern I have with 
it is that there may be places where the argv is assumed to be exactly 4 slots 
wide (shell, flags, recipe, null) and only the first 3 slots are freed, but I 
couldn't find any. Also this over-allocates new_argv a bit in the cause of 
simplicity.

-David Boyce

Index: job.c
===
RCS file: /sources/make/make/job.c,v
retrieving revision 1.215
diff -u -r1.215 job.c
--- job.c   15 Nov 2011 21:12:54 -  1.215
+++ job.c   22 Dec 2011 21:31:48 -
@@ -2960,12 +2960,21 @@
 *t = '\0';
   }

-   new_argv = xmalloc (4 * sizeof (char *));
-   new_argv[0] = xstrdup(shell);
-   new_argv[1] = xstrdup(shellflags ? shellflags : );
-   new_argv[2] = line;
-   new_argv[3] = NULL;
-   return new_argv;
+   {
+ char *sfcopy;
+ char *sftok;
+ int n = 0;
+
+ sfcopy = xstrdup(shellflags ? shellflags : );
+ new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
+ new_argv[n++] = xstrdup(shell);
+ for (sftok = strtok(sfcopy,  ); sftok; sftok = strtok(NULL,  ))
+   new_argv[n++] = xstrdup(sftok);
+ new_argv[n++] = line;
+ new_argv[n] = NULL;
+ free(sfcopy);
+ return new_argv;
+   }
   }

 new_line = alloca ((shell_len*2) + 1 + sflags_len + 1

On Thu, Dec 22, 2011 at 12:30 PM,  michael_rytt...@agilent.com wrote:
 Sorry if this has already been reported but I haven't found anything 
 searching through the archives.



 SHELL = /bin/bash

 .SHELLFLAGS = -e -o pipefail -c



 Works



 .ONESHELL:

 SHELL = /bin/bash

 .SHELLFLAGS = -e -o pipefail -c



 Doesn't



 When the ONESHELL target is set .SHELLFLAGS must be set to a single 
 value, i.e. -ec.



 I am using



 Michael Rytting

 Agilent Technologies

 michael_rytt...@agilent.com

 719-590-3708




 ___
 Bug-make mailing list
 Bug-make@gnu.org
 https://lists.gnu.org/mailman/listinfo/bug-make


___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make