[klibc] [klibc:update-dash] dash: expand: Use HOME in tilde expansion when it is empty

klibc-bot for Herbert Xu herbert at gondor.apana.org.au
Sat Mar 28 14:49:26 PDT 2020


Commit-ID:  91d0712951d61680da0e26aa356787b80b7368d8
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=91d0712951d61680da0e26aa356787b80b7368d8
Author:     Herbert Xu <herbert at gondor.apana.org.au>
AuthorDate: Sun, 27 May 2018 17:31:57 +0800
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 28 Mar 2020 21:42:55 +0000

[klibc] dash: expand: Use HOME in tilde expansion when it is empty

[ dash commit 14dff0f69d37e73cf99c77f5f5f38b2a3c6522f5 ]

Currently if HOME is set to empty tilde expansion will fail, i.e.,
it will remain as a literal tilde.  This patch changes it to
return the empty string as required by POSIX.

Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

---
 usr/dash/expand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/dash/expand.c b/usr/dash/expand.c
index 6ea0562f..f1f5a9fa 100644
--- a/usr/dash/expand.c
+++ b/usr/dash/expand.c
@@ -385,7 +385,7 @@ done:
 	} else {
 		home = getpwhome(name);
 	}
-	if (!home || !*home)
+	if (!home)
 		goto lose;
 	*p = c;
 	strtodest(home, SQSYNTAX, quotes);


More information about the klibc mailing list