From: "Harald van Dijk (truedfx)" <truedfx@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in app-shells/dash/files: dash-0.5.6.1-read-ifs.patch
Date: Sun, 22 Aug 2010 20:24:45 +0000 (UTC) [thread overview]
Message-ID: <20100822202445.47F6320051@flycatcher.gentoo.org> (raw)
truedfx 10/08/22 20:24:45
Added: dash-0.5.6.1-read-ifs.patch
Log:
Fix IFS handling with read command (#331535)
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Revision Changes Path
1.1 app-shells/dash/files/dash-0.5.6.1-read-ifs.patch
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
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
Index: dash-0.5.6.1-read-ifs.patch
===================================================================
diff --git a/src/expand.c b/src/expand.c
index f2f964c..3ba1a38 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -205,7 +205,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
* TODO - EXP_REDIR
*/
if (flag & EXP_FULL) {
- ifsbreakup(p, &exparg);
+ ifsbreakup(p, &exparg, 0);
*exparg.lastp = NULL;
exparg.lastp = &exparg.list;
expandmeta(exparg.list, flag);
@@ -1022,9 +1022,11 @@ recordregion(int start, int end, int nulonly)
* Break the argument string into pieces based upon IFS and add the
* strings to the argument list. The regions of the string to be
* searched for IFS characters have been stored by recordregion.
+ * If bltin is set, use bltinlookup to search for IFS in the
+ * environment of the currently executing built-in command.
*/
void
-ifsbreakup(char *string, struct arglist *arglist)
+ifsbreakup(char *string, struct arglist *arglist, int bltin)
{
struct ifsregion *ifsp;
struct strlist *sp;
@@ -1040,7 +1042,13 @@ ifsbreakup(char *string, struct arglist *arglist)
if (ifslastp != NULL) {
ifsspc = 0;
nulonly = 0;
- realifs = ifsset() ? ifsval() : defifs;
+ if (!bltin)
+ realifs = ifsset() ? ifsval() : defifs;
+ else {
+ realifs = bltinlookup("IFS");
+ if (realifs == NULL)
+ realifs = defifs;
+ }
ifsp = &ifsfirst;
do {
p = string + ifsp->begoff;
diff --git a/src/expand.h b/src/expand.h
index 405af0b..8eb5f07 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -69,7 +69,7 @@ char *_rmescapes(char *, int);
int casematch(union node *, char *);
void recordregion(int, int, int);
void removerecordregions(int);
-void ifsbreakup(char *, struct arglist *);
+void ifsbreakup(char *, struct arglist *, int bltin);
/* From arith.y */
intmax_t arith(const char *);
diff --git a/src/miscbltin.c b/src/miscbltin.c
index 5ab1648..6810f5f 100644
--- a/src/miscbltin.c
+++ b/src/miscbltin.c
@@ -85,9 +85,10 @@ readcmd_handle_line(char *line, char **ap, size_t len)
backup = sstrdup(line);
arglist.lastp = &arglist.list;
+ removerecordregions(0);
recordregion(0, len - 1, 0);
- ifsbreakup(s, &arglist);
+ ifsbreakup(s, &arglist, 1);
*arglist.lastp = NULL;
removerecordregions(0);
reply other threads:[~2010-08-22 20:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100822202445.47F6320051@flycatcher.gentoo.org \
--to=truedfx@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox