mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-12-18 00:02:46 -05:00
Ensure that .ONESHELL works with .SHELLFLAGS options containing whitespace.
See Savannah bug #35397.
This commit is contained in:
parent
a77c5c0910
commit
405c89ba1e
@ -1,8 +1,11 @@
|
|||||||
2012-03-03 Paul Smith <psmith@gnu.org>
|
2012-03-03 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* job.c (construct_command_argv_internal): In oneshell we need to
|
||||||
|
break the SHELLFLAGS up for argv. Fixes Savannah bug #35397.
|
||||||
|
|
||||||
* function.c (func_filter_filterout): Recompute the length of each
|
* function.c (func_filter_filterout): Recompute the length of each
|
||||||
filter word in case it was compressed due to escape chars. Don't
|
filter word in case it was compressed due to escape chars. Don't
|
||||||
reset the string as it's freed. See Savannah bug #35410.
|
reset the string as it's freed. Fixes Savannah bug #35410.
|
||||||
|
|
||||||
* misc.c (collapse_continuations): Only use POSIX-style
|
* misc.c (collapse_continuations): Only use POSIX-style
|
||||||
backslash/newline handling if the .POSIX target is set.
|
backslash/newline handling if the .POSIX target is set.
|
||||||
|
|||||||
28
job.c
28
job.c
@ -2960,11 +2960,29 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
*t = '\0';
|
*t = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
new_argv = xmalloc (4 * sizeof (char *));
|
/* Create an argv list for the shell command line. */
|
||||||
new_argv[0] = xstrdup(shell);
|
{
|
||||||
new_argv[1] = xstrdup(shellflags ? shellflags : "");
|
int n = 0;
|
||||||
new_argv[2] = line;
|
|
||||||
new_argv[3] = NULL;
|
new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
|
||||||
|
new_argv[n++] = xstrdup (shell);
|
||||||
|
|
||||||
|
/* Chop up the shellflags (if any) and assign them. */
|
||||||
|
if (! shellflags)
|
||||||
|
new_argv[n++] = xstrdup ("");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char *s = shellflags;
|
||||||
|
char *t;
|
||||||
|
unsigned int len;
|
||||||
|
while ((t = find_next_token (&s, &len)) != 0)
|
||||||
|
new_argv[n++] = xstrndup (t, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the command to invoke. */
|
||||||
|
new_argv[n++] = line;
|
||||||
|
new_argv[n++] = NULL;
|
||||||
|
}
|
||||||
return new_argv;
|
return new_argv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,11 @@
|
|||||||
2012-03-03 Paul Smith <psmith@gnu.org>
|
2012-03-03 Paul Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* scripts/variables/SHELL: Ensure .SHELLFLAGS works with options
|
||||||
|
separated by whitespace.
|
||||||
|
|
||||||
|
* scripts/targets/ONESHELL: Try .ONESHELL in combination with
|
||||||
|
whitespace-separated options in .SHELLFLAGS. See Savannah bug #35397.
|
||||||
|
|
||||||
* scripts/functions/filter-out: Add filter tests and test escape
|
* scripts/functions/filter-out: Add filter tests and test escape
|
||||||
operations. See Savannah bug #35410.
|
operations. See Savannah bug #35410.
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,19 @@ all:
|
|||||||
[ 0"$a" -eq "$$" ] || echo fail
|
[ 0"$a" -eq "$$" ] || echo fail
|
||||||
');
|
');
|
||||||
|
|
||||||
|
# Simple but use multi-word SHELLFLAGS
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS = -e -c
|
||||||
|
all:
|
||||||
|
a=$$$$
|
||||||
|
[ 0"$$a" -eq "$$$$" ] || echo fail
|
||||||
|
!,
|
||||||
|
'', 'a=$$
|
||||||
|
[ 0"$a" -eq "$$" ] || echo fail
|
||||||
|
');
|
||||||
|
|
||||||
# Again, but this time with inner prefix chars
|
# Again, but this time with inner prefix chars
|
||||||
|
|
||||||
run_make_test(q!
|
run_make_test(q!
|
||||||
|
|||||||
@ -64,6 +64,14 @@ my $script = 'true; true';
|
|||||||
my $flags = '-xc';
|
my $flags = '-xc';
|
||||||
my $out = `/bin/sh $flags '$script' 2>&1`;
|
my $out = `/bin/sh $flags '$script' 2>&1`;
|
||||||
|
|
||||||
|
run_make_test(qq!
|
||||||
|
.SHELLFLAGS = $flags
|
||||||
|
all: ; \@$script
|
||||||
|
!,
|
||||||
|
'', $out);
|
||||||
|
|
||||||
|
# Do it again but add spaces to SHELLFLAGS
|
||||||
|
$flags = '-x -c';
|
||||||
run_make_test(qq!
|
run_make_test(qq!
|
||||||
.SHELLFLAGS = $flags
|
.SHELLFLAGS = $flags
|
||||||
all: ; \@$script
|
all: ; \@$script
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user