summary refs log tree commit diff
path: root/src/mkbuiltins (follow)
Commit message (Collapse)AuthorAge
* builtin: Default to mktemp, not tempfileAndrej Shadura2018-11-19
| | | | | | | | Don't use tempfile, as it currently runs tempnam(), which is insecure and fails under pseudo(1). Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* shell: Fix build on Solaris 9Jonathan Perkin2016-06-06
| | | | | | | | | | | | | Ensure dash can build in a default Solaris 9 or older environment: - Execute scripts with $SHELL rather than /bin/sh, the latter does not support e.g. "if ! .." used by mkbuiltins. - /bin/awk does not support ?: syntax, use explicit statements instead. - /bin/nl requires no spaces between options and arguments. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* builtin: Clear LC_ALL in mkbuiltinsFredrik Fornwall2015-06-11
| | | | | | | | | | | | | | | | In mkbuiltins LC_COLLATE is set, but since "The value of the LC_ALL environment variable has precedence over any of the other environment variables starting with LC_" (http://pubs.opengroup.org/onlinepubs/7908799/xbd/envvar.html), this has no effect when LC_ALL is set. This breaks when having e.g. LC_ALL=en_US.UTF-8 during make, which causes the test case dash -c : to fail, probably due to broken ordering in builtins.c. The patch corrects that by clearing LC_ALL. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* builtin: create builtins.c properly on old cppkabe@sra-tohoku.co.jp2014-12-26
| | | | | | | | | | Encontered this on ancient gcc-2.95.3 environment; src/builtins.def.in -> src/builtins.def generation emitted ^ $ lines (likely by /* */), which where NOT ignored by src/mkbuiltins and generating bogus builtins.c. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Port to SolarisBrian Koropoff2011-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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>
* [SHELL] Port to AIXBrian Koropoff2011-03-10
| | | | | | | | | | | | | | - 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>
* [BUILTIN] Use TMPDIR in mkbuiltinsmaximilian attems2010-04-02
| | | | | | | | 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>
* [BUILTIN] Add another missing LC_COLLATE to mkbuiltinsMatthew Burgess2009-08-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* [EVAL] Pass EV_TESTED into evalcmdHerbert Xu2009-08-11
| | | | | | | | | | | | | | | | | | This patch fixes the case where the eval command is used with set -e and as part of a construct that should not cause the shell to abort, e.g., as part of the condition of an if statement. This is achieved by propagating the EV_TESTED flag into the evalstring function through evalcmd. As this alters the prototype of evalcmd it is now invoked explicitly by evalbltin. The built-in infrastructure has been changed to accomodate this special case. In order to ensure that the EXIT trap is properly executed this patch clears evalskip in exitshell. This wasn't needed before because of the broken way evalstring worked where it always clears evalskip when called by minusc. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILD] Fixed build on NetBSDAleksey Cheusov2009-01-13
| | | | | | | | | | Hi, I propose to apply the following patch for dash. The problem is alloca.h is absent on many platforms including NetBSD I'm running. Also, NetBSD's version of mktemp doesn't work without temporary filename pattern. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Fix mkbuiltin sort orderHerbert Xu2007-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Fri, Feb 16, 2007 at 04:24:55PM -0800, Dan Nicholson wrote: > I was having a problem building dash where `:' wasn't being recognized > as a builtin command. I won't bore you with the details of the > debugging, but it came down to the fact that the generated struct in > builtins.c wasn't being sorted correctly. The ":" name was coming > before the "." name and then was never able to be found by bsearch(). > > The issue turned out to be that I was building with a UTF-8 charset, > causing the `sort' to come out differently from the mkbuiltins script. > When I finally set LANG=C, it came out correct. Here's an example of > the difference. > > $ LANG=C sort << "EOF" > : > . > EOF > . > : > $ LANG=en_US.ISO-8859-1 sort << "EOF" > : > . > EOF > : > . > > My system has glibc-2.3.6, but I also tested it on an RHEL3 server at > work. My solution was just to add LC_ALL=C to the mkbuiltins script. > Maybe it's overkill to use LC_ALL. Patch against HEAD attached. I've changed this patch so that we just set LC_COLLATE for the sort command.
* [HELPER] Use mktemp if tempfile is not availableHerbert Xu2005-11-04
| | | | tempfile(1) is Debian-specific so let's use mktemp(1) as a fallback.
* [BUILTIN] Disable ulimit if there is no getrlimitHerbert Xu2005-10-29
| | | | | | | | | | 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.
* Copyright/licence updates and remove all traces of sys/cdefs.hHerbert Xu2005-10-29
| | | | | | | | | | | 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.
* Initial import.Herbert Xu2005-09-26