Commit Graph

2618 Commits

Author SHA1 Message Date
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
tg
24b81b5969 RCSID-only sync: oksh found out about idivwrapv 2013-03-29 16:54:05 +00:00
tg
94dfda0be0 RCSID sync w/ oksh; whitespace (KNF) 2013-03-24 21:34:14 +00:00
tg
a3b5e77c6c disable parsing of &> as GNU bash iop if -o posix or -o sh, based on IRC discussion where jilles(IIRC) pointed out it breaks existing valid scripts 2013-03-24 15:01:50 +00:00
tg
8697048c2c set (but never export!) PS4 to something timestamped by default, as an example 2013-03-24 15:01:35 +00:00
tg
4b2e17b828 • let mksh “set -x” print whole TCOM trees
• plug some memory leaks in debug (“set -x”) and warning paths while here
• one from Florian (friend of Natureshadow) for WTF
2013-03-24 00:56:27 +00:00
tg
d99e470a64 bump 2013-03-05 15:41:41 +00:00
tg
d7c28d90f9 optimise prefer_cols print_columns display 2013-02-24 14:22:44 +00:00
tg
9a8cb6fbf6 why’s there a space before the newline? 2013-02-24 14:10:04 +00:00
tg
817aeb8fdb both mksh(1) and POSIX say: "$@" should always generate multiple words
issue in pdksh reported in IRC by engla, thanks!
2013-02-23 20:03:31 +00:00
tg
74e2ef8b0b one more int → bool; mention “set -o sh” may (on raare OSes) be enabled
automatically (and it differs between targets); test MidnightBSD 0.1 ash
compat code and adjust the testsuite so it passes with it enabled
2013-02-19 18:45:22 +00:00
tg
dffb1ab915 put list of check_categories into Makefrag.inc generated; bump patchlevel 2013-02-18 22:55:40 +00:00
tg
0a3fe06229 another MidnightBSD /bin/sh kludge: classic BSD echo 2013-02-18 22:47:32 +00:00
tg
84189faad4 fix an oversight that allowed invalid variable names to be entered
(not even at an increase in code, as I could just move a check and
slightly adapt it)
2013-02-18 22:24:52 +00:00
tg
576b7f21b3 eval is evil
Proper quoting is hard
Bugs galore
2013-02-17 15:58:26 +00:00
tg
e141cab1ac revert cid 10050DD0C8519194AE9 and 100511FC81525949AF7
AT&T SVR4 broke 'cc -c -o foo.o foo.c' totally

switch to an alternative method of finding out the prototypes
provided in IRC by dalias (thanks); RT says this fixes his
issues on SVR4 – let’s just ignore the ominous message from
cid 1004713D70A5362BACF about needing to be a compile-time
check unless something else pops up, I can’t think of something
that isn’t already covered
2013-02-17 07:06:15 +00:00
tg
e21a2166f7 use a different approach to the $"…" problem:
take the states that may open a string, only permit them by virtue of
moving the code out of Subst: to handle $+" and $+' at all; then add
S[Q]BRACE to that

side benefits:
• clearer, cleaner code flow
• smaller code
• better “business logic” ☺
• defuses one heavy use of duff’s device a bit
2013-02-17 06:05:02 +00:00
tg
b684a7c6bd backpedal with $'…' and $"…" interpolation
it turns out this breaks more legacy scripts than anticipated
2013-02-17 05:40:17 +00:00
tg
47f8a21e3c SVR4 cc doesn’t like -c -o conftest.o when conftest.o already exists:
it errors out with “-o would overwrite conftest.o” (thanks RT for reporting)
2013-02-16 17:55:51 +00:00
tg
85d7059c48 … I fsck’d up and built R42b from MAIN ipv mksh-R42stable… oh well.
TODO: convert enum to something like uint8_t to save even more space
2013-02-16 00:21:57 +00:00