summary refs log tree commit diff
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-09-24 16:22:25 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2007-09-24 16:22:25 +0800
commitdd721f71292be8ae2ef0ac1d2d8910b1541dcf88 (patch)
tree17c4fecd06f5e6e90308537d7d05a7703504d3b4
parent[EXPAND] Do not quote back slashes in parameter expansions outside quotes (diff)
downloaddash-dd721f71292be8ae2ef0ac1d2d8910b1541dcf88.tar.gz
dash-dd721f71292be8ae2ef0ac1d2d8910b1541dcf88.zip
[EXPAND] Perform tilde expansion in all parameter expansion words
Previously tilde expansion was not carried out for =?#% expansion words.
This is contrary to the POSIX specification.

Test case:

	a=~root:~root
	echo ${a#~root}

Old result:

	/root:/root

New result:

	:/root
-rw-r--r--ChangeLog1
-rw-r--r--src/expand.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dca08d5..816f56d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2007-09-24  Herbert Xu <herbert@gondor.apana.org.au>
 
 	* Do not quote back slashes in parameter expansions outside quotes.
+	* Perform tilde expansion in all parameter expansion words.
 
 2007-09-22  Oleg Verych <olecom@flower.upol.cz>
 
diff --git a/src/expand.c b/src/expand.c
index 3956112..1443c14 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -683,7 +683,8 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla
 	char *(*scan)(char *, char *, char *, char *, int , int);
 
 	herefd = -1;
-	argstr(p, subtype != VSASSIGN && subtype != VSQUESTION ? EXP_CASE : 0);
+	argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ?
+			       EXP_CASE : 0));
 	STPUTC('\0', expdest);
 	herefd = saveherefd;
 	argbackq = saveargbackq;