summary refs log tree commit diff
path: root/ChangeLog (follow)
Commit message (Collapse)AuthorAge
...
* [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.
* [PARSER] Remove superfluous arinest test in CENDQUOTEHerbert Xu2007-09-24
| | | | | If arinest is set then the syntax must be ARISYNTAX. As such CENDQUOTE can never occur while arinest is set so we don't need to test for it.
* [EXPAND] Perform tilde expansion in all parameter expansion wordsHerbert Xu2007-09-24
| | | | | | | | | | | | | | | | | | Previously tilde expansion was not carried out for =?#% expansion words. This is contrary to the POSIX specification. Test case: a=~root:~root echo ${a#~root} Old result: /root:/root New result: :/root
* [EXPAND] Do not quote back slashes in parameter expansions outside quotesHerbert Xu2007-09-24
| | | | | | | | | | | | | | | | Test case: a=/b/c/* b=\\ echo ${a%$b*} Old result: /b/c/* New result: /b/c/
* [BUILTIN] test: little size and speed optimizationsOleg Verych2007-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Speed up (libc=glibc): deen:debian/src/dash-0.5.3# echo $(((7853+8631+7529+9777+9161+7552)/6)) 8417,8250 # this patch deen:/mnt/work/debian/src/dash-0.5.3# echo $(((9553+7789+9450+9925+7595+9590)/6)) 8983 # short deen:debian/src/dash-0.5.3# echo $(( (9655+7853+9733+7826+9618+10053)/6 )) 9123 # '[' ']' deen:debian/src/dash-0.5.3# deen:debian/src/dash-0.5.3# echo $(((9231+9423+9365+9650+8883+8291)/6)) 9140 # unpatched deen:debian/src/dash-0.5.3# * Size down: olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o # this patchset text data bss dec hex filename 4142 0 16 4158 103e src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$ size src/test.o text data bss dec hex filename 4209 0 16 4225 1081 src/test.o olecom@deen:/mnt/debian/src/dash-0.5.3$
* [BUILTIN] test: White space fixesOleg Verych2007-09-22
| | | | Some trailing whitespace was killed or tabified.
* [SHELL] Move flushall to the point just before _exitHerbert Xu2007-09-22
| | | | | | We need to flush at the very end in case we've generated any errors before that. The flushall call cannot perform a longjmp so it's safe there.
* [SHELL] Restore foreground process group on exitHerbert Xu2007-09-22
| | | | | | | | | | | | | | | | | On Thu, Jun 07, 2007 at 12:20:27PM +0200, Denis Vlasenko wrote: > > When I start dash under Midnight Commander and then type 'exit', dash > exits all right, but then MC is sent to background. It happens because > dash does not restore current process group on exit. > > Attached patch fixes this. It also fixes another bug: setjobctl(0) > must ignore tcsetpgrp errors, because there are cases when tty is > destroyed under dash. > > Patch is run-tested. I've fixed this slightly differently so that we don't need the xtcsetpgrp change.
* Release 0.5.4.Herbert Xu2007-07-12
|
* [REDIR] Size optimisations in redir.cHerbert Xu2007-05-12
| | | | | | Add likely flag on REDIR_PUSH. Remove sv check on REDIR_SAVEFD2 (it implies REDIR_PUSH). Optimise NTOFD/NFROMFD same fd check.
* [REDIR] Fix redirect restore on saved file descriptorsHerbert Xu2007-05-12
| | | | | | | | | | | | | | As it stands if a redirection occurs on a file descriptor that was previously closed, it won't be closed after that redirection goes out of effect. This is because we don't keep track of closed file descriptors properly as we do for open ones. This patch fixes this by introducing two new states, CLOSED and REALLY_CLOSED. The first represents an initially closed descriptor which is now open while the second one represents an initally closed descriptor which is now closed. This patch is based on work by Rainer Weikusat.
* [REDIR] Remove redundant CLOEXEC callsHerbert Xu2007-05-12
| | | | | Now that we're marking file descriptors as CLOEXEC in savefd, we no longer need to close them on exec or in setinputfd.
* [REDIR] Replace copyfd by savefd and use dup2 elsewhereHerbert Xu2007-05-12
| | | | | | | There are two kinds of users to copyfd, those that want to copy an fd to an exact value and those that want to move an fd to a value >= 10. The former can simply use dup2 directly while the latter share a lot of common code that now constitutes savefd.
* [EVAL] Use dup2 instead of copyfd in evalbackcmdHerbert Xu2007-05-06
| | | | Since we know that dup2 must succeed here we can call it directly.
* [REDIR] Remove EMFILE special caseHerbert Xu2007-05-06
| | | | | No caller of copyfd need to ignore EMFILE so we can remove the special case and just let it call sh_error on any error.
* [PARSER] Remove unnecessary inclusion of redir.hHerbert Xu2007-05-06
|
* [PARSER] Fix typo in commentHerbert Xu2007-05-05
| | | | The value for CTLBACKQ | CTLQUOTE is now -123, not 133.
* [BUILTIN] Fix mkbuiltin sort orderHerbert Xu2007-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Fri, Feb 16, 2007 at 04:24:55PM -0800, Dan Nicholson wrote: > I was having a problem building dash where `:' wasn't being recognized > as a builtin command. I won't bore you with the details of the > debugging, but it came down to the fact that the generated struct in > builtins.c wasn't being sorted correctly. The ":" name was coming > before the "." name and then was never able to be found by bsearch(). > > The issue turned out to be that I was building with a UTF-8 charset, > causing the `sort' to come out differently from the mkbuiltins script. > When I finally set LANG=C, it came out correct. Here's an example of > the difference. > > $ LANG=C sort << "EOF" > : > . > EOF > . > : > $ LANG=en_US.ISO-8859-1 sort << "EOF" > : > . > EOF > : > . > > My system has glibc-2.3.6, but I also tested it on an RHEL3 server at > work. My solution was just to add LC_ALL=C to the mkbuiltins script. > Maybe it's overkill to use LC_ALL. Patch against HEAD attached. I've changed this patch so that we just set LC_COLLATE for the sort command.
* [BUILTIN] Fixed command -v segmentation faultHerbert Xu2006-10-22
| | | | | | | | | | | | | | | On Sat, Oct 21, 2006 at 02:19:18PM +0000, Gerrit Pape wrote: > Hi Herbert, please see > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=387458 > > On Thu, Sep 14, 2006 at 03:50:02PM +0200, Julien Danjou wrote: > > I just found this bug which is easily reproductible: > > > > % dash -c 'command -v' > > zsh: segmentation fault dash -c 'command -v' Since bash's behaviour is minimalist here, I've decided to adopt its behaviour here as well which is to return success silently.
* [SYSTEM] Check return code for getgroups and fwriteAlexey Gladkov2006-10-13
| | | | | Check getgroups() and fwrite() return code, required to build with -D_FORTIFY_SOURCE=2.
* [BUILD] Added --with-libedit option to configureAlexey Gladkov2006-05-23
| | | | | Add to the configure.ac new option: --with-libedit - Compile with libedit support.
* [PARSER] Only use signed char for syntax arraysHerbert Xu2006-04-23
| | | | | | | | | The existing scheme of using the native char for syntax array indicies makes cross-compiling difficult. Therefore it makes sense to choose one specific sign for everyone. Since signed chars are native to most platforms and i386, it makes more sense to use that if we are to choose one type for everyone.