; 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
was aborted by SIGCHLD (even though no
CHLD trap has been set); however only on an SMP system. (This is on
FreeBSD; I hacked mksignames.c to compile and work, although realtime
signals are missing.)
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body
, which will work
outside functions.)
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
to the
temporary regular-builtin scope. I suppose only functions should induce
scope for 'local', such that things like command eval 'local i' continue
to create a variable local to the function.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message
'command .' should do, but is
very clear that failure to find/read a dot script shall not cause an
interactive shell to exit.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http
the script.
With dash 0.5.5.1 it works as expected.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Mon, Aug 16, 2010 at 01:52:56PM +0200, Guido Berhoerster wrote:
* Jilles Tjoelker jil...@stack.nl [2010-08-15 22:05]:
On Wed, Aug 11, 2010 at 10:06:16AM +0200, Guido Berhoerster wrote:
with the latest git version of dash trap actions are not
evaluated in the context of a function.
I
,,| { IFS=', ' read a b c; echo x${a}x${b}x${c}x; }
These should result in:
x1x2x3x
x1x2x3,,x
bash and ksh93 agree on this. However, dash master prints:
x1x2x3,x
x1x2x3,,x
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord
On Tue, Aug 24, 2010 at 12:51:47AM +0200, Harald van Dijk wrote:
On 23/08/10 21:35, Jilles Tjoelker wrote:
I think you should do what you think is best for the stability of your
product. Because dash releases are not extensively tested, I'd recommend
a trial build of at least a minimal base
On Sat, Sep 04, 2010 at 08:20:33PM +0200, Steve Schnepp wrote:
2010/9/3 Jilles Tjoelker jil...@stack.nl:
This patch assumes that the file descriptor is discarded afterwards (its
position does not matter). Therefore the very common construct
while read x; do
...
done
stops working
This reverts the change to make read use the code from expand.c.
Although read's splitting is similar to the splitting done as part of
word expansions, the differences appear to add more complexity than the
common code saves.
The new code is from FreeBSD (which was originally taken from NetBSD).
separate code instead of trying to use
expand.c). Backslash escaping works too although I have just found some
bugs with corner cases.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http
consider both behaviours valid and shell script that depends on either
of them broken. They both have historical basis and their own advantages
and disadvantages.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
,
for example.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Replace noclobberopen() from bash with the FreeBSD code for noclobber
opens.
This also reduces code size by eliminating an unnecessary check.
---
src/redir.c | 77 +++---
1 files changed, 15 insertions(+), 62 deletions(-)
diff --git
On Wed, Dec 15, 2010 at 12:55:51PM -0600, Jonathan Nieder wrote:
Cristian Ionescu-Idbohrn wrote:
On Sun, 28 Nov 2010, Herbert Xu wrote:
On Sat, Sep 04, 2010 at 07:35:04PM +, Jilles Tjoelker wrote:
This discarding is still bad as it throws away valid data if the open
file description
of accepting arithmetic expressions
because that requires a subtly different kind of arithmetic expression
without octal constants. POSIX is clear that 'shift 010' should shift
ten positions, not eight, while 'shift $((010))' should shift eight
positions.
--
Jilles Tjoelker
--
To unsubscribe from
portability problems already; the code in
master has different options. This is so even though nl is in SUSv4
under the XSI option. We already use awk so that should be safer.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord
On Sat, Jul 09, 2011 at 10:07:30PM +0800, Herbert Xu wrote:
On Sat, Jul 09, 2011 at 03:07:04PM +0200, Jilles Tjoelker wrote:
A fix for dash is below. The dash code is broken in a different way than
the FreeBSD sh code was, but the patched code is pretty much the same.
This makes the above
may start with '-' or contain '\'. In this case,
printf '%s\n' $A
This has been asked/reported more frequently and the answer has been
that it will not be changed.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord
, but dash calls
kill() on a process group that is guaranteed not to exist.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
/compatibility
reasons.
I did something similar to the OP's patch in FreeBSD (SVN r223183):
set and export -p skip variables with invalid names.
Note that this problem cannot occur with readonly -p because only
variables with a proper name can be marked read-only.
--
Jilles Tjoelker
--
To unsubscribe
traps that resume execution of the original
script (i.e. do not exit the process).
Otherwise, if 'wait' is being called without parameters, you can do
something like
until wait; do :; done
If 'wait' is being called with parameters, the required loop is very
complicated.
--
Jilles Tjoelker
.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
shells call waitpid()
or similar from a SIGCHLD handler; this reaps zombies faster at the cost
of more complex code (signal handler performing non-trivial work).
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
). Dash implements the latter
and I think it is more useful.
Note that the two behaviours are indistinguishable if a single simple
command is entered.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More
in the makefile misbehaving only
under Debian (where dash is used as /bin/sh) but not under systems.
Such a principle of least surprise is not a design goal for dash.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord
, but it may not be desirable
to change getopts to work that way.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
, finding a dot script (. special
builtin) and some related to the current directory.
On another note, test -nt/-ot should really compare the nanoseconds
parts as well.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line unsubscribe dash in
the body of a message to majord
On Thu, Aug 04, 2016 at 05:59:08PM +0200, Jilles Tjoelker wrote:
> >From 23da600dcff616662a93f307420d9142598e2cae Mon Sep 17 00:00:00 2001
> From: Jilles Tjoelker <jil...@stack.nl>
> Date: Thu, 4 Aug 2016 17:51:12 +0200
> Subject: [PATCH 1/2] [HISTEDIT] Stop depending on
LL);
> > }
> What happens if open64 fails? How should the child inform the parent
> of this specific error?
In general, you are right, but in the shell's case there is no
difficulty. The error is reported via an error message to stderr and a
non-zero exit status of the command, and the child pr
On Wed, Feb 08, 2017 at 09:02:33AM +0100, Adam Borowski wrote:
> On Tue, Feb 07, 2017 at 11:52:08PM +0100, Jilles Tjoelker wrote:
> > On Tue, Feb 07, 2017 at 09:33:07AM +0100, Adam Borowski wrote:
> > > Both "dash -c foo" and "./foo" are supposed
de as possible, this seems, however, unhelpful.
Since a pattern like *[ should match the literal string *[ in the choice
where brackets that do not introduce a bracket expression are supposed
to disable other special characters and any earlier work on the * is
therefore wrong, implementi
On Fri, Sep 02, 2016 at 10:19:12PM +0800, Herbert Xu wrote:
> On Fri, Sep 02, 2016 at 04:16:31PM +0200, Jilles Tjoelker wrote:
> > Unlike Harald van Dijk's patch, the above patch breaks \c. Per POSIX
> > (XSI option), \c shall cause all characters following it in the
> > ar
rbids special
quoting rules for export and readonly, making this change sooner rather
than later will be helpful to users.
Looking at ChangeLog.O, I can see dash had special quoting rules for
export, readonly and local between 1997 and 2001. They were removed,
basically, because there was no sp
EXIT trap in dash).
You can probably use the exception handling already present in the
function to fix this. Note that ckfree() should only be used while
INTOFF is in effect, both to avoid longjmp'ing out of free() and to
ensure exactly one free in the presence of interruptions and errors.
--
, just like it avoids "you".
The reference to the "later document" can probably be removed as well,
since said document does not exist yet after many years.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
-/=/? and #/##/%/%% varieties in the parser. Not maintaining state for
eacg nesting level makes the parser more elegant, but it is untenable
since there is no way one can parse both "${v+'}" and "${v#'*'}"
correctly without it.
--
Jilles Tjoelker
--
To unsubscribe from this list:
ionale is that pwd
should have been here since long ago (because it is in the list in XCU
2.9.1.1 Command Search and Execution), while the other three are new in
SUSv4tc2.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to ma
ative to hash -r that does not need the XSI
option.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
s negation overflows if result is INTMAX_MIN, leading to undefined
behaviour. Perhaps leave the memtodest call but use STADJUST to remove
the minus sign itself, leaving only the CTLESC or nothing.
> + len++;
> + }
> +
> + len += cvtnum(result);
>
>
ngly recommend quoting it since some shells such as dash do not
implement the special rule for assignment utilities yet.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
They do what they do because
> they have broken POSIX because they always treat backslashes that
> arise from parameter expansion as literal backslashes.
Let's use clear terminology: if it affects behaviour, it is by
definition not an optimization. It is a special case for words not
important than making the executable as small as possible, but the
maintainer may not agree.
--
Jilles Tjoelker
and they are not in the public domain
> like FNV-1a.
> [snip]
> +hashval = (hashval ^ (unsigned char)*p++) * FNV_PRIME;
> [snip]
> +hashval = (hashval ^ (unsigned char)*p++) * FNV_PRIME;
> [snip]
> +hashval = (hashval ^ (unsigned char) *p++) + FNV_PRIME;
I suppose this latter one should be * instead of + as well?
--
Jilles Tjoelker
return 0;
> + }
> + return 0;
> +}
> +
> +
> STATIC void
> tryexec(char *cmd, char **argv, char **envp)
> {
> @@ -162,6 +192,8 @@ repeat:
> execve(cmd, argv, envp);
> #endif
> if (cmd != path_bshell && errno == ENOEXEC) {
> + if (file_is_binary(cmd))
> + return;
> *argv-- = cmd;
> *argv = cmd = path_bshell;
> goto repeat;
--
Jilles Tjoelker
fairly old dash v0.5.9.1 I tried works even differently, writing an
error message (to stderr) followed by a. So it first continues after the
error and then aborts when '.' ends. This seems clearly broken (but I
think things have changed since back then).
--
Jilles Tjoelker
interfaces selectively, so
that the binary could be a bit smaller by avoiding 64-bit numbers where
they were not necessary. Now that the feature "supports files with inode
numbers that do not fit in 32 bits" is considered essential, this
complexity seems unnecessary.
I'm sorry for not providing a patch.
--
Jilles Tjoelker
semaphore or MAP_SHARED mapping might cause
unexpected issues in strange use cases.
A related bug: if fork fails for a command substitution, the pipe
created for reading the command output remains open (two descriptors).
This one is also in dash as well as FreeBSD sh. Throwing exceptions from
forkshell() may not be the best idea.
--
Jilles Tjoelker
On Wed, Dec 23, 2020 at 08:18:24PM +, Harald van Dijk wrote:
> On 21/12/2020 16:24, Jilles Tjoelker wrote:
> > Also, simply entering the command
> > trap "echo TTOU" TTOU
> > in an interactive shell makes it behave strangely. Created jobs
> > immedi
nyway since the shell must perform tcsetpgrp() from the background when
a foreground job has terminated.
What is definitely required, though, is that the shell not read input or
alter terminal settings if it is started in the background (possibly
unless the script explicitly ignored SIGTTOU). This is what the loop
with tcgetpgrp() does.
--
Jilles Tjoelker
round would be to
use that code to construct the attr="$OPTARG" list.
If your actual code is more like:
set -- -a foo -a bar # for testing
while getopts :a: arg; do
...
then the script violates the rule I mentioned, and has unspecified
results.
--
Jilles Tjoelker
52 matches
Mail list logo