[PATCH] don't record empty IFS scan regions

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

 



evalvar() records empty expansion results (varlen == 0) as string
regions that need to be scanned for IFS characters. This is pointless,
because there is nothing to split.

This patch fixes the bug that, given no positional parameters, unquoted
$@ and $* incorrectly generate one empty field (they should generate no
fields). Apparently that was a side effect of the above.

- M.

diff --git a/src/expand.c b/src/expand.c
index 705fef7..03a9b0c 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -771,7 +771,7 @@ vsplus:
 
 	if (subtype == VSNORMAL) {
 record:
-		if (!easy)
+		if (!easy || varlen == 0)
 			goto end;
 		recordregion(startloc, expdest - (char *)stackblock(), quoted);
 		goto end;

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux