Commit Graph

132 Commits

Author SHA1 Message Date
tg b7332de28c a bit oksh-inspired getn return value checking, plus some code optimisation 2015-04-19 14:40:09 +00:00
tg a1ba509bb9 oksh RCSID sync: we use mksh getn() instead of OS strtonum() which is just as safe (audited right now) 2015-04-19 14:23:26 +00:00
tg 8546943535 KNF 2015-03-01 16:02:48 +00:00
tg e3acd9c76a MFC everything except the igli-inspired changes to jobs.c and the
.Ox Ns -inspired integer base changes .
That means: bugfixes, plus the new arguments to exec (feature)
2015-03-01 15:43:09 +00:00
tg 06045cf889 more IRC deliberation with igli (let’s hope the “const” works), plus style advice from Kernighan’s writs 2015-02-20 13:08:28 +00:00
tg 5efc48befd optimise a bit (nuke one redundant check), from igli via IRC 2015-02-20 12:43:22 +00:00
tg 2f52b993a1 • Build.sh: fix NSIG detection for gcc-snapshot
• all: bump version to R50-current; add more comments; whitespace
• all: remove all mkssert(); we’ll do full re-runs of scan-build and,
  hopefully, Coverity Scan/Prevent
• check.t: fix a testcase (sed could exit false, but we don’t care)
• eval.c: fix tilde_ok data type (only unsigned may shl constantly)
• exec.c: fix shebang buf array accesses to always go via uint8_t *
2014-11-25 21:13:31 +00:00
tg 78580b4eef use symmetric #ifdef checks for same-feature (Debian #763842) 2014-10-03 12:32:48 +00:00
tg 73edeaa8ec fix “set -o pipefail” w/o PIPESTATUS, and PIPESTATUS inside COMSUBs and other sequences 2014-06-10 22:17:10 +00:00
tg 6217904193 detect getsid(2), also spotted by RT, this on MSYS 2013-11-30 17:41:35 +00:00
tg 2e7509548a integrate latest changes from oksh: Wed Sep 4 15:49:19 2013 UTC by millert
Add a proper suspend builtin that saves/restores the tty and pgrp
as needed instead of an alias that just sends SIGSTOP.  Login shells
may be suspended if they are not running in an orphan process group.
2013-09-10 17:33:04 +00:00
tg 8352fc78d3 apply patch from Steffen Daode Nurpmeso to use WCONTINUED waitpid(2) 2013-09-10 16:51:17 +00:00
tg 472bc350b5 TGIF, drinking-beer, Sysadmin Appreciation Day commit:
• As requested by Steffen Daode Nurpmeso, enlarge the
  amount of command characters shown in job handling
2013-07-26 20:33:24 +00:00
tg 8256f266ff fix a number of warnings and other issues:
• sig_t detection was a bit insane, it is a function-pointer type after all
• fix uninitialised variable in c_select which led to mistakenly accepting
  invalid (nōn-numeric) input and acting, randomly, upon it
• keep SIGCHLD blocked in child after forking longer, for job list manip
• block SIGCHLD ifdef DEBUG_LEAKS to not run job foo during/after afreeall
• fix annoying ISO C90 vs. C99 (un)signed constant warning
2013-06-02 03:09:17 +00:00
tg d16705415a -Wunused-macros 2013-06-01 20:34:01 +00:00
tg d5eda34c8b j_sigchld may also run outside of interrupt context, so better save errno 2013-05-31 23:59:07 +00:00
tg ff42a866e9 implement set -o pipefail 2013-05-02 20:28:15 +00:00
tg 7cce9de0bc one can’t cast an unsigned int to a signed int portably either, if the value
is larger than the positive range of the latter (implementation-defined), so
avoid them in all explicit cases and rearrange stuff and check for it

(I’m gonna have to revise lots more code…)
2013-04-01 02:37:53 +00:00
tg b2396677e7 harmonise sys_{sig,err}list ⓐ checks, ⓑ uses, ⓒ _decl values when not needed, ⓓ prototypes; ⓔ “const” is a keyword and thus space-separated from the preceding ‘*’ pointer indicator 2012-12-28 02:28:39 +00:00
tg 12c662b6e2 thanks to ISC (Interactive) Unix, we now know a few samples of errnos
that get used, plus one for the realpath-1 regression test; also make
sys_siglist_decl detection nicer and poison strerror() with non-const
return value ifdef DEBUG, make it always const
2012-12-17 23:18:11 +00:00
tg cf807eb83a Add assertions and shuffle code around for LLVM+Clang scan-build. 2012-12-04 01:18:34 +00:00
tg 77c4cb88e4 implement tty tracking and bump to R41 for feature completeness
• tty_fd is now never closed
• new tty_hasstate tracks tty_state (cf. thread around
  http://article.gmane.org/gmane.os.miros.mksh/79 and PLD bug)
• as users requested, importing COLUMNS or LINES from the environment
  now removes its special-ness as does unsetting it
• otherwise, setting COLUMNS or LINES is honoured until the next SIGWINCH
  arrives or change_winsz is otherwise run (e.g. before displaying the
  prompt in the interactive command line editing modes)
• SIGWINCH is now honoured before each reading of $COLUMNS and $LINES too
• change the Uhr to match – it no longer calls stty(1) ☺
2012-11-30 19:25:08 +00:00
tg 730bc915bd tty_close() before exec() is not necessary, it’s FD_CLOEXEC anyway
only tty_close() left are now after the early init in main, which
is new, and when not FTALKING…
2012-11-30 19:20:01 +00:00
tg 80e364b7ad use proper parenthesēs; int → bool; use same var (eno) for temp. errno 2012-11-30 19:02:10 +00:00
tg 27387673a4 new MKSH_DISABLE_TTY_WARNING for ports that just can’t help it
TODO: add_cppflags this automatically in the TARGET_OS switch for some
2012-05-04 22:34:51 +00:00
tg e6ace01f12 last parts of Coherent patchkit: O_ACCMODE and termio 2012-05-04 22:18:27 +00:00
tg 893ff18d59 fix typo; 10x RT for spotting 2012-05-04 21:48:29 +00:00
tg b67de6ba17 add experimental code to use sigprocmask+pause+sigprocmask ipv sigsuspend (and harden j_sigchld handler for that) to improve working on BeOS 5.0 and Coherent UNIX, found by RT 2012-04-27 16:16:23 +00:00
tg c7c8637e63 let struct proc allocate 64 chars even on !ILP32 platforms
(don’t fragment memory that much)
2012-02-06 17:49:52 +00:00
tg 929bc9ee9e make jobs reporting deal with UTF-8 (in utf8-mode)
reported by Andrew Kudryashov, 10x
2012-02-06 17:42:24 +00:00
tg 18dc21bd85 clang3 says: Branch condition evaluates to a garbage value 2011-12-31 00:52:22 +00:00
tg 577c918beb patch most of Jerker Bäck’s concerns out, unless not applicable 2011-08-27 18:06:52 +00:00
tg f51883e350 eek, only be a ksh_nice if we HAVE_NICE 2011-07-16 23:37:58 +00:00
tg 0168f6dc48 some distributions declare nice(3) with warn-unused-result; annoy mksh users running into this so they complain to their distros 2011-07-16 17:41:50 +00:00
tg 45cd3a340b this is about the amount -Wl,--gc-sections can help me to eliminate 2011-04-22 12:21:55 +00:00
tg 2a3d4db123 lint is your friend 2011-03-13 01:20:25 +00:00
tg 1f392ab09b • more fixes (some regression, some new)
• more testcases, stricter testcases
2011-03-06 17:08:14 +00:00
tg 0b57abd4d3 • add -u option (POSIX: unbuffered ⇒ nop) to the built-in cat
• PIPESTATUS now supported (like bash 2) whose last member
  may actually differ from $? since the latter may not be the
  result of a pipeline partial command
• add regression tests, documentation, etc.
2011-02-18 22:26:13 +00:00
tg bdfcdc56c8 introduce MKSH_NOPROSPECTOFWORK which is like pdksh’s JOB_SIGS in reverse, like MKSH_UNEMPLOYED is pdksh’s JOBS in reverse; allows mksh to work (hah! no pun intended…) with klibc (and possibly, Syllable Desktop and Plan 9) for now, until they fix their bugs 2011-01-30 01:35:35 +00:00
tg cc31d86e3b • implement KSHEGID, KSHGID, KSHUID variables by suggestion of Richard K.
(KSHEUID aka USER_ID already exists)
• simplify, speed up LCG and $RANDOM handling again
2011-01-21 21:04:48 +00:00
tg 06c6be0a70 shave off another 468 bytes: we’re 300 bytes smaller than BEFORE the
cat builtin was added now… (also removed utf-8 from source files, in
favour of just ASCII)
2010-08-28 20:22:24 +00:00
tg 3747722db4 improve string pooling: saves 316 bytes in .text 2010-08-28 18:50:58 +00:00
tg 4e08a79555 whitespace 2010-08-28 15:48:20 +00:00
tg 4cbb5a9d46 to speed up mksh, get rid of arc4random(3) uses and use the LCG always;
depend on ASLR for seeding
2010-07-04 17:33:58 +00:00
tg 2d6b4acba1 simplify a bunch of things (no SIGWINCH handler, errno is saved for
an shtrap automatically) and gratitutous reformatting of comments
2010-07-04 13:36:43 +00:00
tg c413edb34a jobs.c: apply patch from deraadt@o:
│remember to restore errno (ie. stop someone from making a mistake later)
│ok guenther
check.t, sh.h: bump vsn

I wonder though why errno must be restored even if nothing was
called after reading it… moid?
2009-12-31 14:05:44 +00:00
tg 769e222586 re-vamp __attribute__ handling; let this pass on HP-UX bundled compiler
as well as HP aCC
2009-12-12 22:27:10 +00:00
tg c49852b4dc Revision 1.38: [7]download - view: [8]text, [9]markup, [10]annotated - [11]select for diffs
Sat Dec 12 04:28:44 2009 UTC (13 hours, 14 minutes ago) by deraadt
   Branches: [12]MAIN
   CVS tags: [13]HEAD
   Diff to: previous 1.37: [14]preferred, [15]coloured
   Changes since revision 1.37: +2 -3 lines
a dangling do / while that was very very ugly
2009-12-12 17:45:42 +00:00
tg df51db99c9 another Valgrind würgaround 2009-12-05 22:03:39 +00:00
tg 09b96b8fc7 25 is a better (POSIX) CHILD_MAX 2009-11-22 14:14:42 +00:00