summary refs log tree commit diff
Commit message (Collapse)AuthorAge
...
* [BUILTIN] Made t_lex reentrantHerbert Xu2008-07-13
| | | | | | | The previous two changes were broken because t_lex uses global state. This patch removes that by making t_wp local to t_lex. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Made aexpr/oexpr non-recursiveHerbert Xu2008-07-13
| | | | | | | Making these functions non-recursive is straightforward since they carry no state. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Fixed 3,4-argument cases for test per POSIXHerbert Xu2008-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----- Forwarded message from Gerrit Pape <pape@smarden.org> ----- Subject: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error Date: Fri, 28 Dec 2007 08:53:29 +0000 From: Gerrit Pape <pape@smarden.org> To: Vincent Lefevre <vincent@vinc17.org>, 455828@bugs.debian.org On Thu, Dec 27, 2007 at 06:23:20PM +0100, Vincent Lefevre wrote: > On 2007-12-27 16:00:06 +0000, Gerrit Pape wrote: > > On Wed, Dec 12, 2007 at 02:18:47AM +0100, Vincent Lefevre wrote: > > > According to POSIX[*], "test \( ! -e \)" is a 4-argument test and is > > > here equivalent to "test ! -e". But dash (like ksh93 and bash) yields > > > an error: > > > > > > $ test \( ! -e \) || echo $? > > > test: 1: closing paren expected > > > 2 > > > $ test ! -e || echo $? > > > 1 > > > > Hi Vincent, > > > > the -e switch to test takes an argument, a pathname. > > According to POSIX, in both above examples, "-e" is *not* a switch, > just a string. > > test \( ! -e \) > > means: return true if the string "-e" is empty, otherwhise return false. > The error in dash is that it incorrectly thinks that "-e" is a switch in > this context. I see, you're right. Thanks, Gerrit. ----- End forwarded message ----- This patch hard-codes the 3,4-argument cases in the way required by POSIX. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [EXPAND] Fixed non-leading slash treatment in expmetaHerbert Xu2008-05-19
| | | | | | | | | | | | | | | | | | | | | | | | | | Back in January an attempt was made to fix the interpretation of quoted slashes in expmeta. However, this only fixed those cases where the quoted slash is at the front of the word. The case of non-leading slashes caused the previous directory part to gain a back slash suffix which causes subsequent pattern matches to fail. This patch fixes this by removing the back slash in that case. Thanks to Romain Tartière fox reporting this bug. Test case: echo /*"/null" Old result: /*/null New result: /dev/null Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [ARITH] Fixed lexical error on & and |Gerrit Pape2008-05-07
| | | | | | | | | | | The parser used to skip a byte when parsing the & and | operators, testcase: $ dash -c 'echo $((7&1))' $ dash -c 'echo $((7& 1))' $ dash -c 'echo $((7&11))' Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Added gitignoreDan McGee2008-05-03
| | | | | | | This gitignore covers most of the generated files in the src/ directory. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Use uninitialized_var to silence bogus warningsHerbert Xu2008-05-03
| | | | | | | | gcc generates bogus warnings about uninitialised variables in parser.c. This patch borrows the uninitialized_var macro from Linux to silence them. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Fixed klibc/klcc build problemsDan McGee2008-05-03
| | | | | | | | | | | | klibc does not have mempcpy, so system.h must be included where this is used to provide the replacement. glob.h doesn't exist, so we need to guard this include with the HAVE_GLOB definition. Finally, klcc didn't like the syntax of the main definition in mksignames, and the resulting program segfaulted when trying to dereference any part of the argv array. Updating the main function definition solved the problem. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [ERROR] Set default exvwarning2 arg0 for errors during early initialisationHerbert Xu2008-05-03
| | | | | | | | As it stands if we get an error before procargs gets called by main() we'll try to print out a null pointer. This patch avoids this by printing out "sh" instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [CD] Restored warning when getcwd failsHerbert Xu2008-05-03
| | | | | | | Somewhere along the lines the warning when getcwd fails went missing. This patch restores it. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [CD] Test __GLIBC__ instead of _GNU_SOURCEHerbert Xu2008-05-03
| | | | | | | AC_GNU_SOURCE always defines _GNU_SOURCE so testing it is pointless. This patch changes it to test __GLIBC__ instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [EXEC] Fixed _PATH_BSHELL warningHerbert Xu2008-05-03
| | | | | | | | | | | | | | | | With klcc we get klcc -DHAVE_CONFIG_H -I. -I.. -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN -Wall -D__CTYPE_NO_INLINE -MT exec.o -MD -MP -MF .deps/exec.Tpo -c -o exec.o exec.c exec.c: In function 'tryexec': exec.c:160: warning: comparison with string literal results in unspecified behavior Storing it in a local variable fixes the problem. Thanks to Dan McGee for reporting this. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [CD] Restored non-glibc getcwd supportHerbert Xu2008-05-02
| | | | | | | | | | These days dash is expected to build with libraries other than glibc so we need to support the old way of calling getcwd again. Thanks to Dan McGee for reporting this bug when dash is built with klibc. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [JOBS] Fix cmdtxt crash on if statementsLarry Doolittle2008-05-02
| | | | | | | | | | | | | | | | (Herbert: for context, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467065 ) This is a real bug in upstream dash, which has existed since at least dash-0.5.1 (July 2004). It is a latent bug in cmdtxt() (which I think applies only to pipes) as it handles "if" commands. The attached patch fixes it for me. It's possible this patch will fix one or more of #462414, #462977, and #463649. I'll send messages there to see if the submitters can test. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [EXPAND] Fix slash treatment in expmetaHerbert Xu2008-05-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change [EXPAND] Do not quote back slashes in parameter expansions outside quotes triggered a latent bug in expmeta where the forward slashes when preceded by a blackslash weren't recognised as directory separators. This was hidden because a work-around was put in place for glob(3) which meant that we never had any backslashes immediately before forward slashes. This patch fixes the metaflag loop to recognise forward slashes even when they follow a backslash. Thanks to Daniel Hahler for reporting this problem. Test case: echo "/"root* Old result: /root* New result: /root Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [PARSER] Do not show prompts in expandstrHerbert Xu2007-12-27
| | | | | | | | | | Once I fixed the previous problem it became apparent that we never dealt with prompts with new-lines in them correctly. The problem is that we showed a secondary prompt for each of them. This patch disables prompt generation in expandstr. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [PARSER] Add FAKEEOFMARK for expandstrHerbert Xu2007-12-27
| | | | | | | | | | | | | | | | Previously expandstr used the string "" to indicate that it needs to be treated just like a here-doc except that there is no terminator. However, the string "" is in fact a valid here-doc terminator so now that we deal with it correctly expandstr no longer works in the presence of new-lines in the prompt. This patch introduces the FAKEEOFMARK macro which does not equal any real EOF marker but is distinct from the NULL pointer which is used to indicate non-here-doc contexts. Thanks to Markus Triska for reporting this regression. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [ARITH] If imaxdiv() isn't available, use / and % operatorsGerrit Pape2007-12-23
| | | | | | | | | | | Although in posix, imaxdiv() isn't implemented on Debian/alpha, causing dash to fail to build. So use / and % operators if imaxdiv() isn't available. http://bugs.debian.org/456398 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Add set +o supportRichard M Kreuter2007-12-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The dash(1) in Debian stable does not support "set +o" in the manner specified by SUSv3: |+o | Write the current option settings to standard output in a format | that is suitable for reinput to the shell as commands that | achieve the same options settings. (citation from http://www.opengroup.org/onlinepubs/009695399/utilities/set.html) Instead, dash's "set +o" prints the shell's options in a human-readable format. Here is a simple test program that exercises this feature; it works as I believe is required under bash, but not under dash. # Save the shell's options set +o > /tmp/settings-commands set -o | sort > /tmp/settings-before # Change some options. set -v set -f set -x set +o emacs set -o vi # Try to restore our options. . /tmp/settings-commands set -o | sort > /tmp/settings-after # Compare. diff /tmp/settings-before /tmp/settings-after I believe the following small patch adds this feature to dash, and documents it in the manual page: Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [EVAL] Fix bad pointer arithmetic in evalcommandSteve Langasek2007-12-23
| | | | | | | | | | | | | | | | dash dies on sparc with a SIGBUS due to an arithmetic error introduced with commit 03b4958, this patch fixes it. --- > Hi Gerrit, > > dash 0.5.4-3 dies on sparc with a SIGBUS due to an arithmetic error > introduced with the patch > 0030-EXEC-Fixed-execing-of-scripts-with-no-hash-bang.diff. The > attached > patch fixes the problem. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [EXPAND] Expand here-documents in the current shell environmentHerbert Xu2007-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously we always expanded here-documents in a subshell. This is contrary to the POSIX specification and how other shells behave. What's more this slows down many expansions due to the extra fork (however, it must be said that it is possible for it speed up certain expansions by running it simultaneously with the command on two CPUs). This patch move the expansion into the current shell environment. Test case: unset a cat <<- EOF > /dev/null ${a=NOT} EOF echo ${a}BAD Old result: BAD New result: NOTBAD
* [EXPAND] Removed herefd hackHerbert Xu2007-11-11
| | | | | | | | | | | The herefd hack goes back more than a decade. it limits the amount of memory we have to allocate when expanding here-documents by writing the result out from time to time. However, it's no longer safe because the stack is used to place intermediate results too and there we certainly don't want to write them out should we be short on memory. In any case, with today's computers we can afford to keep the entire result in memory and write them out at the end.
* [PARSER] Removed noexpand/length check on eofmarkHerbert Xu2007-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Tue, Oct 30, 2007 at 04:23:35AM +0000, Oleg Verych wrote: > > } 8<<"" > ====================== Actually this (the empty delim) only works with dash by accident. I've tried bash and pdksh and they both terminate on the first empty line which is what you would expect rather than EOF. The real Korn shell does something completely different. I've fixed this in dash to conform to bash/pdksh. > In [0] it's stated, that delimiter isn't evaluated (expanded), only > quoiting must be checked. That if() seems to be completely bogus. OK I agree. The reason it was there is because the parser would have already replaced the dollar sign by an internal representation. I've fixed it properly with this patch. Test case: cat <<- $a OK $a cat <<- "" OK echo OK Old result: dash: Syntax error: Illegal eof marker for << redirection OK echo OK New result: OK OK OK
* [PARSER] Fix here-doc corruptionHerbert Xu2007-10-20
| | | | | | | | | | | | | | | | | | | | | | | The change [PARSER] Recognise here-doc delimiters terminated by EOF introduced a regerssion whereby lines starting with eofmark but are not equal to eofmark would be corrupted. This patch fixes it. Test case: cat << _ACEOF _ASBOX _ACEOF Old result: SASBOX New result: _ASBOX
* [EXPAND] Added configure --enable-glob and --enable-fnmatch optionsHerbert Xu2007-10-20
| | | | | | | | Debian's libc6 as of 2.6.1-6 has working glob(3)/fnmatch(3) support. This patch adds the options --enable-glob and --enable-fnmatch to the configure script. By default glob(3) and fnmatch(3) are still unused. However, on distros where the glibc is known to work you may enable these options.
* [SHELL] Replace shared illnum message by badnum function.Herbert Xu2007-10-17
| | | | | | This patch adds the badnum function and uses it to mostly replace the use of illnum except in miscbltin where the current code turns out to be smaller because of the twin sh_error calls.
* [BUILTIN] Disallow completely blank strings in non-arithmetic context.Oleg Verych2007-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NULL as a number argument: olecom@deen:/mnt/debian/src/dash-0.5.3$ time src/dash tst-01.sh test: 20: `': bad number `' eq 0: 2 must be >1, Not A Number test: 20: `': bad number `' ne 0: 2 must be >1, Not A Number test: 20: `': bad number `' gt 0: 2 must be >1, Not A Number test: 20: `': bad number `' ge 0: 2 must be >1, Not A Number test: 20: `': bad number `' lt 0: 2 must be >1, Not A Number test: 20: `': bad number `' le 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' eq 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' ne 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' gt 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' ge 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' lt 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' le 0: 2 must be >1, Not A Number #!/usr/bin/printf This not executable script%c\n test_arithm() { for aop in eq ne gt ge lt le do "$1" 0 -$aop "$NOTHING" echo "\`' $aop 0:" $? " must be >1, Not A Number" done } # opengroup.org/onlinepubs/000095399/utilites/test.html (nothing about long): test_arithm test test_arithm /usr/bin/test # shend
* [EXEC] Fixed execing of scripts with no hash-bangHerbert Xu2007-10-15
| | | | | | | | | | | | | | | | | | | | | | | | | | The function tryexec used the original name instead of the path found through PATH search. This patch fixes that. Test case: trap 'rm -f $TMP' EXIT TMP=$(tempfile -s nosuchthing) cat <<- EOF > $TMP echo OK EOF chmod u+x $TMP cd / PATH=${TMP%/*} ${TMP##*/} Old result: /bin/sh: Can't open filelgY4Fanosuchthing New result: OK
* [BUILTIN] Use setvarint to set OPTINDHerbert Xu2007-10-11
| | | | | This patch adds a flag argument to setvarint and uses it to set the OPTIND variable.
* [EXPAND] Add likely flags in expariHerbert Xu2007-10-11
| | | | The case where the expansion isn't quoted is the norm.
* [ARITH] Size optimisations in arithmetic lexerHerbert Xu2007-10-11
| | | | Use += instead of straight assignment for token value.
* [ARITH] Add assignment and intmax_t supportHerbert Xu2007-10-11
| | | | | This patch adds assignment operator support in arithmetic expansions. It also changes the type used to intmax_t.
* [PARSER] Report substition errors at expansion timeHerbert Xu2007-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Wed, Apr 11, 2007 at 01:24:21PM -0700, Micah Cowan wrote: > Package: dash > Version: 0.5.3-3 > > Bug first reported against Ubuntu at > https://bugs.launchpad.net/ubuntu/+source/dash/+bug/105634 > by Paul Smith > > The description and some comments from that bug report follow. > > ----- > > This operation fails on Ubuntu: > > $ /bin/sh -c 'if false; then d="${foo/bar}"; fi' > /bin/sh: Syntax error: Bad substitution > > When used with other POSIX shells it succeeds. While semantically the > variable reference ${foo/bar} is not valid, this is not a syntax error > according to POSIX, and since the variable assignment expression is > never invoked (because it's within an "if false") it should not be seen > as an error. > > I ran into this because after restarting my system I could no longer log > in. It turns out that the problem was (a) I had edited .gnomerc to > source my .bashrc file so that my environment would be set properly, and > (b) I had added some new code to my .bashrc WITHIN A CHECK FOR BASH! > that used bash's ${var/match/sub} feature. Even though this code was > within a "case $BASH_VERSION; in *[0-9]*) ... esac (so dash would never > execute it since that variable is not set), it still caused dash to > throw up. > > ----- > > FYI, some relevant details from POSIX: > > Section 2.3, Token Recognition: > > 5. If the current character is an unquoted '$' or '`', the shell shall > identify the start of any candidates for parameter expansion ( Parameter > Expansion), command substitution ( Command Substitution), or arithmetic > expansion ( Arithmetic Expansion) from their introductory unquoted > character sequences: '$' or "${", "$(" or '`', and "$((", respectively. > The shell shall read sufficient input to determine the end of the unit > to be expanded (as explained in the cited sections). > > Section 2.6.2, Parameter Expansion: > > The format for parameter expansion is as follows: > > ${expression} > > where expression consists of all characters until the matching '}'. Any > '}' escaped by a backslash or within a quoted string, and characters in > embedded arithmetic expansions, command substitutions, and variable > expansions, shall not be examined in determining the matching '}'. > > [...] > > The parameter name or symbol can be enclosed in braces, which are > optional except for positional parameters with more than one digit or > when parameter is followed by a character that could be interpreted as > part of the name. The matching closing brace shall be determined by > counting brace levels, skipping over enclosed quoted strings, and > command substitutions. > > --- > > In addition to bash I've checked Solaris /bin/sh and ksh and they don't > report an error. > > ----- > Micah Cowan: > > The applicable portion of POSIX is in XCU 2.10.1: > > "The WORD tokens shall have the word expansion rules applied to them > immediately before the associated command is executed, not at the time > the command is parsed." > > This seems fairly clear to me. This patch moves the error detection to expansion time. Test case: if false; then echo ${a!7} fi echo OK Old result: dash: Syntax error: Bad substitution New result: OK
* [BUILTIN] Use intmax_t arithmetic in testHerbert Xu2007-10-06
| | | | | This patch adds the function atomax10 and uses it in test(1) so that we support intmax_t comparisons.
* [VAR] Remove setvarsafeHerbert Xu2007-10-06
| | | | | The only user of setvarsafe is getopts. However, we can achieve the same result by pre-setting the value of shellparam.optind.
* [BUILTIN] Treat OPTIND=0 in the same way as OPTIND=1Herbert Xu2007-10-06
| | | | | | | | Previously setting OPTIND to 0 would cause subsequent getopts calls to fail. This patch makes dash reset the getopts parameters the same way as OPTIND=1. Both behaviours are allowed by POSIX but other common shells do tolerate this case.
* [MEMALLOC] Add pushstackmarkHerbert Xu2007-10-06
| | | | | | | | This patch gets rid of the stack mark tracking hack by allocating a little bit of stack memory if we're at risk of planting a stack mark which may be grown later. To do this a new function pushstackmark is added which lets the user pick a bigger amount to allocate since some users do that anyway after setting a stack mark.
* [MEMALLOC] Made grabstackblock an inline wrapper for stallocHerbert Xu2007-10-05
| | | | | The function grabstackblock is identical in semantics to stalloc within its input constraints.
* [PARSER] Size optimisations in parameter expansion parserHerbert Xu2007-10-04
| | | | | | | Merge flags into subtype. Do not write subtype out twice. Add likely flag on ${ vs. $NAME. Kill unnecessary (and bogus) PEOA check.
* [PARSER] Fix parsing of ${##1}Herbert Xu2007-10-04
| | | | | | | | | | | | | | | | | Previously dash treated ${##1} as a length operation. This patch fixes that. Test case: set -- a echo ${##1}OK Old result: 1OK New result: OK
* [BUILD] Add --enable-static option to configure.Alexey Gladkov2007-10-04
| | | | Add new option to build statical linked dash.
* [PARSER] Recognise here-doc delimiters terminated by EOFHerbert Xu2007-09-26
| | | | | | | | | | | | | | | | | | | | | | | | Previously dash required a <newline> character to be present in order for a here-document delimiter to be detected. Allowing EOF in the absence of a <newline> to play the same purpose allows some intuitive scripts to succeed. POSIX seems to be silence on this so this should be OK. Test case: eval 'cat <<- NOT test NOT' echo OK Old result: test NOTOK New result: test OK
* [EXPAND] Refresh stack pointers after makestrspace in _rmescapesRoy Marples2007-09-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | dash-0.5.3 has an issue reading some line lengths [1]. This is reproducable on amd64, but not on other arches for some reason. $ cat bug.sh (read line; echo "${line%%=*}") <<EOF TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx EOF printf "\ TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx " | (read line; echo "${line%%=*}") $ bash bug.sh TITLE TITLE $ dash bug.sh TITLE=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx TITLE Attahced is a patch to fix the issue Thanks Roy [1] http://bugs.gentoo.org/show_bug.cgi?id=180680
* [MAN] Clarify syntax of the for commandGerrit Pape2007-09-25
| | | | | | | | Document that in a for loop 'in word ...' is optional, and if omitted, 'in "$@"' is used. Lars Wilke noticed this, and reported through http://bugs.debian.org/387441
* [MAN] Clarify description of -nt, -ot options to test builtinGerrit Pape2007-09-25
| | | | | | | | | Have the man page explicitely state how the test builtin behaves on -nt and -ot options if file2 does not exist. The case where file1 does not exist was already documented properly. This was noticed by Sven Mueller and reported through http://bugs.debian.org/373611
* [EXPAND] Move parse-time quote flag detection to run-timeHerbert Xu2007-09-25
| | | | | | | | | | | | | | | | | | | | Because the parser does not recursively parse parameter expansion with respect to quotes, we can't accurately determine quote status at parse time. This patch works around this by moving the quote detection to run-time where we do interpret it recursively. Test case: foo=\\ echo "<${foo#[\\]}>" Old result: <\> New result: <>
* [EXPAND] Do not expand tilde in parameter expansion within quotesHerbert Xu2007-09-25
| | | | | | | | | | | | | | | | | | | | | | | Previously code was added so that tilde expansion was carried out parameter expansions within double quotes. This change was made with reference the behaviour of bash at the time. Bash has since be fixed so that this behaviour no longer occurs which is in line with most other POSIX shells. So this patch removes that behaviour in dash as well. Test case: unset a echo "${a:-~root}" Old result: /root New result: ~root
* [PARSER] Remove arithmetic expansion collapsing at parse timeHerbert Xu2007-09-24
| | | | | | | | | | | | | | | | | | | Collapsing arithmethc expansion is incorrect when the inner arithmetic expansion is a part of a parameter expansion. Test case: unset a echo $((3 + ${a:=$((4 + 5))})) echo $a Old result: (4 + 5) New result: 9
* [PARSER] Remove superfluous dblquote settings when ending arithHerbert Xu2007-09-24
| | | | | | When an arithmetic expansion terminates and we restore the syntax to the previous one, we don't need to set dblquote because we never changed upon entering the arithmetic expansion.
* [PARSER] Remove superfluous arinest test for dqvarnestHerbert Xu2007-09-24
| | | | | | dqvarnest is only used to determine whether CENDQUOTE should terminate the double-quote syntax. Since CENDQUOTE can never occur while arinest is set, we don't need to take arinest into account for dqvarnest.