Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Adjust metachar handling to previous behaviour:
details: https://anonhg.NetBSD.org/src/rev/1a24bed0e344
branches: trunk
changeset: 338949:1a24bed0e344
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Fri Jun 19 08:03:35 2015 +0000
description:
Adjust metachar handling to previous behaviour:
- space and tab are no shell metachars, remove them from generic
metachar function
- add space and tab as to-be-quoted characters for :Q modifier
- add = and : as characters that require command handling by the shell
diffstat:
usr.bin/make/compat.c | 12 ++++++++----
usr.bin/make/metachar.c | 9 +++++----
usr.bin/make/var.c | 10 +++++-----
3 files changed, 18 insertions(+), 13 deletions(-)
diffs (124 lines):
diff -r 4928b56095e4 -r 1a24bed0e344 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c Fri Jun 19 06:32:08 2015 +0000
+++ b/usr.bin/make/compat.c Fri Jun 19 08:03:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat.c,v 1.97 2015/06/17 17:43:23 christos Exp $ */
+/* $NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.97 2015/06/17 17:43:23 christos Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)compat.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: compat.c,v 1.97 2015/06/17 17:43:23 christos Exp $");
+__RCSID("$NetBSD: compat.c,v 1.98 2015/06/19 08:03:35 mlelstv Exp $");
#endif
#endif /* not lint */
#endif
@@ -274,9 +274,13 @@
* Search for meta characters in the command. If there are no meta
* characters, there's no need to execute a shell to execute the
* command.
+ *
+ * Additionally variable assignments and empty commands
+ * go to the shell. Therefore treat '=' and ':' like shell
+ * meta characters as documented in make(1).
*/
- useShell = hasmeta(cmd);
+ useShell = hasmeta(cmd) || strchr(cmd,'=') || strchr(cmd,':');
#endif
/*
diff -r 4928b56095e4 -r 1a24bed0e344 usr.bin/make/metachar.c
--- a/usr.bin/make/metachar.c Fri Jun 19 06:32:08 2015 +0000
+++ b/usr.bin/make/metachar.c Fri Jun 19 08:03:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: metachar.c,v 1.4 2015/06/18 19:49:08 christos Exp $ */
+/* $NetBSD: metachar.c,v 1.5 2015/06/19 08:03:35 mlelstv Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#endif
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: metachar.c,v 1.4 2015/06/18 19:49:08 christos Exp $");
+__RCSID("$NetBSD: metachar.c,v 1.5 2015/06/19 08:03:35 mlelstv Exp $");
#endif
#include "metachar.h"
@@ -55,13 +55,13 @@
// nul soh stx etx eot enq ack bel
1, 0, 0, 0, 0, 0, 0, 0,
// bs ht nl vt np cr so si
- 0, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0,
// dle dc1 dc2 dc3 dc4 nak syn etb
0, 0, 0, 0, 0, 0, 0, 0,
// can em sub esc fs gs rs us
0, 0, 0, 0, 0, 0, 0, 0,
// sp ! " # $ % & '
- 1, 1, 1, 1, 1, 0, 1, 1,
+ 0, 1, 1, 1, 1, 0, 1, 1,
// ( ) * + , - . /
1, 1, 1, 0, 0, 0, 0, 0,
// 0 1 2 3 4 5 6 7
@@ -85,3 +85,4 @@
// x y z { | } ~ del
0, 0, 0, 1, 1, 1, 1, 0,
};
+
diff -r 4928b56095e4 -r 1a24bed0e344 usr.bin/make/var.c
--- a/usr.bin/make/var.c Fri Jun 19 06:32:08 2015 +0000
+++ b/usr.bin/make/var.c Fri Jun 19 08:03:35 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.193 2015/06/17 17:43:23 christos Exp $ */
+/* $NetBSD: var.c,v 1.194 2015/06/19 08:03:35 mlelstv Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.193 2015/06/17 17:43:23 christos Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.194 2015/06/19 08:03:35 mlelstv Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.193 2015/06/17 17:43:23 christos Exp $");
+__RCSID("$NetBSD: var.c,v 1.194 2015/06/19 08:03:35 mlelstv Exp $");
#endif
#endif /* not lint */
#endif
@@ -2246,7 +2246,7 @@
/*-
*-----------------------------------------------------------------------
* VarQuote --
- * Quote shell meta-characters in the string
+ * Quote shell meta-characters and space characters in the string
*
* Results:
* The quoted string
@@ -2275,7 +2275,7 @@
Buf_AddBytes(&buf, nlen, newline);
continue;
}
- if (ismeta((unsigned char)*str))
+ if (*str == ' ' || *str == '\t' || ismeta((unsigned char)*str))
Buf_AddByte(&buf, '\\');
Buf_AddByte(&buf, *str);
}
Home |
Main Index |
Thread Index |
Old Index