~emersion/mrsh-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] builtin/export: expand tildes in value

Details
Message ID
<20190902014403.19045-1-sir@cmpwn.com>
DKIM signature
pass
Download raw message
Patch: +5 -1
Fixes the following:

export PATH=~/bin:$PATH
---
 builtin/export.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/builtin/export.c b/builtin/export.c
index a48ddc1..896f867 100644
--- a/builtin/export.c
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "builtin.h"
+#include "shell/word.h"
 
 static const char export_usage[] = "usage: %s -p|name[=word]...\n";
 
@@ -52,8 +53,11 @@ int builtin_export(struct mrsh_state *state, int argc, char *argv[]) {
 			free(key);
 			return 1;
 		}
-		mrsh_env_set(state, key, val, attrib | prev_attribs);
+		char *new_val = strdup(val);
+		expand_tilde(state, &new_val);
+		mrsh_env_set(state, key, new_val, attrib | prev_attribs);
 		free(key);
+		free(new_val);
 	}
 
 	return 0;
-- 
2.23.0
Details
Message ID
<O0Sk7sC7uHMyaofUxeyYecNv9t1WeyKuoYai1aZfFu98Nq-DWJHl9ZY4iYp75HgwLPgk5lMpnSAx5dheHQcutu3PvrCWL2pK40bedGeL6ro=@emersion.fr>
In-Reply-To
<20190902014403.19045-1-sir@cmpwn.com> (view parent)
DKIM signature
pass
Download raw message
Pushed:

To git.sr.ht:~emersion/mrsh
   5fd9b0058eac..5e6fe9c68eba  master -> master

Thanks!