1 |
truedfx 10/08/22 20:24:45 |
2 |
|
3 |
Added: dash-0.5.6.1-read-ifs.patch |
4 |
Log: |
5 |
Fix IFS handling with read command (#331535) |
6 |
(Portage version: 2.2_rc67/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 app-shells/dash/files/dash-0.5.6.1-read-ifs.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/dash/files/dash-0.5.6.1-read-ifs.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/app-shells/dash/files/dash-0.5.6.1-read-ifs.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: dash-0.5.6.1-read-ifs.patch |
15 |
=================================================================== |
16 |
diff --git a/src/expand.c b/src/expand.c |
17 |
index f2f964c..3ba1a38 100644 |
18 |
--- a/src/expand.c |
19 |
+++ b/src/expand.c |
20 |
@@ -205,7 +205,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag) |
21 |
* TODO - EXP_REDIR |
22 |
*/ |
23 |
if (flag & EXP_FULL) { |
24 |
- ifsbreakup(p, &exparg); |
25 |
+ ifsbreakup(p, &exparg, 0); |
26 |
*exparg.lastp = NULL; |
27 |
exparg.lastp = &exparg.list; |
28 |
expandmeta(exparg.list, flag); |
29 |
@@ -1022,9 +1022,11 @@ recordregion(int start, int end, int nulonly) |
30 |
* Break the argument string into pieces based upon IFS and add the |
31 |
* strings to the argument list. The regions of the string to be |
32 |
* searched for IFS characters have been stored by recordregion. |
33 |
+ * If bltin is set, use bltinlookup to search for IFS in the |
34 |
+ * environment of the currently executing built-in command. |
35 |
*/ |
36 |
void |
37 |
-ifsbreakup(char *string, struct arglist *arglist) |
38 |
+ifsbreakup(char *string, struct arglist *arglist, int bltin) |
39 |
{ |
40 |
struct ifsregion *ifsp; |
41 |
struct strlist *sp; |
42 |
@@ -1040,7 +1042,13 @@ ifsbreakup(char *string, struct arglist *arglist) |
43 |
if (ifslastp != NULL) { |
44 |
ifsspc = 0; |
45 |
nulonly = 0; |
46 |
- realifs = ifsset() ? ifsval() : defifs; |
47 |
+ if (!bltin) |
48 |
+ realifs = ifsset() ? ifsval() : defifs; |
49 |
+ else { |
50 |
+ realifs = bltinlookup("IFS"); |
51 |
+ if (realifs == NULL) |
52 |
+ realifs = defifs; |
53 |
+ } |
54 |
ifsp = &ifsfirst; |
55 |
do { |
56 |
p = string + ifsp->begoff; |
57 |
diff --git a/src/expand.h b/src/expand.h |
58 |
index 405af0b..8eb5f07 100644 |
59 |
--- a/src/expand.h |
60 |
+++ b/src/expand.h |
61 |
@@ -69,7 +69,7 @@ char *_rmescapes(char *, int); |
62 |
int casematch(union node *, char *); |
63 |
void recordregion(int, int, int); |
64 |
void removerecordregions(int); |
65 |
-void ifsbreakup(char *, struct arglist *); |
66 |
+void ifsbreakup(char *, struct arglist *, int bltin); |
67 |
|
68 |
/* From arith.y */ |
69 |
intmax_t arith(const char *); |
70 |
diff --git a/src/miscbltin.c b/src/miscbltin.c |
71 |
index 5ab1648..6810f5f 100644 |
72 |
--- a/src/miscbltin.c |
73 |
+++ b/src/miscbltin.c |
74 |
@@ -85,9 +85,10 @@ readcmd_handle_line(char *line, char **ap, size_t len) |
75 |
backup = sstrdup(line); |
76 |
|
77 |
arglist.lastp = &arglist.list; |
78 |
+ removerecordregions(0); |
79 |
recordregion(0, len - 1, 0); |
80 |
|
81 |
- ifsbreakup(s, &arglist); |
82 |
+ ifsbreakup(s, &arglist, 1); |
83 |
*arglist.lastp = NULL; |
84 |
removerecordregions(0); |