Commit Graph

2447 Commits

Author SHA1 Message Date
tg dd7b17e704 simplify 2013-07-21 18:39:21 +00:00
tg 3bc3e8665a fix postun in not evaluated side of e.g. ternary operator (LP#1187729) 2013-07-21 18:38:56 +00:00
tg bd795a83ae partial merge and full RCS ID sync with oksh
merged:
• new regression tests
• check.pl (tests/th) better tmpfile handling
• exec.c 1.50: POSIX specifies that for an AND/OR list,
  only the last command's exit status matters for "set -e"
• ksh.1 1.147: document the above
• eval.c 1.39: “Make $(< /nonexistent) have the same behaviour
  as $(cat /nonexistent) wrt. errors (do not unwind and do not
  treat this as fatal if set -e is used).”
  ‣ additionally make shf_open() return errno and actually show
    the error message from the system
• regression-39 test: remove the “maybe” marker
  ‣ but decide on correct POSIX behaviour

already been fixed in mksh:
• check.pl (tests/th) exit 1 if tests fail

not merged:
• main.c 1.52: run traps in unwind() before exiting;
  I’m pretty sure this is already working as-should in mksh
• eval.c 1.38: “Commands executed via `foo` or $( bar ) should
  not inherit "set -e" status.” As discussed in IRC, this is
  just plainly WRONG.
2013-07-21 18:36:03 +00:00
tg 80a83f4f0b use ${SIZE-size} for lewellyn’s cross 2013-07-08 10:12:45 +00:00
tg bb4083d649 use ‘z’ shf printf modifier for out-of-memory message, now that we have it 2013-06-03 22:28:33 +00:00
tg 446fdbca3b from oksh: “for var in; do” shouldn’t be interpreted as “for var; do” (POSIX) 2013-06-03 22:28:17 +00:00
tg 8e6b0f712a support n̲o̲t̲ fork(2)ing for -T (by prepending the tty with ‘!’); especially useful on Linux since our own setsid(2) is more annoying; gets rid of the need for oneit_lite and similar hacks; WARNING: also removes chown/chmod on the tty! 2013-06-03 22:28:06 +00:00
tg 4e1196239a RCSID sync with oksh (fixed by us 4 years ago already) 2013-06-03 22:27:42 +00:00
tg 6aa08008b3 replace warnings for sig_t detection 2013-06-03 22:27:15 +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 ec1bc74d41 pull some quoting fixes from oksh; original patch from Alexander Polakov 2013-06-01 00:15:58 +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 49d1ebfb71 Replace wcwidth code by mine based on Unicode 6.2.0 2013-05-31 23:27:14 +00:00
tg 21ee1a8411 prevent indirect recursion loops for namerefs; found by ormaaj, thanks! 2013-05-31 22:47:14 +00:00
tg 407734d305 meh, wrong gcc flag 2013-05-22 19:24:32 +00:00
tg c8a3127ea7 • fix error in warning fix (hah!)
• if GCC add -Wno-deprecated for dietlibc (and others) idiocy
2013-05-22 18:56:50 +00:00
tg 69a6777e42 remove the remark that lksh is not suitable for /bin/sh
(as, on some systems and for some pedants, it may be *better* suited
 due to its broken use of the host C “long” data type for arithmetics)
but warn that this can only work with -DMKSH_BINSHPOSIX really
2013-05-22 18:18:06 +00:00
tg d4bf779c7e also from Sylvestre Ledru’s clang-using Debian buildd, quieten another configure time warning; log before running that /dev/{null,tty} exist (with ls -l, so we see they’re actual devices) 2013-05-08 11:30:45 +00:00
tg a072c63fe8 declare thiswillneverbedefinedIhope to silence some configure time warnings 2013-05-08 11:16:19 +00:00
tg f02f8afe6e • don’t accidentally remove lksh.1 from the srcdir for in-srcdir builds
• fix post-build non-‘-Q’ output for lksh

both discovered in Fedora; thanks rsc
2013-05-05 13:38:00 +00:00
tg 1d0409d932 implement VALSUBs 2013-05-02 21:59:54 +00:00
tg 54a698d564 pimp the hexdump function 'hd' for when there is none 2013-05-02 21:46:29 +00:00
tg ff42a866e9 implement set -o pipefail 2013-05-02 20:28:15 +00:00
tg 0465f0a0de more int → unsigned 2013-05-02 20:23:09 +00:00
tg f0f34eb7b6 • Allow setting both -o posix and -o sh (although only in the same
command; setting one still unsets the other at first)
• Change subst_exstat to be conformant unless -o sh is set and -o posix isn’t
• In lksh, make subst_exstat (newly) conformant if -o posix
• New MKSH_BINSHPOSIX to accompany MKSH_BINSHREDUCED
• Sync lksh manpage precisely
2013-05-02 20:21:45 +00:00
tg f2906c79df for Yofuh: implement Emacs mode PgUp as Vi insert mode CurUp 2013-05-02 15:33:30 +00:00
tg 689c179254 sync and be even more explicit
XXX some day, write the *precise* delta of MKSH_LEGACY_MODE into lksh.1
2013-04-27 19:16:27 +00:00
tg 3674320e2e x_cols is a signed long in lksh; unbreak "set -o" and other print_columns using code 2013-04-27 19:09:13 +00:00
tg 0fb44301ef can test wraparound not in lksh 2013-04-27 18:56:41 +00:00
tg dc94c3d205 after enough complaints by POSIX sh advocates,
• make parsing numbers with leading digit-zero as octal independent of
  mksh/lksh and dependent on set -o posix; adjust manpages to match
• warn about these changes and why mksh uses 32-bit consistent arithmetics
  and point people to lksh for host-long undefined-behaviour arithmetics
• point out, explicitly, that it is *legal* for the operating environment
  to make 'print $((2147483647 + 1))' (on a 32-bit system; adjust for a
  64-bit system) to run 'rm -rf ~ /' instead
2013-04-27 18:50:25 +00:00
tg 496988e27a add lksh manpage formatting support
do not add it as regular mksh manpage, we do not ship lksh
2013-04-27 18:22:47 +00:00
tg c3b93834b0 lksh also reads $ENV so make sure it doesn’t try this one 2013-04-27 18:19:44 +00:00
tg 0634dd5ad2 move mircvs://contrib/hosted/tg/deb/mksh/debian/lksh.1
\ to mircvs://src/bin/mksh/lksh.1
2013-04-27 18:13:58 +00:00
tg 55e9ca460c start next development iteration 2013-04-27 18:12:39 +00:00
tg deb4a3bf20 Oh well… this looks well, is done done, and gcc-snapshot doesn’t complain:
• correct order of built-in commands; use POSIX special versus “all others”
  plus “keeps assignments” as distinction, no longer play POSIX regular vs.
  others game; sync manpage
• fix LP#1156707: map (( internally to “let]” which is no valid function
  name and so can’t be overridden but is unlikely to be used otherwhere
  and not strictly permitted (by POSIX) anyway
• we do not need -Wno-overflow any more, either
• bump to R45
2013-04-26 21:22:50 +00:00
tg d8ce0c480b *** empty log message *** 2013-04-26 19:49:07 +00:00
tg b6f4617dee oops… pasto… restored the wrong backup code…
(I had one that didn’t revert cid 100514E4F1D5C90862C in check.t first…)
2013-04-26 19:47:07 +00:00
tg 5f5393b4f1 and, finally for today, fixup the “set -x” mess I made 2013-04-26 19:40:45 +00:00
tg 5571430281 now get rid of the run-time check, the idivwrapv nonsense, and straighten out lksh 2013-04-26 19:40:09 +00:00
tg 75a4809a3a fix remaining signed int nonsense I am aware of 2013-04-26 19:10:58 +00:00
tg 79a083baaa kill dead code 2013-04-26 18:27:07 +00:00
tg fa0d9fc499 rcsid-only sync with oksh, dropping this functionality:
• mail.c was removed anyway
• we do not use “long long” in mksh, since it’s not in ANSI C89

instead, we probably need some 64-bit ops in the long run, but we can
use some host types (might want to use time_t for tv_sec, but we cannot
print that yet); might need to handle them in some generic manner…
2013-04-26 17:39:30 +00:00
tg d515447e0e work around a workaround in dietlibc that works around brokenness in GNU tar
/* no comment… */
2013-04-26 17:23:15 +00:00
tg 1df3efdb86 another intermediate step/commit to get arithmetics right:
do the correct operations for comparisons (just keep using the
signed/unsigned switch from bivui for them), division (by working
on absolutes and adding the sign at the end), modulo (stupidly by
divising in signed, multiplying and subtracting, to get the sign
of the result right)

also adds rotation

XXX to check: do we need to AND before assigning the result in division?
2013-04-14 13:36:53 +00:00
tg 5a8d3175cb just rcsid-sync oksh; their change was to add /* XXX 2038 */ comment
to $SECONDS (tbh, in 2038 we’ll have more problems than just that,
which is why 64-bit arithmetics, or unlimited-precision ones, are
on the “plans” list)
2013-04-07 14:11:54 +00:00
tg 1a21176cac Tonnerre Lombard’s contribution:
[17:27:44] Tonnerre: csh: alias doch sudo \!-1 bash: alias doch='sudo $(history -p !-1)' zsh: alias doch='sudo $(fc -ln -1)'
[17:28:03] mirabilos: ?
[17:28:34] Tonnerre: Na ganz einfach:
[17:28:36] Tonnerre: % ls /root
[17:28:39] Tonnerre: ls: cannot open directory /root: Permission denied
[17:28:42] Tonnerre: % doch
[17:28:45] Tonnerre: [sudo] password for tonnerre:
[17:28:49] Tonnerre: anaconda-ks.cfg  cgminer-1.6.2-1.rf.src.rpm  rpmbuild  upgrade.log  upgrade.log.syslog
[17:28:53] Tonnerre: %

This is one of two mksh variants; the other uses a tmpfile:
alias doch='sudo mksh -c "${ fc -ln -1;}"'

Both quote correctly, unlike the above.

Maybe use $MKSH instead? (Quoted or unquoted? Hm. Probably quoted.)
Input on that welcome…
2013-04-05 15:39:52 +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 fb3555d7f5 got an SAR, thanks to dalias on IRC 2013-04-01 02:28:35 +00:00
tg e1a4c3ed28 do use val.u on the RHS of a shift 2013-04-01 01:29:47 +00:00