Module Name:    src
Committed By:   kre
Date:           Sun Mar 12 04:19:29 UTC 2017

Modified Files:
        src/bin/sh: expand.c

Log Message:
Fix for the "${unset-var#$(cmd1)}$(cmd2)" runs the wrong command bug.
... From FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/bin/sh/expand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.101 src/bin/sh/expand.c:1.102
--- src/bin/sh/expand.c:1.101	Thu Mar 31 16:16:35 2016
+++ src/bin/sh/expand.c	Sun Mar 12 04:19:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $	*/
+/*	$NetBSD: expand.c,v 1.102 2017/03/12 04:19:29 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.102 2017/03/12 04:19:29 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -756,8 +756,10 @@ again: /* jump here after setting a vari
 	case VSTRIMLEFTMAX:
 	case VSTRIMRIGHT:
 	case VSTRIMRIGHTMAX:
-		if (!set)
+		if (!set) {
+			set = 1;  /* allow argbackq to be advanced if needed */
 			break;
+		}
 		/*
 		 * Terminate the string and start recording the pattern
 		 * right after it

Reply via email to