search for: evalvar

Displaying 16 results from an estimated 16 matches for "evalvar".

Did you mean: evaluar
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix skipping of command substitution when trimming in evalvar
...13d281c89a42fac Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Mon, 28 May 2018 17:09:48 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: expand: Fix skipping of command substitution when trimming in evalvar [ dash commit c5819fdd6e587aeb0bceaf60e86999a484541a19 ] When we are trimming an unset variable in evalvar, any embedded command substitution that should have been skipped are not. This can cause them to be evaluated later should there be other command substitutions in the same input word. Sign...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix multiple issues with EXP_DISCARD in evalvar
...9686c78c7815203ecbf3e87a81ff8 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Wed, 12 Sep 2018 14:27:16 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: expand: Fix multiple issues with EXP_DISCARD in evalvar [ dash commit a29e9a1738a4e7040211842f3f3d90e172fa58ce ] The commit 3cd538634f71538370f5af239f342aec48b7470b broke parameter expansion in multiple ways because the EXP_DISCARD flag wasn't set or tested for various cases: $ src/dash -c 'var=; echo ${var:+nonempty}' nonempty...
2019 Jan 25
0
[klibc:update-dash] expand: Fix ghost fields with unquoted $@/$*
...o longer occur with your patch. >> >> The latter is my guess, but I haven't had time to investigate it. > > Looking into it again: > > When IFS is set to an empty string, sepc is set to '\0' in varvalue(). > This then causes *quotedp to be set to true, meaning evalvar()'s quoted > variable is turned on. quoted is then passed to recordregion() as the > nulonly parameter. > > ifsp->nulonly has a bigger effect than merely selecting whether to use > $IFS or whether to only split on null bytes: in ifsbreakup(), nulonly > also causes string te...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Optimise nulonly away and just use quoted as before
...gt; AuthorDate: Wed, 8 Oct 2014 20:09:56 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Fri, 25 Jan 2019 02:57:21 +0000 [klibc] [EXPAND] Optimise nulonly away and just use quoted as before This patch makes a small optimisation by using the same value for quoted between evalvar and varvalue by eliminating nulonly and passing along quoted instead. 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 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix ghost fields with unquoted $@/$*
...o longer occur with your patch. >> >> The latter is my guess, but I haven't had time to investigate it. > > Looking into it again: > > When IFS is set to an empty string, sepc is set to '\0' in varvalue(). > This then causes *quotedp to be set to true, meaning evalvar()'s quoted > variable is turned on. quoted is then passed to recordregion() as the > nulonly parameter. > > ifsp->nulonly has a bigger effect than merely selecting whether to use > $IFS or whether to only split on null bytes: in ifsbreakup(), nulonly > also causes string te...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Optimise nulonly away and just use quoted as before
...utchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:54 +0000 [klibc] dash: [EXPAND] Optimise nulonly away and just use quoted as before [ dash commit ab657e36b68f4a7e9ddb0f36c455c98d1c069a2c ] This patch makes a small optimisation by using the same value for quoted between evalvar and varvalue by eliminating nulonly and passing along quoted instead. 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 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)...
2019 Jan 25
0
[klibc:update-dash] [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...;ben at decadent.org.uk> --- usr/dash/expand.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index c4d52606..add952b7 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -116,7 +116,7 @@ STATIC const char *subevalvar(char *, char *, int, int, int, int, int); STATIC char *evalvar(char *, int); STATIC size_t strtodest(const char *, const char *, int); STATIC void memtodest(const char *, size_t, const char *, int); -STATIC ssize_t varvalue(char *, int, int); +STATIC ssize_t varvalue(char *, int, int, int *); S...
2020 Mar 28
0
[klibc:update-dash] dash: [EXPAND] Split unquoted $@/$* correctly when IFS is set but empty
...;ben at decadent.org.uk> --- usr/dash/expand.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index c4d52606..add952b7 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -116,7 +116,7 @@ STATIC const char *subevalvar(char *, char *, int, int, int, int, int); STATIC char *evalvar(char *, int); STATIC size_t strtodest(const char *, const char *, int); STATIC void memtodest(const char *, size_t, const char *, int); -STATIC ssize_t varvalue(char *, int, int); +STATIC ssize_t varvalue(char *, int, int, int *); S...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Do not reprocess data when expanding words
...[klibc] dash: expand: Do not reprocess data when expanding words [ dash commit 3cd538634f71538370f5af239f342aec48b7470b ] Currently various paths will reprocess data when performing word expansion. For example, expari will skip backwards looking for the start of the arithmetic expansion, while evalvar will skip unexpanded words manually. This is cumbersome and error-prone. This patch fixes this by making word expansions proceed in a linear fashion. This means changing argstr and the various expansion functions such as expari and subevalvar to return the next character to be expanded. This is...
2019 Jan 25
0
[klibc:update-dash] expand: Fix bugs with words connected to the right of $@
...sh/expand.c +++ b/usr/dash/expand.c @@ -318,13 +318,13 @@ start: case CTLENDVAR: /* ??? */ goto breakloop; case CTLQUOTEMARK: - inquotes ^= EXP_QUOTED; /* "$@" syntax adherence hack */ - if (inquotes && !memcmp(p, dolatstr + 1, - DOLATSTRLEN - 1)) { - p = evalvar(p + 1, flag | inquotes) + 1; + if (!inquotes && !memcmp(p, dolatstr + 1, + DOLATSTRLEN - 1)) { + p = evalvar(p + 1, flag | EXP_QUOTED) + 1; goto start; } + inquotes ^= EXP_QUOTED; addquote: if (flag & QUOTES_ESC) { p--; @@ -1032,7 +1032,10 @@ ifsbreakup(c...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Fix bugs with words connected to the right of $@
...sh/expand.c +++ b/usr/dash/expand.c @@ -318,13 +318,13 @@ start: case CTLENDVAR: /* ??? */ goto breakloop; case CTLQUOTEMARK: - inquotes ^= EXP_QUOTED; /* "$@" syntax adherence hack */ - if (inquotes && !memcmp(p, dolatstr + 1, - DOLATSTRLEN - 1)) { - p = evalvar(p + 1, flag | inquotes) + 1; + if (!inquotes && !memcmp(p, dolatstr + 1, + DOLATSTRLEN - 1)) { + p = evalvar(p + 1, flag | EXP_QUOTED) + 1; goto start; } + inquotes ^= EXP_QUOTED; addquote: if (flag & QUOTES_ESC) { p--; @@ -1032,7 +1032,10 @@ ifsbreakup(c...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Eat closing brace for length parameter expansion
...Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: expand: Eat closing brace for length parameter expansion [ dash commit 878514712c5d21f675c45d99d2f8a04098ea4a19 ] When we are doing VSLENGTH expansion, the closing brace is currently not removed in evalvar. This causes the caller argstr to terminate prematurely as it would interpret the closing brace as one that belongs to a parameter expansion at the outer level. This patch fixes it. Reported-by: Martijn Dekker <martijn at inlv.org> Fixes: 3cd538634f71 ("expand: Do not reprocess data w...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Ensure result is escaped in cvtnum
...file changed, 14 insertions(+), 13 deletions(-) diff --git a/usr/dash/expand.c b/usr/dash/expand.c index c3d67fc3..411381bd 100644 --- a/usr/dash/expand.c +++ b/usr/dash/expand.c @@ -116,7 +116,7 @@ static char *expari(char *start, int flag); STATIC void expbackq(union node *, int); STATIC char *evalvar(char *, int); static size_t strtodest(const char *p, int flags); -static void memtodest(const char *p, size_t len, int flags); +static size_t memtodest(const char *p, size_t len, int flags); STATIC ssize_t varvalue(char *, int, int, int); STATIC void expandmeta(struct strlist *, int); #ifdef HA...
2020 Mar 28
0
[klibc:update-dash] dash: expand: Merge syntax/quotes in memtodest with flags
...ESC (EXP_FULL | EXP_CASE) -/* Do not skip NUL characters. */ -#define QUOTES_KEEPNUL EXP_TILDE /* * Structure specifying which parts of the string should be searched @@ -117,8 +115,8 @@ STATIC char *exptilde(char *, char *, int); STATIC void expbackq(union node *, int); STATIC const char *subevalvar(char *, char *, int, int, int, int, int); STATIC char *evalvar(char *, int); -STATIC size_t strtodest(const char *, const char *, int); -STATIC void memtodest(const char *, size_t, const char *, int); +static size_t strtodest(const char *p, int flags); +static void memtodest(const char *p, size_t...
2019 Jan 25
0
[klibc:update-dash] parser: Add syntax stack for recursive parsing
...* Quoted parameter expansion pattern: remove quote - * unless inside inner quotes or we have a literal - * backslash. - */ - if (((flag | inquotes) & (EXP_QPAT | EXP_QUOTED)) == - EXP_QPAT && *p != '\\') - break; - goto addquote; case CTLVAR: p = evalvar(p, flag | inquotes); @@ -653,8 +643,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED...
2020 Mar 28
0
[klibc:update-dash] dash: parser: Add syntax stack for recursive parsing
...* Quoted parameter expansion pattern: remove quote - * unless inside inner quotes or we have a literal - * backslash. - */ - if (((flag | inquotes) & (EXP_QPAT | EXP_QUOTED)) == - EXP_QPAT && *p != '\\') - break; - goto addquote; case CTLVAR: p = evalvar(p, flag | inquotes); @@ -653,8 +643,7 @@ subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varfla char *(*scan)(char *, char *, char *, char *, int , int); argstr(p, EXP_TILDE | (subtype != VSASSIGN && subtype != VSQUESTION ? - (flag & (EXP_QUOTED...