summary refs log tree commit diff
path: root/src/TOUR (unfollow)
Commit message (Collapse)Author
2007-05-12[REDIR] Fix redirect restore on saved file descriptorsHerbert Xu
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.
2007-05-12[REDIR] Remove redundant CLOEXEC callsHerbert Xu
Now that we're marking file descriptors as CLOEXEC in savefd, we no longer need to close them on exec or in setinputfd.
2007-05-12[REDIR] Replace copyfd by savefd and use dup2 elsewhereHerbert Xu
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.
2007-05-06[EVAL] Use dup2 instead of copyfd in evalbackcmdHerbert Xu
Since we know that dup2 must succeed here we can call it directly.
2007-05-06[REDIR] Remove EMFILE special caseHerbert Xu
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.
2007-05-06[PARSER] Remove unnecessary inclusion of redir.hHerbert Xu
2007-05-05[PARSER] Fix typo in commentHerbert Xu
The value for CTLBACKQ | CTLQUOTE is now -123, not 133.
2007-04-28[BUILTIN] Fix mkbuiltin sort orderHerbert Xu
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.
2006-10-22[BUILTIN] Fixed command -v segmentation faultHerbert Xu
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.
2006-10-13[SYSTEM] Check return code for getgroups and fwriteAlexey Gladkov
Check getgroups() and fwrite() return code, required to build with -D_FORTIFY_SOURCE=2.
2006-10-04[EXPAND] Fixed inverted char class matchingHerbert Xu
The return value of ccmatch was being treated as 0 or 1 but it's actually zero or non-zero. This broke inverted character class matching. Reported by Alexander Skwar.
2006-05-23[BUILD] Added --with-libedit option to configureAlexey Gladkov
Add to the configure.ac new option: --with-libedit - Compile with libedit support.
2006-04-23[PARSER] Only use signed char for syntax arraysHerbert Xu
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.
2006-03-29[PARSER] Use alloca to get rid of setjmpHerbert Xu
Now that the only thing protected by setjmp/longjmp is the saved string, we can allocate it on the stack to get rid of the jump.
2006-03-29[PARSER] Removed useless parsebackquote flagHerbert Xu
The parsebackquote flag is only used in a test where it always has the value zero. So we can remove it altogether.
2006-01-12[EVAL] Make eval with empty arguments return 0 Herbert Xu
On Tue, Jan 10, 2006 at 10:56:23AM +0000, Gerrit Pape wrote: > tags 347232 + patch > quit > > On Mon, Jan 09, 2006 at 04:29:19PM +0100, Marco Nenciarini wrote: > > The problem is here: > > > > # Set the kernel 2.6 option only for fresh install > > test -z "$(GetMenuOpt "kopt" "")" && kopt_2_6="root=$root_device_2_6 ro" > > > > # Extract options for specific kernels > > eval $(ExtractMenuOpts "\(kopt_[a-zA-Z0-9_]\+\)") > > > > If the first test fails and the eval argument is empty then dash > > terminate with exitcode 1. > > > This is a simple testcase: > > tm:~# bash -c "set -e ;/bin/false && : ; eval ''; echo 'END'"; echo $? > > END > > 0 > > tm:~# dash -c "set -e ;/bin/false && : ; eval ''; echo 'END'"; echo $? > > 1 > > > > if you insert any command with successfull exit status before the > > empty eval, all work ok: > > tm:~# bash -c "set -e ;/bin/false && : ; : ; eval ''; echo 'END'"; echo $? > > END > > 0 > > tm:~# dash -c "set -e ;/bin/false && : ; : ; eval ''; echo 'END'"; echo $? > > END > > 0 > > Yes, I can confirm this is a bug in dash. The standard says > > EXIT STATUS > > If there are no arguments, or only null arguments, eval shall > return a zero exit status; otherwise, it shall return the exit > status of the command defined by the string of concatenated > arguments separated by <space>s. > > Hi Herbert, please see http://bugs.debian.org/347232 Changed evalstring to return the exit status instead of evalskip. This allows us to return zero if the string is empty.
2005-11-26Release 0.5.3.Herbert Xu
2005-11-14[BUILTIN] Fix \c spillage across echo commandsHerbert Xu
On Thu, Nov 03, 2005 at 07:16:53PM +0100, Mike Hommey wrote: > Here is a simple test case: > > #!/bin/dash > echo test\\ test > echo '\c' > echo test\\ test > > it outputs: > test\ test > test\ > > This is due to mis-usage of a global variable. See attached patch for a > fix. Instead of setting rval when \c is detected, this is now set in the return value of conv_escape_str. This prevents the spillage reported in http://bugs.debian.org/337294.
2005-11-13[BUILTIN] Always call conv_escape_str in echocmdHerbert Xu
Instead of calling conv_escape_str when we detect a backslash we will call it unconditionally. This helps get rid of some unnecessary code in echocmd.
2005-11-13[MEMALLOC] Remove unnecessary truncation in _STPUTCHerbert Xu
Using char in the function argument causes unnecessary truncation to occur. This patch changes it to an int.
2005-11-04[HELPER] Use mktemp if tempfile is not availableHerbert Xu
tempfile(1) is Debian-specific so let's use mktemp(1) as a fallback.
2005-10-30[JOBS] Fixed support for disabling job controlHerbert Xu
Since nobody has compiled with JOBS turned off for quite a while, it has bit-rotted. This patch makes it build again.
2005-10-29[SYSTEM] Fixed fallback stpcpy implementationHerbert Xu
The implementation has an off-by-one bug. This results in random memory corruption. In one particular case, it caused certain bits of a function body to go missing.
2005-10-29[SYSTEM] Added out-of-line ctypes functions for klibcHerbert Xu
Unfortunately klibc doesn't provide out-of-line versions of ctypes functions such as isalpha. This is a nasty hack to create them.
2005-10-29[SYSTEM] Include system.h for stpcpy in nodes.cHerbert Xu
Since we have a fallback implementation for stpcpy we can now use it unconditionally in nodes.c.pat. This also fixes a link error with klibc.
2005-10-29[SYSTEM] Added dummy sysconf implementationHerbert Xu
Add a dummy sysconf implementation that always fails for klibc.
2005-10-29[BUILTIN] Removed standalone/csh support from testHerbert Xu
Let's remove the support for standalone support from test for the same reason as printf.
2005-10-29[SYSTEM] Added dummy strtod implementationHerbert Xu
klibc doesn't have strtod or atof. So add an implementation that always fails by setting the end pointer to the input string.
2005-10-29[BUILTIN] Removed standalone/csh support from printfHerbert Xu
The support for standalone/csh printf only serves to complicate maintainence.
2005-10-29[SYSTEM] Added default definition for SSIZE_MAXHerbert Xu
klibc doesn't define the macro SSIZE_MAX.
2005-10-29[BUILTIN] Disable histcmd completely when SMALL is definedHerbert Xu
Now that mkbuiltins correctly disabled histcmd we don't need the dummy histcmd implementation anymore.
2005-10-29[BUILTIN] Disable ulimit if there is no getrlimitHerbert Xu
For systems without getrlimit (e.g., klibc) we will disable ulimit. In order to achieve this, builtins.def is now produced by cpp which allows us to use macros such as HAVE_GETRLIMIT in it. Thie also means that we can get rid of the cflags parsing code in mkbuiltins.
2005-10-29[SIGNAL] Added default implementation of killpgHerbert Xu
klibc doesn't have killpg. Since we only call it for valid values of pid, we can call kill instead.
2005-10-29[SIGNAL] Added default implementation of strsignalHerbert Xu
klibc doesn't have strsignal but it does have sys_siglist.
2005-10-29Added missing system.h inclusion for mempcpyHerbert Xu
All users of mempcpy must include system.h.
2005-10-29Fixed gcc 4.0 compilation problemsHerbert Xu
Removed obsolete extern declaration on funcnest. This conflits with the correct static definition. Changed memtodest prototype to use char * instead of unsigned char *. Perform the unsigned char cast inside memtodest instead.
2005-10-29[EXPAND] Added getpwhome as a wrapper for getpwnamHerbert Xu
klibc doesn't have and doesn't need getpwnam. This change creates getpwhome which always returns NULL if getpwnam doesn't exist.
2005-10-29[SYSTEM] Added default implementation of bsearchHerbert Xu
Added impelmentation of bsearch since klibc doesn't have it yet.
2005-10-29Use stat if stat64 does not existHerbert Xu
64-bit file calls such as stat64 don't exist on all architectures for dietlibc, and they don't exist at all for klibc. In those cases the normal calls such as stat are already 64-bit. So simply define stat64 as stat if it doesn't exist. Do the same for all other 64-bit calls as well.
2005-10-29[BUILTIN] Stop using sysexits.h in commandcmdHerbert Xu
This gets rid of the only reference of sysexits.h in dash which is from commandcmd. This is needed for klibc support since it doesn't have sysexits.h. The only uses of sysexits.h in commandcmd is superfluous anyway. In fact, it is overly sensitive about usages such as 'command -vV ls'. By making its behaviour close to that of bash/ksh, we end up saving a bit of space too.
2005-10-29[SIGNAL] Use bsd_signal if it exists and signal does notHerbert Xu
klibc has bsd_signal instead of signal. So we will define signal as bsd_signal if 1) signal does not exist. 2) bsd_signal exists.
2005-10-29[SIGNAL] Removed use of __P from error.hHerbert Xu
This is the only instance of __P in the entire source so it makes sense to get rid of it rather than making it work with klibc.
2005-10-29Copyright/licence updates and remove all traces of sys/cdefs.hHerbert Xu
This change updates the BSD licence to the three-clause version since NetBSD has already done so. This makes dash GPL-compatible. It also adds Christos Zoulas (NetBSD ash maintainer) to the COPYING file. I've added "copyright by Herbert Xu" to most files. Finally all CVS IDs and inclusion of sys/cdefs.h have been removed. The latter is needed for support of klibc.
2005-10-26[INPUT] Size optimisations in preadbuffer()Herbert Xu
Added unlikely markers. Reduced switch coverage. Removed p since we now erase NULs as soon as we see them. Use more to store parselleft.
2005-10-01[INPUT] Fix NUL skipping in preadbufferHerbert Xu
On Sun, Sep 25, 2005 at 07:50:54PM +0000, Gerrit Pape wrote: > On Sat, Sep 03, 2005 at 02:56:00PM +0200, Martin Dickopp wrote: > > When analysing the bug I came to the following conclusion: The loop > > beginning at input.c:302 overwrites a single input line with itself, > > skipping NUL characters. Therefore, after the loop the line buffer > > has less characters than originally read if and only if the input line > > contains NUL characters. > > yes. Thanks a lot for the details and patch. > > > The pointer that is used to read from the buffer, 'parsenextc' (cf. > > input.h:66), is also used as the beginning of the next line in > > input.c:296. This fails if the buffer contains less characters > > than originally read into it due to NUL characters. > > > > The proposed patch (attached) keeps track of the number of skipped > > characters and advances 'parsenextc' accordingly before processing > > the next input line. > > Hi Herbert, please see > http://bugs.debian.org/317516 Instead of moving the characters in the loop, we will do memmove every time we see a NUL character. This hurts if there are a lot of NUL characters, but should be a win in normal situations.
2005-09-26Added eflag fixes for trap and minusc.herbert
Let evaltree handle traps from cmdloop. Reset evalskip after minusc is executed. Stop executing traps once SKIPEVAL is seen.
2005-09-26Removed unnecessary inclusion of eval.h from parser.c.herbert
2005-09-26Let evaltree handle traps from cmdloop.herbert
2005-09-26Handle SKIPEVAL in read_profile by exiting.herbert
2005-09-26Removed unnecessary inclusion of main.h from eval.c.herbert