Commit Graph

2437 Commits

Author SHA1 Message Date
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
tg 0f417614dd ugh, signed >> on negative values is implementation-defined
(but, at least, not undefined, and usually right; regress-test for it)
2013-04-01 01:16:37 +00:00
tg d96c733069 looks like multiplication is also the same between signed and unsigned 2013-04-01 01:02:09 +00:00
tg 6a745a01fa begin using unsigned arithmetics internally as much as possible
(i.e. where signedness doesn’t matter, given -fwrapv) and note
where there’s work to do; note future improvements and additions;
optimise a little

mostly untested
2013-03-31 18:33:13 +00:00
tg ece1b28eaf fix bug in comment 2013-03-31 18:30:05 +00:00
tg c59707edd8 sync clog 2013-03-30 23:31:04 +00:00
tg fc2ec318c1 use nicer (and same as in other places!) error message for typeset 2013-03-30 15:39:36 +00:00
tg 57e4c1a19f catch missing variable names in typeset, to avoid confusing Hugues Moretto-Viry with bogus “read-only” messages 2013-03-30 15:39:26 +00:00
tg 5c2f250abc make "%#s" into print_value_quoted (ignoring field width and precision), if you can get it around gcc’s __printf__ __format__ attribute that is… 2013-03-30 15:39:16 +00:00
tg ea657bd4d9 also do not, ever, use &> bashiop in lksh 2013-03-29 17:33:56 +00:00
tg 41ae60bb55 now that funsub() is a separate function, and we don’t have the clobber
issue from longjmp any more, and that I thought to rewind the fd, finally
implement ${ …;} on deleted-after-open tempfiles without the need to reopen
2013-03-29 17:33:07 +00:00