Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh Fix for the "${unset-var#$(cmd1)}$(cmd2)" runs the wr...



details:   https://anonhg.NetBSD.org/src/rev/5730da1ce310
branches:  trunk
changeset: 822299:5730da1ce310
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Mar 12 04:19:29 2017 +0000

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

diffstat:

 bin/sh/expand.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 40abc09c269c -r 5730da1ce310 bin/sh/expand.c
--- a/bin/sh/expand.c   Sun Mar 12 00:39:47 2017 +0000
+++ b/bin/sh/expand.c   Sun Mar 12 04:19:29 2017 +0000
@@ -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 @@
        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



Home | Main Index | Thread Index | Old Index