bin/56147: FreeBSD/NetBSD /bin/sh mishandles positional
parameters in "case"
Robert Drehmel
robert at zoot.drehmel.com
Wed Sep 17 07:20:07 PDT 2003
The following reply was made to PR bin/56147; it has been noted by GNATS.
From: Robert Drehmel <robert at zoot.drehmel.com>
To: freebsd-gnats-submit at FreeBSD.org, prj at po.cwru.edu
Cc:
Subject: Re: bin/56147: FreeBSD/NetBSD /bin/sh mishandles positional parameters in "case"
Date: Wed, 17 Sep 2003 16:01:27 +0200
Hello.
Does the attached patch fix your problem?
(patch against -CURRENT's version)
ciao,
-robert
Index: expand.c
===================================================================
RCS file: /home/ncvs/src/bin/sh/expand.c,v
retrieving revision 1.45
diff -u -r1.45 expand.c
--- expand.c 3 Aug 2003 04:28:10 -0000 1.45
+++ expand.c 17 Sep 2003 13:06:19 -0000
@@ -637,7 +637,7 @@
int easy;
int quotes = flag & (EXP_FULL | EXP_CASE | EXP_REDIR);
- varflags = *p++;
+ varflags = (unsigned char)*p++;
subtype = varflags & VSTYPE;
var = p;
special = 0;
@@ -673,7 +673,8 @@
if (set && subtype != VSPLUS) {
/* insert the value of the variable */
if (special) {
- varvalue(var, varflags & VSQUOTE, flag & EXP_FULL);
+ varvalue(var, varflags & VSQUOTE,
+ flag & (EXP_FULL | EXP_CASE));
if (subtype == VSLENGTH) {
varlen = expdest - stackblock() - startloc;
STADJUST(-varlen, expdest);
More information about the freebsd-bugs
mailing list