Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Jan 2003 18:42:54 GMT
From:      Tor.Egge@cvsup.no.freebsd.org
To:        roam@ringlet.net
Cc:        freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/45349: /bin/sh and 8-bit characters
Message-ID:  <20030107184254E.tegge@cvsup.no.freebsd.org>
In-Reply-To: <200301071220.h07CK3qv089807@freefall.freebsd.org>
References:  <200301071220.h07CK3qv089807@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>  So it seems it is still not quite OK on -STABLE.

With a minor tweak to the test program, the problem is still 
reproducable on 5.0-CURRENT.

--- /tmp/shtest.pl	Tue Jan  7 15:44:19 2003
+++ /tmp/shtest2.pl	Tue Jan  7 19:31:05 2003
@@ -6,3 +6,3 @@
    $c = chr($x);
-   system("echo blah > \"./$c\"");   # calls /bin/sh
+   system("A=\"$c\"; echo blah > \"./\$A\"");   # calls /bin/sh
    unless (-e $c) {


Revision 1.39 of expand.c changes the initialization of the local
variable "quotes" in argstr() but doesn't update similar code in
exptilde(), expari(), expbackq() and evalvar().

Index: expand.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/expand.c,v
retrieving revision 1.40
diff -u -r1.40 expand.c
--- expand.c	26 Dec 2002 14:28:54 -0000	1.40
+++ expand.c	7 Jan 2003 15:33:29 -0000
@@ -278,7 +278,7 @@
 	char c, *startp = p;
 	struct passwd *pw;
 	char *home;
-	int quotes = flag & (EXP_FULL | EXP_CASE);
+	int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
 
 	while ((c = *p) != '\0') {
 		switch(c) {
@@ -369,7 +369,7 @@
 	char *p, *start;
 	int result;
 	int begoff;
-	int quotes = flag & (EXP_FULL | EXP_CASE);
+	int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
 	int quoted;
 
 
@@ -436,7 +436,7 @@
 	int startloc = dest - stackblock();
 	char const *syntax = quoted? DQSYNTAX : BASESYNTAX;
 	int saveherefd;
-	int quotes = flag & (EXP_FULL | EXP_CASE);
+	int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
 
 	INTOFF;
 	saveifs = ifsfirst;
@@ -635,7 +635,7 @@
 	int startloc;
 	int varlen;
 	int easy;
-	int quotes = flag & (EXP_FULL | EXP_CASE);
+	int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
 
 	varflags = *p++;
 	subtype = varflags & VSTYPE;


- Tor Egge

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030107184254E.tegge>