| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
I recently found myself in need to have dash support 'ulimit -r' to
set maximum realtime priority. Attached is a patch that adds the
parameter to the builtin ulimit command and updates the manpage.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Solaris lacks paths.h and the various _PATH_* #defines.
Check for them in configure.ac and fall back on the
usual suspects when they are missing.
- Older Solaris lacks isblank(), and versions that have it
use a macro. Check for the declaration in configure.ac
and fall back on a naive version when missing.
- Older Solaris does not support %jd (intmax_t) in format
strings, but it does support the PRIdMAX macro from inttypes.h.
Do a configure check for PRIdMAX and use it in the code.
If it doesn't exist, define it to "lld" when sizeof(long long)
equals sizeof(intmax_t) as this is more likely to work on
older systems. Otherwise, use "jd" and hope for the best.
- Older Solaris lacks stdint.h, but inttypes.h provides the
same types and works on all platforms I've tried dash on,
so just use it instead.
- Older Solaris doesn't like it when vsnprintf() is passed
a NULL buffer (in violation of the POSIX spec, of course).
Pass a 1-byte dummy buffer instead.
- Solaris lacks tempfile and mktemp programs. Fall back on a
"good-enough" custom function in mkbuiltins.
Signed-off-by: Brian Koropoff <bkoropoff@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new read(1) implementation incorrectly assumes that ifsbreakup
ignores characters escaped by CTLESC. As such it fails to handle
backslashes except for escaping newlines.
This patch makes it use recordregion for every part that isn't
escaped by a backslash.
Reported-by: Jilles Tjoelker <jilles@stack.nl>
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
| |
Pass correct type to ctype macro.
Signed-off-by: Eric Blake <ebb9@byu.net>
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When I try to split fields by tabs, dash doesn't honour multiple tabs
between fields as whitespace (at least that's how I interpret [1],
please correct me if I'm wrong).
#!/bin/sh
# "1\t2\t\t3"
TESTSTRING="1 2 3"
# only "\t"
IFS=" "
echo "$TESTSTRING" | while read p1 p2 p3; do
echo "p1=${p1}, p2=${p2}, p3=${p3}"
done
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|