| Commit message (Collapse) | Author | Age |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tim Allen wrote:
> The POSIX specification for the dot command[1] states:
>
> EXIT STATUS
> Returns the value of the last command executed, or a zero exit
> status if no command is executed.
>
> If an empty file is sourced, then "no command is executed"
I agree. Looking through "git log --patch src/main.c", though, I find
v0.5.3~42 (Do not clobber exit status in dotcmd., 2005-03-03), which
appears to have been meant to take care of the following case:
$ cat printstatus.sh
echo $?
$ false
$ . ./printstatus.sh
1
I wonder if the following on top might help (imitating evalcmd)?
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The changeset 55c46b7286f5d9f2d8291158203e2b61d2494420
[BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd
uses CTLESC to prevent field splitting in read(1). However,
it did not escape CTLESC itself in the input stream. This patch
adds the necessary CTLESC characters so that CTLESC isn't corrupted.
Reported-by: Alexey Gladkov <gladkov.alexey@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- AIX lacks a WCOREDUMP macro. It's just used to
append "(core dumped)" to the crash message, so
#ifdef around it.
- For some reason, the nl program on AIX defaults
to not printing line numbers ("-b n"), even though
the spec says it should default to "-b t".
Explicitly pass "-b a" for good measure in mkbuiltins.
Signed-off-by: Brian Koropoff <bkoropoff@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A tilde expansion generates a valid pathname. Splitting it using IFS
either leaves it unchanged or changes it to something unintended.
This fixes FreeBSD sh test expansion/tilde1.0 and does not change the
outcome of the other tests.
This fixes Debian bug #601096.
Example:
IFS=m HOME=/tmp; printf "%s\n" ~
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
| |
Replace noclobberopen() from bash with the FreeBSD code for noclobber
opens.
This also reduces code size by eliminating an unnecessary check.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Sun, Nov 07, 2010 at 04:04:20PM -0600, Jonathan Nieder wrote:
>
> Herbert Xu wrote:
>
> > commit f42e443bb511ed3224f09b4fcf0772438ebdbbfa
> > Author: Herbert Xu <herbert@gondor.apana.org.au>
> > Date: Wed Sep 8 20:07:26 2010 +0800
> >
> > [EXPAND] Fix ifsfirst/ifslastp leak
>
> Another puzzle bisecting to f42e443bb. This one comes from the
> grub-mkconfig script:
>
> $ sh -c 'datadir=/usr/share; pkgdatadir=${datadir}/`cat`' 2>&1 | cat -A
> cat: M-^\^M^F^HM-4^M^F^HM-(^M^F^H: No such file or directory$
> cat: M-(^M^F^H: No such file or directory$
>
> Still reproducible with 016b529. I'll try to find time to look into
> it, but thought you might like to know nevertheless.
This is the symptom of another leak. In this case evalbackcmd
occurs in the middle of an expansion (as it should) but the forked
child never clears the previous IFS state.
This patch adds the missing ifsfree call.
This wasn't as much of a problem as the previously discovered leaks
since all it means is that the child gets to carry around the parent's
expansion state and the child is usually short-lived.
Reported-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
| |
trap.c: In function 'exitshell':
trap.c:354: warning: variable 'status' might be clobbered by 'longjmp' or 'vfork'
Signed-off-by: Maciej Żenczykowski <zenczykowski@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
At some point between ash 0.3.5-11.0.1 and ash 0.3.8-37, Debian
ash stopped using the EXSHELLPROC exception to handle shell
scripts without a magic number.
Remove all remaining references to it to avoid confusion.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The intended semantics of EXEXEC are identical to EXEXIT, so
simplify by using EXEXIT directly.
Functional change: in edge cases (exec within a trap handler),
this causes the exit status from exec not to be clobbered.
For example, without this patch:
$ sh -c 'trap "exec nonexistent" EXIT'; echo $?
exec: 1: nonexistent: not found
0
And with it:
$ sh -c 'trap "exec nonexistent" EXIT'; echo $?
exec: 1: nonexistent: not found
127
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit makes dash exit with return code 127 instead of 2 if
started as non-interactive shell with a non-existent command_file
specified as argument (or a directory), as documented in
http://www.opengroup.org/onlinepubs/009695399/utilities/sh.html#tag_04_128_14
The wrong exit code was reported by Clint Adams and Jari Aalto through
http://bugs.debian.org/548743
http://bugs.debian.org/548687
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
| |
Some errors have exit status values specified by POSIX and it is
therefore desirable to be able to set the exit status at the EXERROR
source rather than in main.c.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
While inspecting some dash scripts on my system, I was surprised to
see that some of them use an open parenthesis at the beginning of case
patterns while that's not mentioned in the manpage. Dash currently is
fine with and without that parenthesis (parser.c:413). The attached
patch documents this feature.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Wed, Aug 11, 2010 at 08:06:16AM +0000, Guido Berhoerster wrote:
>
> with the latest git version of dash trap actions are not
> evaluated in the context of a function.
>
> The following script demonstrates the bug:
> ----8<----
> read_timeout () {
> saved_traps="$(trap)"
> trap 'printf "timed out\n"; eval "${saved_traps}"; return' TERM
> ( sleep $1; kill -TERM $$ ) >/dev/null 2>&1 &
> timer_pid=$!
> read $2
> kill $timer_pid 2>/dev/null
> }
>
> read_timeout 5 value
> printf "read \"%s\"\n" "${value:=default}"
>
> ---->8----
> The return statement in the trap inside the read_timeout function
> does not return from the function but rather exits the script.
>
> With dash 0.5.5.1 it works as expected.
This bug was caused by the SKIPEVAL removal. When the SKIPEVAL
hack was added to improve set -e support in traps, dotrap was
changed to return whether set -e was detected. After the removal
of SKIPEVAL, set -e is now handled through exraise.
However, dotrap still returned a value which is now incorrectly
used to trigger an exraise.
This patch removes the vestigial link between dotrap and exraise.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The commit f42e443bb511ed3224f09b4fcf0772438ebdbbfa
[EXPAND] Fix ifsfirst/ifslastp leak
revealed yet another ifsfirst/ifslastp leak in casematch.
Previously it was hidden because ifsfirst/ifslastp was cleared
unconditionally on entry (which caused the leakage of those
entries).
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
evalcommand always clobbers the exit status in case of an EXEXEC
which means that exec always fails with exit status 2 regardless
of what it actually returns.
This patch adds the missing check for EXEXEC so that the correct
exit status is preserved.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
The new read(1) code fails to handle the last variable correctly if
it happens to be terminated by IFS characters. Those characters
are included in the last variable but they should not be.
This patch fixes this.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As it stands expandarg may return with a non-NULL ifslastp which
then confuses any subsequent ifsbreakup user that doesn't clear
it directly.
What's worse, if we get interrupted before we hit ifsfree in
expandarg we will leak memory.
This patch fixes this by always calling ifsfree in expandarg
thus ensuring that ifslastp is always NULL on the normal path.
It also adds an ifsfree call to the RESET path to ensure that
memory isn't leaked.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
No point in tracing a no longer undeclared "ps->cmd", fixes:
jobs.c: In function \u2018commandtext\u2019:
jobs.c:1192: error: \u2018ps\u2019 undeclared (first use in this function)
jobs.c:1192: error: (Each undeclared identifier is reported only once
jobs.c:1192: error: for each function it appears in.)
Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Git commit 0df96793ef6aa103df228d7dfe56099b7d721a15 "[SHELL] Add
preliminary LINENO support" added the LINENO variable in the middle of
other initialized variables, causing some macros for TERM and HISTSIZE
to break (both of these are only used if libedit support is compiled in,
which is not the case by default).
The breakage is the same as can be seen by setting HISTSIZE=0.
Also add a comment warning about this.
Reported-by: Wez Furlong <kingwez@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Example:
$ dash -c 'set -e; (false); echo here'
here
With this commit, dash exits 1 before echo.
The bug was reported by Stefan Fritsch through
http://bugs.debian.org/514863
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
| |
The notyet code is identical to the current code.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Brian Koropoff reported that the new var patches broke the following
script:
#!/bin/dash
GDM_LANG="bar"
OPTION="foo"
unset GDM_LANG
# OPTION has mysteriously become unset
echo "$OPTION"
He correctly diagnosed this as a result of removing all variables
in the hash chain preceding the one that should be removed in
setvareq.
He also provided a patch to fix this.
This patch is based on his but without keeping the original vpp.
As a result, we now store new variables at the end of the hash
chain instead of the beginning.
To make this work, setvareq/setvar now returns the vp pointer
modified. In case they're used to unset a variable the pointer
returned is undefined. This is because mklocal needs it and
used to get it by assuming that the new variable always appear
at the beginning of the chain.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_12
"A subshell environment shall be created as a duplicate of the shell
environment, except that signal traps set by that shell environment
shall be set to the default values."
Currently the eflag is cleared when forking a subshell, e.g.
$ dash -c 'set -e ; z=$(false;echo foo) ; echo $z'
foo
With this commit the eflag is preserved for subshells, and dash exits 1
before echo.
The problem was reported by Vincent Lefevre through
http://bugs.debian.org/514863
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The recent introduction of SIGCHLD trapping broke read(1) as
each SIGCHLD may cause read(1) to return prematurely. Now if
we did have a trap for SIGCHLD read(1) should actually do this.
However, returning when SIGCHLD isn't trapped is wrong.
This patch fixes this by checking for EINTR and pendingsigs in
read(1).
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
The sigsuspend patch broke wait by making it return after just
one job has completed. This is because we rely on pendingsigs
to signal work and never clear it until waitcmd finishes.
This patch adds a separate gotsigchld for this purpose so we
can clear it before we start waiting.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In other ash variants, a partial implementation of ksh-like cmd >file*
adds and removes CTLESC bytes ('\x81') in redirection filenames,
preserving 8-bit transparency. Long ago, dash removed the code to add
the CTLESC bytes, but not the code to remove them, causing corruption of
filenames containing CTLESC. This commit removes the code to remove the
CTLESC bytes.
The CTLESC byte occurs frequently in UTF-8 encoded non-Latin text.
This bug has been reported various times to Ubuntu and Debian (e.g.
Launchpad Ubuntu #422298). This patch is the same as the one submitted
by Alexander Korolkov in Ubuntu #422298.
Signed-off-by: Jilles Tjoelker <jilles@stack.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In some cases the shell executes a subshell or an external command in
the current process. This is not done if a trap on EXIT has been set, so
that that trap can execute after the subshell or external command has
finished. Extend that check to all traps. (A trap is "set" if a
non-empty command string has been attached to it.)
Improve encapsulation by exporting an accessor function for this and
making the trap array static again.
This is much like FreeBSD SVN r194127, enhanced to apply to subshells
also (see FreeBSD SVN r194774).
Example:
dash -c '{ trap "echo moo" TERM; sleep 3; }& sleep 1; kill $!;wait'
This should print "moo" after 3 seconds.
Example:
dash -c '{ trap "echo moo" TERM; (sleep 3) }& sleep 1; kill $!;wait'
The same.
Example:
dash -c '{ trap "echo moo" TERM; sleep 3; :; }& sleep 1; kill $!;wait'
This works correctly even without this patch.
Signed-off-by: Jilles Tjoelker <jilles@stack.nl>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
| |
Just like the poplocalvar problem recently fixed, redirections
can also be leaked in case of an abnormal exit. This patch fixes
it using the same method as poplocalvar, by storing the previous
redirection state and restoring to that point.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
| |
The null redirect checks were added as an optimisation to avoid
unnecessary memory allocations. However, we could avoid this
completely by simply making the caller avoid making a redirection
unless it is not null.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
The recent cmdenviron removal broke regular utilities by calling
poplocalvars too early. This patch fixes that by postponing the
poplocalvars for regular utilities until they have completed.
In order to ensure that local still works, it is now a special
built-in.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
The new localvar code broke the abnormal exit from functions
and built-ins by not restoring the original localvar state.
This patch fixes this by storing the previous localvar state so
that we always unwind correctly in case of an abnormal exit.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
This patch replaces the cmdenviron mechanism for temporary command
variables with the localvars mechanism used by functions.
This reduces code size, and more importantly, makes the variable
assignment take effect immediately as required by POSIX.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
| |
This patch moves the unsetvar code into setvareq so that we can
no have a pathological case of an unset variable hanging around
unless it has a bit pinning it like VEXPORT.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
When a variable is marked as local, we set VSTRFIXED on its vp
recored. However, poplocalvar never clears this flag for variables
that were unset to begin with. Thus if you ever made an unset
variable local, it would get the VSTRFIXED bit and stick around
forever.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
| |
This patch adds localvars nesting infrastructure so we can reuse
the localvars mechanism for command evaluation.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parse_command_args() returning a **argv pointer with *argv == 0 makes
dash segfault in find_command(). To reproduce run
dash -c 'command --'
With this commit, parse_command_args() returns 0 if *argv is null after
parsing --, and so fixes the subsequent segfault.
Reported by Jonny through http://bugs.debian.org/579543
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
There seems to be a problem with the new version of dash
with job control off. I can't tell if it is just a warning or is a
manifest bug.
usr/dash/trap.c: In function `exitshell':
usr/dash/trap.c:376: warning: suggest braces around empty body in an `if' statement
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eric Blake suggested that we should use faccessat so that ACLs
and other corner cases are handled correctly. This patch does
exactly that.
Note that faccessat doesn't handle ACLs when euid != uid, as
this case is currently implemented by glibc instead of the kernel,
using code similar to the existing dash test.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Wed, Feb 24, 2010 at 10:23:34AM +0000, Peter Kjellerstedt wrote:
>
> there seems to be a problem with the trap implementation in dash
> (tested with 0.5.4 and 0.5.5.1). If I specify a signal which is not
> supported, the shell unconditionally aborts. E.g., I had expected
> the following to print foo (like bash and zsh do):
>
> # dash -c 'trap "echo trap executed" UNKNOWNSIGNAL || echo "foo"'
> trap: 1: UNKNOWNSIGNAL: bad trap
>
> This means I cannot write a construct like the following to take
> advantage of the ERR signal which is present in some shells:
>
> trap "echo ERR trap executed" ERR 2>/dev/null || :
>
> I also checked the POSIX documentation, and quoting from
> http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html
> (exit status): "For both interactive and non-interactive shells,
> invalid signal names [XSI] [Option Start] or numbers [Option End]
> shall not be considered a syntax error and do not cause the shell
> to abort."
This patch replaces sh_error with a outfmt + return 1 in trapcmd
so that these errors are no longer fatal.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
| |
while merging upstream dash in klibc,
noticed that klibc dash had grown that useful feature.
Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
| |
Another change I'm making to the arith code is making || return 0 or 1
only, matching C, POSIX and other shells.
Apart from the compliance issue, it is also bad to expose implementation
details like the exact meaning of 'noeval' to scripts such that they may
come to depend on them.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Tue, Jun 23, 2009 at 10:06:30AM +0000, Nikola Vladov wrote:
> May be this is a bug:
>
> echo XX > uu
> cat <> uu
>
> dash truncates file uu. The open flag O_TRUNC must be removed.
> I'm not 100% shure what POSIX say about: program <> file
Indeed, this is a bug we inherited from NetBSD. This patch removes
the O_TRUNC flag for FROMTO.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Jilles Tjoelker reported that binary operator parsing doesn't
respect operator precedence correctly in the case where a lower-
precedence operator is followed by a higher-precedence operator,
and then by a lower-precedence operator.
This patch fixes this by stopping when we encounter a binary
oeprator with a precedence lower than one that we have already
encountered.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Alexey Gladkov <gladkov.alexey@gmail.com> wrote:
>
> I found another example:
>
> $ tr -d '[:print:]' < /etc/passwd |tr -d '\t\n' |wc -c
> 0
>
> $ dash -c 'while read o p; do printf "[%s] [%s]\n" "$o" "$p"; done <
> /etc/passwd' |tr -d '[:print:]' |tr -d '[:space:]' |wc -c
> 61
>
> bug is not fixed yet :(
This bug is caused by an off-by-one error in the recordregion
call in readcmd. It included the terminating NUL in the region
which causes ifsbreakup to include the string after it for scanning.
Setting the correct length fixes the problem.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Mon, Sep 28, 2009 at 11:00:05AM +0200, Jim Meyering wrote:
> A DEL (0177, dec 127) byte in a here-document would cause dash to
> access uninitialized memory at the end of one of the syntax.c tables,
> since those tables are sized to accommodate a maximum index of
> BASESYNTAX + 126. Make the generated tables one byte larger.
> printf ':<<\\E\n\200y\nE'|./dash
> * src/mksyntax.c (filltable): Use 258, not 257 as the size,
> so that BASESYNTAX(=130) + 127 is a valid index.
> (print): Likewise.
> Don't emit explicit array dimension in declaration.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Tue, Jul 14, 2009 at 09:39:03PM +0000, Eric Blake wrote:
> For the cd command, POSIX 2008 requires that after all pathnames in CDPATH
> have been tested and failed in step 5, then step 6 interprets the directory
> argument relative to PWD. In other words, this demonstrates a bug:
>
> $ dash -c 'cd /tmp; mkdir -p foo; CDPATH=oops; cd foo; echo $?; pwd'
> cd: 1: can't cd to foo
> 2
> /tmp
>
> while bash gets it correct:
>
> $ bash -c 'cd /tmp; mkdir -p foo; CDPATH=oops; cd foo; echo $?; pwd'
> 0
> /tmp/foo
This patch fixes the problem.
Reported-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
| |
Pass correct type to ctype macro.
Signed-off-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On Sat, Aug 15, 2009 at 06:07:16PM +0000, Matthew Burgess wrote:
>
> My system has Coreutils-7.4 compiled with the i18n patch from
> http://cvs.fedoraproject.org/viewvc/devel/coreutils/coreutils-i18n.patch.
>
> Using this to compile dash, when in an en_GB.UTF-8 locale, I get the following error:
>
> if gcc -DHAVE_CONFIG_H -I. -I. -I.. -include ../config.h -DBSD=1 -DSHELL -DIFS_BROKEN -Wall -g -O2 -MT eval.o -MD -MP -MF ".deps/eval.Tpo" -c -o eval.o eval.c; \
> then mv -f ".deps/eval.Tpo" ".deps/eval.Po"; else rm -f ".deps/eval.Tpo"; exit 1; fi
> eval.c: In function ‘evalcommand’:
> eval.c:810: error: ‘EXECCMD’ undeclared (first use in this function)
> eval.c:810: error: (Each undeclared identifier is reported only once
> eval.c:810: error: for each function it appears in.)
> eval.c:812: error: ‘COMMANDCMD’ undeclared (first use in this function)
> make[3]: *** [eval.o] Error 1
>
> This is because the src/mkbuiltins script ends up generating an incomplete
> src/builtins.h file. This, in turn, is caused by 'sort -u -k 3,3' not
> working correctly.
>
> The attached patch fixes/works around things by setting LC_CTYPE=C, thus
> overriding the build environment (in a similar manner to the earlier call to
> 'sort' in that same script).
I've changed it to use LC_COLLATE.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 55c46b7286f5d9f2d8291158203e2b61d2494420 ([BUILTIN] Honor
tab as IFS whitespace when splitting fields in readcmd) introduced
a bug where sometimes garbage would follow the last field preceding
the end-of-line. This was caused by an off-by-one error in the
string length calculation.
This patch fixes the bug.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
| |
Now that eval handles EV_TESTED correctly, we can remove the
SKIPEVAL hack and simply use EXEXIT for set -e.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|