DASH Shell discussions
 help / color / mirror / Atom feed
* [PATCH] [EXPAND] Do not split the result of tilde expansion
@ 2010-12-05 17:31 Jilles Tjoelker
  2011-03-10  9:17 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Jilles Tjoelker @ 2010-12-05 17:31 UTC (permalink / raw)
  To: dash

A tilde expansion generates a valid pathname. Splitting it using IFS
either leaves it unchanged or changes it to something unintended.

This fixes FreeBSD sh test expansion/tilde1.0 and does not change the
outcome of the other tests.

This fixes Debian bug #601096.

Example:
  IFS=m HOME=/tmp; printf "%s\n" ~
---
 src/expand.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/expand.c b/src/expand.c
index 1b77b7c..60d4798 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -395,7 +395,6 @@ done:
 	*p = c;
 	startloc = expdest - (char *)stackblock();
 	strtodest(home, SQSYNTAX, quotes);
-	recordregion(startloc, expdest - (char *)stackblock(), 0);
 	return (p);
 lose:
 	*p = c;
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [EXPAND] Do not split the result of tilde expansion
  2010-12-05 17:31 [PATCH] [EXPAND] Do not split the result of tilde expansion Jilles Tjoelker
@ 2011-03-10  9:17 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2011-03-10  9:17 UTC (permalink / raw)
  To: Jilles Tjoelker; +Cc: dash

On Sun, Dec 05, 2010 at 05:31:59PM +0000, Jilles Tjoelker wrote:
> A tilde expansion generates a valid pathname. Splitting it using IFS
> either leaves it unchanged or changes it to something unintended.
> 
> This fixes FreeBSD sh test expansion/tilde1.0 and does not change the
> outcome of the other tests.
> 
> This fixes Debian bug #601096.
> 
> Example:
>   IFS=m HOME=/tmp; printf "%s\n" ~

Thanks for the patch! I also removed startloc which is now unused.

commit 834629283f6c629a4da05ef60bae9445c954a19a
Author: Jilles Tjoelker <jilles@stack.nl>
Date:   Thu Mar 10 17:16:13 2011 +0800

    [EXPAND] Do not split the result of tilde expansion
    
    A tilde expansion generates a valid pathname. Splitting it using IFS
    either leaves it unchanged or changes it to something unintended.
    
    This fixes FreeBSD sh test expansion/tilde1.0 and does not change the
    outcome of the other tests.
    
    This fixes Debian bug #601096.
    
    Example:
      IFS=m HOME=/tmp; printf "%s\n" ~
    
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

diff --git a/ChangeLog b/ChangeLog
index c94dff8..a64e030 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2011-03-10  Jilles Tjoelker <jilles@stack.nl>
 
 	* Replace GPL noclobberopen code with the FreeBSD version.
+	* Do not split the result of tilde expansion.
 
 2010-11-28  Maciej Żenczykowski <zenczykowski@gmail.com>
 
diff --git a/src/expand.c b/src/expand.c
index 1b77b7c..6bee5c5 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -364,7 +364,6 @@ exptilde(char *startp, char *p, int flag)
 	char *name;
 	const char *home;
 	int quotes = flag & QUOTES_ESC;
-	int startloc;
 
 	name = p + 1;
 
@@ -393,9 +392,7 @@ done:
 	if (!home || !*home)
 		goto lose;
 	*p = c;
-	startloc = expdest - (char *)stackblock();
 	strtodest(home, SQSYNTAX, quotes);
-	recordregion(startloc, expdest - (char *)stackblock(), 0);
 	return (p);
 lose:
 	*p = c;

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-03-10  9:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-05 17:31 [PATCH] [EXPAND] Do not split the result of tilde expansion Jilles Tjoelker
2011-03-10  9:17 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox