Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2003 07:20:06 -0700 (PDT)
From:      Robert Drehmel <robert@zoot.drehmel.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/56147: FreeBSD/NetBSD /bin/sh mishandles positional parameters in "case"
Message-ID:  <200309171420.h8HEK6ID013950@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/56147; it has been noted by GNATS.

From: Robert Drehmel <robert@zoot.drehmel.com>
To: freebsd-gnats-submit@FreeBSD.org, prj@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);



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