fix some of the signal stuff (still didn’t get rid of awk(1) and printf(1)

calls in Build.sh, we need HOSTCC for that… which we should do, using BER
or something encoded for integers, and pregenerated hashtables as planned)

also, bump to R50 beta, due to today’s language changes
This commit is contained in:
tg 2014-06-09 13:25:53 +00:00
parent 129ba5c584
commit 7330970bfa
7 changed files with 50 additions and 34 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.659 2014/05/27 13:41:53 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.660 2014/06/09 13:25:49 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014
@ -1782,7 +1782,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.659 2014/05/27 13:41:53 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.660 2014/06/09 13:25:49 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (isatty(0)); }
EOF
case $cm in
@ -2247,6 +2247,9 @@ if test 0 = $HAVE_SYS_SIGNAME; then
#define NSIG (SIGMAX+1)
#elif defined(_SIGMAX)
#define NSIG (_SIGMAX+1)
#else
/* XXX better error out, see sh.h */
#define NSIG 64
#endif
#endif
int
@ -2265,9 +2268,9 @@ mksh_cfg= NSIG
test $printf = echo || test "`printf %d 42`" = 42 || printf=echo
test $printf = echo || NSIG=`printf %d "$NSIG" 2>/dev/null`
$printf "NSIG=$NSIG ... "
sigs="INT SEGV ABRT KILL ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL"
sigs="$sigs INFO IO IOT LOST PIPE PROF PWR QUIT RESV SAK STOP SYS TERM"
sigs="$sigs TRAP TSTP TTIN TTOU URG USR1 USR2 VTALRM WINCH XCPU XFSZ"
sigs="ABRT FPE ILL INT SEGV TERM ALRM BUS CHLD CONT HUP KILL PIPE QUIT"
sigs="$sigs STOP TSTP TTIN TTOU USR1 USR2 POLL PROF SYS TRAP URG VTALRM"
sigs="$sigs XCPU XFSZ INFO WINCH EMT IO DIL LOST PWR SAK CLD IOT RESV"
test 1 = $HAVE_CPP_DD && test $NSIG -gt 1 && sigs="$sigs "`vq \
"$CPP $CFLAGS $CPPFLAGS $NOWARN -dD conftest.c" | \
grep '[ ]SIG[A-Z0-9][A-Z0-9]*[ ]' | \
@ -2305,7 +2308,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c
addsrcs USE_PRINTF_BUILTIN printf.c
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
add_cppflags -DMKSH_BUILD_R=499
add_cppflags -DMKSH_BUILD_R=500
$e $bi$me: Finished configuration testing, now producing output.$ao

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.133 2014/05/27 13:22:42 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.134 2014/06/09 13:25:50 tg Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014
@ -38,24 +38,24 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
-DHAVE_ATTRIBUTE_UNUSED=1 -DHAVE_ATTRIBUTE_USED=1 \
-DHAVE_SYS_TIME_H=1 -DHAVE_TIME_H=1 -DHAVE_BOTH_TIME_H=1 \
-DHAVE_SYS_BSDTYPES_H=0 -DHAVE_SYS_FILE_H=1 \
-DHAVE_SYS_MKDEV_H=0 -DHAVE_SYS_MMAN_H=1 \
-DHAVE_SYS_PARAM_H=1 -DHAVE_SYS_RESOURCE_H=1 \
-DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SYSMACROS_H=0 \
-DHAVE_BSTRING_H=0 -DHAVE_GRP_H=1 -DHAVE_LIBGEN_H=1 \
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CNTL=1 -DHAVE_GETRUSAGE=1 \
-DHAVE_GETSID=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_KILLPG=1 \
-DHAVE_MEMMOVE=1 -DHAVE_MKNOD=0 -DHAVE_MMAP=1 -DHAVE_NICE=1 \
-DHAVE_REVOKE=1 -DHAVE_SETLOCALE_CTYPE=0 \
-DHAVE_LANGINFO_CODESET=0 -DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 \
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=499
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=500
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
CPPFLAGS+= -I.
COPTS+= -std=c89 -Wall

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.pl,v 1.35 2014/01/25 22:45:49 tg Exp $
# $MirOS: src/bin/mksh/check.pl,v 1.36 2014/06/09 13:25:50 tg Exp $
# $OpenBSD: th,v 1.1 2013/12/02 20:39:44 millert Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011,
@ -912,7 +912,7 @@ eval_exit
} else {
$expr = $expect;
$expr =~ s/\b([wse])\b/\$$1/g;
$expr =~ s/\b(SIG[A-Z0-9]+)\b/&$1/g;
$expr =~ s/\b(SIG[A-Z][A-Z0-9]*)\b/&$1/g;
}
$w = eval $expr;
if ($@ ne '') {
@ -1164,7 +1164,7 @@ read_test
print STDERR "$prog:$test{':long-name'}: expected-exit value $val not in 0..255\n";
return undef;
}
} elsif ($val !~ /^([\s<>+-=*%\/&|!()]|\b[wse]\b|\bSIG[A-Z0-9]+\b)+$/) {
} elsif ($val !~ /^([\s<>+-=*%\/&|!()]|\b[wse]\b|\bSIG[A-Z][A-Z0-9]*\b)+$/) {
print STDERR "$prog:$test{':long-name'}: bad expected-exit expression: $val\n";
return undef;
}

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.650 2014/06/09 11:16:06 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.651 2014/06/09 13:25:50 tg Exp $
# OpenBSD src/regress/bin/ksh updated: 2013/12/02 20:39:44
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -27,7 +27,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R49 2014/05/27
@(#)MIRBSD KSH R50 2014/06/09
description:
Check version of shell.
stdin:
@ -36,7 +36,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R49 2014/05/27
@(#)LEGACY KSH R50 2014/06/09
description:
Check version of legacy shell.
stdin:

View File

@ -5,7 +5,7 @@
/*-
* Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
* 2010, 2011, 2012, 2013
* 2010, 2011, 2012, 2013, 2014
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.255 2014/05/27 13:22:44 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.256 2014/06/09 13:25:52 tg Exp $");
#if HAVE_KILLPG
/*
@ -1357,8 +1357,10 @@ c_kill(const char **wp)
for (; wp[i]; i++) {
if (!bi_getn(wp[i], &n))
return (1);
#if (NSIG < 128)
if (n > 128 && n < 128 + NSIG)
n -= 128;
#endif
if (n > 0 && n < NSIG)
shprintf("%s\n", sigtraps[n].name);
else

View File

@ -3,7 +3,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012
* 2011, 2012, 2014
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -27,7 +27,7 @@
#include <sys/file.h>
#endif
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.133 2013/10/09 11:59:28 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.134 2014/06/09 13:25:53 tg Exp $");
Trap sigtraps[NSIG + 1];
static struct sigaction Sigact_ign;
@ -977,6 +977,7 @@ inittraps(void)
trap_exstat = -1;
/* Populate sigtraps based on sys_signame and sys_siglist. */
/*XXX this is idiotic, use a multi-key/value hashtable! */
for (i = 0; i <= NSIG; i++) {
sigtraps[i].signal = i;
if (i == ksh_SIGERR) {

16
sh.h
View File

@ -169,9 +169,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.686 2014/05/27 13:22:45 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.687 2014/06/09 13:25:53 tg Exp $");
#endif
#define MKSH_VERSION "R49 2014/05/27"
#define MKSH_VERSION "R50 2014/06/09"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -342,9 +342,19 @@ struct rusage {
#define NSIG (SIGMAX+1)
#elif defined(_SIGMAX)
#define NSIG (_SIGMAX+1)
#else
# error Please have your platform define NSIG.
#define NSIG 64
#endif
#endif
/* get rid of this (and awk/printf(1) in Build.sh) later */
#if (NSIG < 1)
# error Your NSIG value is not positive.
#unset NSIG
#define NSIG 64
#endif
/* OS-dependent additions (functions, variables, by OS) */
@ -523,7 +533,7 @@ char *ucstrstr(char *, const char *);
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
#endif
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 499)
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 500)
#error Must run Build.sh to compile this.
extern void thiswillneverbedefinedIhope(void);
int