mp; sleep 1; kill $!;wait'
This works correctly even without this patch.
Signed-off-by: Jilles Tjoelker
---
src/eval.c |4 ++--
src/trap.c | 16 +++-
src/trap.h |2 +-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/eval.c b/src/eval.c
index 62d9d5d..e7c
r Korolkov in Ubuntu #422298.
Signed-off-by: Jilles Tjoelker
---
src/expand.c |2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/src/expand.c b/src/expand.c
index 48c45e5..f2f964c 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -210,8 +210,6 @@ expandarg(union node *arg, s
don't have a patch to suggest.
I think this part needs a testsuite before any further changes :)
You could start from the posh or FreeBSD sh testsuites and what's in the
commit messages. Or if you have little programmer time but lots of CPU
time, rebuild all packages in the debian archive
the most common
use of the wait builtin. I can even reproduce the regression with the
test script in 3800d49's commit message: sometimes I see a line *** 148
meaning that the wait builtin was aborted by SIGCHLD (even though no
CHLD trap has been set); however only on an SMP system. (This is on
FreeBS
ot;not in a function");
> +
> argv = argptr;
> while ((name = *argv++) != NULL) {
> mklocal(name);
This change (failing local outside functions), while a good idea, should
be mentioned in the commit message/changelog, as it might break certain
scripts.
(Note that in mksh local is an alias for typeset, 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
x27;local' may need additional magic to avoid making things local 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
sting scripts suggests that traps should not abort a
read. Executing the trap right away is useful in case it does something
such as exiting, and should be safe given that traps are already invoked
from deeper levels of recursion of the interpreter. If the trap executes
a break, continue or return com
ly and ksh93's typeset
are special as well), consensus seems to be for local to be a regular
builtin. posh's local was special for a short time, but this was then
reverted.
Nevertheless, it is very nice to have IFS=: read ... working again.
--
Jilles Tjoelker
--
To unsubscribe from this list:
clear about what '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
M
which is not in any dash release yet.
The patch should apply to older dash versions also.
--
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
posed to work. POSIX says that a non-interactive
shell must not generate pathnames for a redirection; an interactive
shell may do so, provided there is exactly one match.
Dash is primarily meant as a non-interactive shell and wants to be as
small as possible, and therefore never generates pathnames for
stent behaviour with other utilities that do support locales.
For FreeBSD's /bin/sh, which is another ash variant, I think some degree
of locale support (at least for utf-8) is desirable at some point. This
would include changing pattern matching and ${#var}.
I don't know what Herbert Xu
duced the problem. See
git help bisect or
http://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html .
--
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
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 ca
missing here.
> }
> 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 da
On Mon, Aug 16, 2010 at 01:52:56PM +0200, Guido Berhoerster wrote:
> * Jilles Tjoelker [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 co
mporting FreeBSD's code at less than 50. It will also fix an edge
case with the splitting. The last two lines of FreeBSD's
builtins/read1.0 test are:
echo " 1 ,2 3," | { IFS=', ' read a b c; echo "x${a}x${b}x${c}x"; }
echo " 1 ,2 3,,"
On Mon, Aug 23, 2010 at 02:03:01AM +0200, Harald van Dijk wrote:
> On 23/08/10 01:00, Jilles Tjoelker wrote:
> > On Mon, Aug 23, 2010 at 12:20:12AM +0200, Harald van Dijk wrote:
> >>[...]
> >> echo a:b | { IFS=: read a b; echo $a; }
> >>[...]
> >
&g
On Mon, Aug 23, 2010 at 12:40:48PM +0200, Guido Berhoerster wrote:
> * Jilles Tjoelker [2010-08-23 00:32]:
> > If you want to try something, here is a patch. I have verified that the
> > only change to the results of FreeBSD sh's testsuite is that the test
> > builti
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
way to
read these files needs to be documented, and clear violations that will
not work properly should cause an error (in this case, this means that
reading one byte from offset 0 should fail like reading one byte from
offset 1 does).
--
Jilles Tjoelker
--
To unsubscribe from this list: send the
very common construct
while read x; do
...
done
stops working.
A possible fix is to check first if the input supports seeking. If it
does, use the buffering and at the end of the line seek backwards for
the number of bytes remaining in the buffer. If it does not, read one
byte at a time.
--
Ji
On Sat, Sep 04, 2010 at 08:20:33PM +0200, Steve Schnepp wrote:
> 2010/9/3 Jilles Tjoelker :
> > This patch assumes that the file descriptor is discarded afterwards (its
> > position does not matter). Therefore the very common construct
> > while read x; do
> > ...
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).
T
rd}.)
The patch I posted separately fixes the handling of 0x81 and various
other issues with read (by using 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: sen
ll
terminate the process immediately. In any case, if the shell itself gets
an actual SIGSEGV, its state is probably too messed up to continue
executing a script.
--
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
y most kinds of Korn shell and dash. The
latter behaviour is shown by the Bourne shell, most other ash
derivatives, bash and zsh.
A command like
(ulimit -n 10; /bin/foo 3<&- 4<&-; :)
will only work in a shell that uses the latter behaviour.
I consider both behaviours valid and shell
hese were converted to the local
mechanism recently).
The real efficiency benefit of static scoping comes when disallowing
access to locals when the name is not known at compile time: at run
time, the names of the locals are not necessary.
--
Jilles Tjoelker
--
To unsubscribe from this list: se
so nested function definitions
may lead to incorrect line numbers, but that could be fixed.)
I think this patch will increase dash's code size at least a little,
which is always a consideration here. I can also look at getting this
into FreeBSD sh.
Thanks,
--
Jilles Tjoelker
--
To unsubscribe fro
.
Second idea: use a per-word LINENO but somehow ensure it is the same for
all words in a command. I think this is wrong, but perhaps I'm wrong.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@vger.kernel.org
M
ile ksh93 treats it as an incomplete command.)
As for the portable alternative, split up the command. Either put the
'}'-containing thing in a variable and use that as alternative or use an
explicit conditional. The Autoconf documentation has more information,
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
at all, only the EXIT trap.
The cause is that sleep also gets the SIGINT and terminates on it, which
can be seen by removing set -e and adding echo rc=$? after sleep.
ksh93 has a sleep builtin, but this has no effect on above. Behaviour
remains the same with /bin/sleep.
--
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 a/src/red
The backslash prevents the closing brace from terminating the
substitution, therefore it should be removed.
FreeBSD sh test expansion/plus-minus2.0 starts working, no other tests
are affected.
Example:
printf "%s\n" ${$+\}} ${$+"\}"} "${$+\}}"
should print } three times, without backslashes.
--
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; prin
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 +0000, Jilles Tjoelker wrote:
> >>> This discarding is still bad as it thro
of Almquist's additions like this one is certainly questionable;
many of them have been removed. However, setvar has been available and
documented in /bin/sh in all versions of FreeBSD, which makes removal
less likely at this point.
--
Jilles Tjoelker
--
To unsubscribe from this list: sen
he way, I wonder what the advantage of imaxdiv() above separate %
and / is. Compilers can detect the matching between a % b and a / b and
do it in one operation, and any use of imaxdiv() trips gcc's
-Waggregate-return.
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line &
allows 'kill'
without depending on obscure corners of shells.
If your script runs for a long time, use of $! should be paired with
'wait' (either for all $! values obtained or without parameters) so that
the shell can forget about old jobs. Some shells are buggy and remem
ed characters that should not be IFS splitting points,
which is only relevant for WORD in ${VAR+WORD} and ${VAR-WORD}. A
downside of this is that quoted and unquoted CTL* bytes cannot be
distinguished; therefore I have solved this differently in FreeBSD.
--
Jilles Tjoelker
--
To unsubscribe from
On Thu, Mar 10, 2011 at 04:59:27PM +0800, Herbert Xu wrote:
> On Sun, Nov 21, 2010 at 02:42:22PM +0100, Jilles Tjoelker wrote:
> > The backslash prevents the closing brace from terminating the
> > substitution, therefore it should be removed.
> >
> > FreeBSD sh test exp
is). This was done
a few years ago when the syntax-error property of special builtins was
implemented, as making a too high shift count fatal caused a configure
script in the FreeBSD base system to fail.
I would not encourage the extension of accepting arithmetic expressions
because that requires a s
On Fri, Apr 15, 2011 at 09:07:09PM +0800, Herbert Xu wrote:
> On Sun, Apr 10, 2011 at 07:18:17AM +, Jonathan Nieder wrote:
> > Jilles Tjoelker wrote[0]:
> > > Regarding sh -c optimization, I am in favour of this. Uselessly waiting
> > > 'sh -c' proc
if /* DEBUG */
Why not just replace the non-standard setlinebuf() call with the
standard setvbuf(tracefile, NULL, _IOLBF, 0); ? This appears to work
just as well on FreeBSD and is C99 compliant (no POSIX needed here).
The #define SMALL is only for disabling line editing and history (using
libedi
h other awk invocations, it seems more usual
to use NR rather than FNR. They both do the same thing if there is only
one input file.
The nl utility has caused more portability problems already; the code in
master has different options. This is so even though nl is in SUSv4
under the XSI option. We alr
evalskip = 0;
+ if (skip == SKIPFILE)
+ evalskip = 0;
break;
}
}
Using
evalskip &= ~SKIPFILE;
instead of
if (skip == SKIPFILE)
evalskip = 0;
should also work and might genera
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.
>
ell is different again, though. It ignores the
assignments completely and does not even expand them (a
y=${someunsetvar?} assignment is silently ignored).
--
Jilles Tjoelker
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majord...@
.
The fix is to use printf(1) instead of echo(1) if there is a possibility
the string 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.
one or more
processes they know are part of the job in this case, 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
kipping the shell if the command is
simple enough) and particularly for dash for historical/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 oc
On Sun, Feb 26, 2012 at 01:31:55AM +1100, Herbert Xu wrote:
> On Sat, Feb 25, 2012 at 03:30:04PM +0100, Jilles Tjoelker wrote:
> > Most shells pass the environment variable through, such as bash,
> > zsh, ksh93 and most ash derivatives. However, the original Bourne
> > shell
less.
Dash had this behaviour for some time but it was dropped again because
of inconsistencies between implementations.
However, there appears to be some sort of agreement on how it should
work now:
http://austingroupbugs.net/view.php?id=351
(scroll down to note 943).
--
Jilles Tjoelke
If there is an error in a command substitution
that is normally not executed, most shells (except ash derivatives) will
not notice this.
For example, FreeBSD 9.0's sh is one of the few shells that detects the
error in:
if false; then `fi`; fi
--
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
> Are you suggesting that wait should always be used in a loop? With what
> check exactly?
Only if you have set any 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
--
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
alled because of CHLD traps should remain
unchanged. The former seems safest because SA_RESTART handlers still
cause visible effects such as short writes.
In case of a script doing 'trap "" CHLD', it is perhaps undesirable for
"wait" to block forever, given that wait(2) doesn't do that either.
--
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
), its
usability goal makes that it has many non-mandatory features. You may
like posh which attempts to comply to Debian policy only, even at the
cost of usability.
--
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
gree with some of the choices I have made where POSIX (as
modified by interpretations) is silent.
The mksh, a shell from a different lineage, also has a good set of test
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://vger.kernel.org/majordomo-info.html
eptable that an interactive sleep command cannot be
^Z'ed.
--
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
check the return value from setuid()
and similar functions. In particular, some versions of Linux may fail
setuid() for [EAGAIN], leaving the process running with the same
privileges.
--
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
etting CPU
time often enough, this may legitimately happen if the loop contains a
read builtin. In FreeBSD sh, I added a check for zombies before forking
the first process of a background job. Some other shells call waitpid()
or similar from a SIGCHLD handler; this reaps zombies faster at the cos
with pathnames starting with '-', containing backslashes or ending with
newlines.
In a script you might do
set -- foo-*.tar.gz
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
echo "Bad wildcard"
exit 2
fi
tar -xzf "$1"
--
Jille
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 majordomo info at http://vger.kernel.org/majordomo-info.html
id to be a "character string";
this may be a C'ism (meaning that it is not a wide character string).
Note that a "byte" in POSIX terminology is a "character" in C standard
terminology. I think the former is less ambiguous in general and should
be the preferred ter
o, but it can be
found back through git history.
Alternatively, you could rely on the linker combining common string
constant endings: put in some #define for
"/usr/sbin:/usr/bin:/sbin:/bin" and make defpathvar a #define instead of
a const array.
--
Jilles Tjoelker
--
To unsubscribe from t
}
> +
> + return c;
> +}
> +
>
>
> /*
This implementation of pgetc_eatbnl() does not allow pushing back a
backslash, since that would call pungetc() twice without an intervening
pgetc(). However, some places do attempt to push back a backslash. As a
result, a script fi
stitution in PS4 (POSIX does
not require it anyway). It is treated as a syntax error.
Talking about syntax errors, dash has a problem there as well. If there
is a syntax error in PS4 and set -x is enabled, it will not execute any
simple commands (assignments to PS4 cause an error a
course, be done in a myriad of other ways, but this one just seemed like
> the most elegant to me. Whether this counts as a "need" or not is not for
> me to say.
> Personally I'd say the main argument for adding support for "$_" to dash
> would be to avoid my
> So either way, I think something should change. But if you prefer to get
> clarification first about the intended meaning of the POSIX wording,
> that certainly seems reasonable to me.
I think the POSIX wording is clear enough, but it may not be desirable
to change getopts to work
The result is ok when running dash -c '. ./alias1.sh' but a command
not found error message when running ksh93 -c '. ./alias1.sh'.
Similarly, a string as passed to the -c option or eval or trap builtins
may or may not be parsed fully before execution.
--
Jilles Tjoelker
-
t;
> That doesn't seem to work either (in dash or bash).
eval foobarbaz
This may not be practical since it needs to be done for every alias use.
--
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
() or lstat() is always wrong, since
the inode number may not fit in a non-largefile ino_t. This happens in
various cases: test -ef/-nt/-ot, 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 w
v ; echo "<$v>" ; }'
correctly prints .
Since dash has its own code for read's splitting, it is not possible to
take a fix from NetBSD or FreeBSD sh, other than by replacing the
splitting code completely with their version.
--
Jilles Tjoelker
--
To unsubscribe from this
On Wed, Feb 24, 2016 at 01:07:44AM +0300, Oleg Bulatov wrote:
> trying to minimize a shell code I found an unobvious moment with
> heredocs and subshells.
> Is it specified by POSIX how next code should be parsed? dash output
> for this code differs from bash and zsh.
> --- code
> prefix() { sed
ot of memory. The memory is freed when the
function returns.
This could be fixed by adding a check before making a variable local but
that might make functions with many distinct locals slower.
Also note that the problem does not occur if local is used at the top of
a function only, as recommended b
of these methods
to reset getopt().
However, removing the dependency on this feature is simple. The shell
already features a function nextopt() that can be used to parse options
and is automatically set up for builtins.
>From 23da600dcff616662a93f307420d9142598e2cae Mon Sep 17 00:00:00 2001
Fro
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
> Date: Thu, 4 Aug 2016 17:51:12 +0200
> Subject: [PATCH 1/2] [HISTEDIT] Stop depending on getopt reset feature.
>
e that the current standard forbids 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,
cause all characters following it in the
arguments to be ignored (so not only in the argument where \c occurs).
For example:
echo 'a\cb' c; echo d
shall write "ad" followed by a newline.
--
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
d to say.
Looking at as simple code 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
theref
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
> &g
$b"
> > You can imagine... not everything went well here...
> Again, this is probably down to legitimate differences in the
> notoriously unportable "echo" builtin. Test this using printf instead.
Seems like it.
> > ash-vars/var_unbackslash.tests
> ITYM ash-vars/var_unbackslash1.tests
> > echo Forty two:$\
> > (\
> > (\
> > 42\
> > )\
> > )
> > dash says: Syntax error: Missing '))'
> Yes, but it's not clear to me that it shouldn't.
> Hmm... maybe this is indeed a bug:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_01
> "A that is not quoted shall preserve the literal value of
> the following character, with the exception of a . If a
> follows the , the shell shall interpret this as
> line continuation. The and shall be removed before
> splitting the input into tokens. Since the escaped is removed
> entirely from the input and is not replaced by any white space, it
> cannot serve as a token separator."
> So, unless I'm misreading this, it looks like backslashes need to be
> parsed before *any* other kind of lexical analysis.
Yes, for sequences that are not quoted.
For example, contains
two characters between the quotes, not zero.
--
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
system call
> It seems to be the same case for mksh, ksh93, posh, pdksh. Not that it
> matters though.
Blocking is intended behaviour when opening a fifo without a
counterparty. It can be used to good effect for synchronizing processes,
sometimes even without transferring any data.
--
Jilles
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.
--
Jilles Tjoelker
--
To unsub
n64 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 process can easily do
those t
7;s definition.
This check might cause a terse script with binary to fail to execute,
but I have not received bug reports about that.
Stopping the check with a \n will cause a PNG header to be considered
text.
Also, FreeBSD sh uses O_NONBLOCK when opening the file and pread() to
read the data, in
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
irly formal
style of man pages avoids contractions, 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
this bug is caused by not distinguishing between
+/-/=/? 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#'*'}"
correct
ded,
I strongly 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
what they do because
> they're not doing this optimisation. 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
defini
gotsigchld)
> + dowait(jp ? DOWAIT_BLOCK : DOWAIT_NORMAL, jp);
> if (!jp)
> return exitstatus;
> st = getstatus(jp);
Now each of the first four executable lines of waitforjob() does
something different for jp == NULL and jp != NULL. It probably makes
more
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
lt;
This 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);
>
>
if (c == '\n')
> + 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
e
important than making the executable as small as possible, but the
maintainer may not agree.
--
Jilles Tjoelker
mination, 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
-existent-file
Time-of-check-time-of-use issues should not be an issue for config
files.
Alternatively, one could try
command . ./non-existent-file || true
but this may ignore more errors than desired (such as syntax errors in
the sourced file) and does not work correctly in yash 2.30.
--
Jilles Tjoelker
shell does not support the
option, it exits.
The 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
1 - 100 of 105 matches
Mail list logo