Herbert Xu [Sat, 26 Nov 2005 03:15:04 +0000 (26 14:15 +1100)]
Release 0.5.3.
Herbert Xu [Mon, 14 Nov 2005 10:20:36 +0000 (14 21:20 +1100)]
[BUILTIN] Fix \c spillage across echo commands
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.
Herbert Xu [Sun, 13 Nov 2005 11:05:18 +0000 (13 22:05 +1100)]
[BUILTIN] Always call conv_escape_str in echocmd
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.
Herbert Xu [Sun, 13 Nov 2005 10:15:19 +0000 (13 21:15 +1100)]
[MEMALLOC] Remove unnecessary truncation in _STPUTC
Using char in the function argument causes unnecessary truncation to occur.
This patch changes it to an int.
Herbert Xu [Fri, 4 Nov 2005 11:39:28 +0000 (4 22:39 +1100)]
[HELPER] Use mktemp if tempfile is not available
tempfile(1) is Debian-specific so let's use mktemp(1) as a fallback.
Herbert Xu [Sat, 29 Oct 2005 22:10:10 +0000 (30 09:10 +1100)]
[JOBS] Fixed support for disabling job control
Since nobody has compiled with JOBS turned off for quite a while, it has
bit-rotted. This patch makes it build again.
Herbert Xu [Sat, 29 Oct 2005 13:48:05 +0000 (29 23:48 +1000)]
[SYSTEM] Fixed fallback stpcpy implementation
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.
Herbert Xu [Sat, 29 Oct 2005 12:11:56 +0000 (29 22:11 +1000)]
[SYSTEM] Added out-of-line ctypes functions for klibc
Unfortunately klibc doesn't provide out-of-line versions of ctypes
functions such as isalpha. This is a nasty hack to create them.
Herbert Xu [Sat, 29 Oct 2005 11:47:28 +0000 (29 21:47 +1000)]
[SYSTEM] Include system.h for stpcpy in nodes.c
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.
Herbert Xu [Sat, 29 Oct 2005 11:43:45 +0000 (29 21:43 +1000)]
[SYSTEM] Added dummy sysconf implementation
Add a dummy sysconf implementation that always fails for klibc.
Herbert Xu [Sat, 29 Oct 2005 11:08:08 +0000 (29 21:08 +1000)]
[BUILTIN] Removed standalone/csh support from test
Let's remove the support for standalone support from test for the same
reason as printf.
Herbert Xu [Sat, 29 Oct 2005 11:04:27 +0000 (29 21:04 +1000)]
[SYSTEM] Added dummy strtod implementation
klibc doesn't have strtod or atof. So add an implementation that
always fails by setting the end pointer to the input string.
Herbert Xu [Sat, 29 Oct 2005 10:46:35 +0000 (29 20:46 +1000)]
[BUILTIN] Removed standalone/csh support from printf
The support for standalone/csh printf only serves to complicate
maintainence.
Herbert Xu [Sat, 29 Oct 2005 10:42:02 +0000 (29 20:42 +1000)]
[SYSTEM] Added default definition for SSIZE_MAX
klibc doesn't define the macro SSIZE_MAX.
Herbert Xu [Sat, 29 Oct 2005 10:30:57 +0000 (29 20:30 +1000)]
[BUILTIN] Disable histcmd completely when SMALL is defined
Now that mkbuiltins correctly disabled histcmd we don't need the dummy
histcmd implementation anymore.
Herbert Xu [Sat, 29 Oct 2005 08:24:12 +0000 (29 18:24 +1000)]
[BUILTIN] Disable ulimit if there is no getrlimit
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.
Herbert Xu [Sat, 29 Oct 2005 11:21:02 +0000 (29 21:21 +1000)]
[SIGNAL] Added default implementation of killpg
klibc doesn't have killpg. Since we only call it for valid values of
pid, we can call kill instead.
Herbert Xu [Sat, 29 Oct 2005 11:39:47 +0000 (29 21:39 +1000)]
[SIGNAL] Added default implementation of strsignal
klibc doesn't have strsignal but it does have sys_siglist.
Herbert Xu [Sat, 29 Oct 2005 06:29:22 +0000 (29 16:29 +1000)]
Added missing system.h inclusion for mempcpy
All users of mempcpy must include system.h.
Herbert Xu [Sat, 29 Oct 2005 06:23:08 +0000 (29 16:23 +1000)]
Fixed gcc 4.0 compilation problems
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.
Herbert Xu [Sat, 29 Oct 2005 06:01:07 +0000 (29 16:01 +1000)]
[EXPAND] Added getpwhome as a wrapper for getpwnam
klibc doesn't have and doesn't need getpwnam. This change creates
getpwhome which always returns NULL if getpwnam doesn't exist.
Herbert Xu [Sat, 29 Oct 2005 05:17:47 +0000 (29 15:17 +1000)]
[SYSTEM] Added default implementation of bsearch
Added impelmentation of bsearch since klibc doesn't have it yet.
Herbert Xu [Sat, 29 Oct 2005 04:31:40 +0000 (29 14:31 +1000)]
Use stat if stat64 does not exist
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.
Herbert Xu [Sat, 29 Oct 2005 04:03:32 +0000 (29 14:03 +1000)]
[BUILTIN] Stop using sysexits.h in commandcmd
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.
Herbert Xu [Sat, 29 Oct 2005 04:15:26 +0000 (29 14:15 +1000)]
[SIGNAL] Use bsd_signal if it exists and signal does not
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.
Herbert Xu [Sat, 29 Oct 2005 01:37:42 +0000 (29 11:37 +1000)]
[SIGNAL] Removed use of __P from error.h
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.
Herbert Xu [Sat, 29 Oct 2005 01:26:30 +0000 (29 11:26 +1000)]
Copyright/licence updates and remove all traces of sys/cdefs.h
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.
Herbert Xu [Wed, 26 Oct 2005 10:00:59 +0000 (26 20:00 +1000)]
[INPUT] Size optimisations in preadbuffer()
Added unlikely markers.
Reduced switch coverage.
Removed p since we now erase NULs as soon as we see them.
Use more to store parselleft.
Herbert Xu [Sat, 1 Oct 2005 08:38:09 +0000 (1 18:38 +1000)]
[INPUT] Fix NUL skipping in preadbuffer
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.
herbert [Mon, 28 Mar 2005 10:28:01 +0000 (28 20:28 +1000)]
Added eflag fixes for trap and minusc.
Let evaltree handle traps from cmdloop.
Reset evalskip after minusc is executed.
Stop executing traps once SKIPEVAL is seen.
herbert [Mon, 28 Mar 2005 07:58:55 +0000 (28 17:58 +1000)]
Removed unnecessary inclusion of eval.h from parser.c.
herbert [Mon, 28 Mar 2005 07:53:55 +0000 (28 17:53 +1000)]
Let evaltree handle traps from cmdloop.
herbert [Mon, 28 Mar 2005 07:43:32 +0000 (28 17:43 +1000)]
Handle SKIPEVAL in read_profile by exiting.
herbert [Mon, 28 Mar 2005 04:34:53 +0000 (28 14:34 +1000)]
Removed unnecessary inclusion of main.h from eval.c.
herbert [Mon, 28 Mar 2005 04:13:59 +0000 (28 14:13 +1000)]
Generalise setinputfile for use in read_profile/readcmdfile.
herbert [Mon, 28 Mar 2005 03:47:02 +0000 (28 13:47 +1000)]
Removed some unnecessary inclusions of input.h.
herbert [Fri, 25 Mar 2005 12:39:14 +0000 (25 23:39 +1100)]
Turn evalskip into a bit field.
This allows SKIPEVAL and SKIPFUNC to coexist which is needed for eval return 1.
herbert [Fri, 25 Mar 2005 09:23:55 +0000 (25 20:23 +1100)]
Eliminate first null termination in setvar.
pape [Fri, 25 Mar 2005 09:20:52 +0000 (25 20:20 +1100)]
Add trailing equal sign in setvar for variables set to null.
herbert [Fri, 25 Mar 2005 09:19:19 +0000 (25 20:19 +1100)]
Get rid of duplicate -g -O2 in CFLAGS.
herbert [Fri, 25 Mar 2005 07:09:43 +0000 (25 18:09 +1100)]
Cleaned up src/Makefile.am.
gilles.chanteperdrix [Fri, 25 Mar 2005 06:57:32 +0000 (25 17:57 +1100)]
Fixed support for cross-compilation.
herbert [Thu, 3 Mar 2005 11:05:03 +0000 (3 22:05 +1100)]
Do not clobber exit status in dotcmd.
herbert [Thu, 3 Mar 2005 10:52:11 +0000 (3 21:52 +1100)]
Removed redundant setstackmark from dotcmd.
herbert [Thu, 3 Mar 2005 10:46:35 +0000 (3 21:46 +1100)]
Removed qflag.
herbert [Wed, 2 Mar 2005 11:14:54 +0000 (2 22:14 +1100)]
Invert return value of test_eaccess and rename it to test_st_mode.
herbert [Wed, 2 Mar 2005 10:34:22 +0000 (2 21:34 +1100)]
Eliminate duplicate stat in test_eaccess.
herbert [Wed, 2 Mar 2005 10:20:19 +0000 (2 21:20 +1100)]
Optimised FILGZ test.
herbert [Wed, 2 Mar 2005 08:59:26 +0000 (2 19:59 +1100)]
Enclose abort insode ifdef DEBUG.
herbert [Wed, 2 Mar 2005 08:46:59 +0000 (2 19:46 +1100)]
Renamed error to sh_error.
herbert [Mon, 28 Feb 2005 11:02:49 +0000 (28 22:02 +1100)]
Normalise input in likely/unlikely macros.
herbert [Mon, 28 Feb 2005 10:47:22 +0000 (28 21:47 +1100)]
Removed expcmd built-in.
herbert [Mon, 28 Feb 2005 10:32:52 +0000 (28 21:32 +1100)]
Only set skipcount for break and continue.
herbert [Mon, 28 Feb 2005 10:14:16 +0000 (28 21:14 +1100)]
Update funcnest atomically.
herbert [Mon, 28 Feb 2005 10:06:29 +0000 (28 21:06 +1100)]
Replaced EXEVAL with SKIPEVAL.
agcosta [Mon, 28 Feb 2005 10:03:49 +0000 (28 21:03 +1100)]
Corrected that/than typo in manual page.
herbert [Fri, 25 Feb 2005 12:16:05 +0000 (25 23:16 +1100)]
Optimise away status and case statement in main().
herbert [Fri, 25 Feb 2005 12:04:59 +0000 (25 23:04 +1100)]
Eliminated global exerrno.
herbert [Fri, 25 Feb 2005 11:51:38 +0000 (25 22:51 +1100)]
Only reread exitstatus on EXEXIT in exitshell.
herbert [Fri, 25 Feb 2005 11:13:05 +0000 (25 22:13 +1100)]
Do not clobber exit status on EXEVAL.
herbert [Fri, 25 Feb 2005 10:48:59 +0000 (25 21:48 +1100)]
Size optimisations with state/s in main().
agcosta [Fri, 25 Feb 2005 10:18:34 +0000 (25 21:18 +1100)]
Corrected grammar in manual page.
herbert [Fri, 25 Feb 2005 10:15:30 +0000 (25 21:15 +1100)]
Catch set -e exits within built-in commands.
herbert [Fri, 25 Feb 2005 09:49:13 +0000 (25 20:49 +1100)]
Changed boolean rootshell into shlvl counter.
herbert [Mon, 31 Jan 2005 10:20:27 +0000 (31 21:20 +1100)]
Release 0.5.2.
TAG: v0.5.2
pape [Mon, 31 Jan 2005 10:19:54 +0000 (31 21:19 +1100)]
Corrected manual entry about ENV and non-interactive shells.
herbert [Mon, 31 Jan 2005 10:15:42 +0000 (31 21:15 +1100)]
Removed debian files.
pape [Tue, 23 Nov 2004 21:09:28 +0000 (24 08:09 +1100)]
Spell behaviour consistently in manual page.
agcosta [Tue, 23 Nov 2004 11:06:14 +0000 (23 22:06 +1100)]
Fixed spelling errors in manual page.
herbert [Sat, 21 Aug 2004 00:07:12 +0000 (21 10:07 +1000)]
Fixed signed char promotion in src/expand.c.
herbert [Sat, 21 Aug 2004 00:01:16 +0000 (21 10:01 +1000)]
Size optimisations around varvalue() in src/expand.c.
herbert [Wed, 18 Aug 2004 11:24:11 +0000 (18 21:24 +1000)]
Fixed expansion when leading argument is null in src/expand.c.
herbert [Sat, 7 Aug 2004 03:48:42 +0000 (7 13:48 +1000)]
Allow negative pid argument to kill(1) in src/jobs.c.
herbert [Wed, 4 Aug 2004 10:46:34 +0000 (4 20:46 +1000)]
Fixed cd - when OLDPWD is unset.
herbert [Tue, 20 Jul 2004 11:10:38 +0000 (20 21:10 +1000)]
Include system.h.
Herbert Xu [Mon, 26 Sep 2005 08:32:28 +0000 (26 18:32 +1000)]
Initial import.