tg
f920d94785
add O_BINARY to all open() calls except tty_fd
...
cf. http://svn.netlabs.org/libc/wiki/Faq#Whydoesntreadfdbufsize_of_filereturnsize_of_file
2013-10-09 11:59:30 +00:00
tg
fda010d8de
SECURITY: Unbreak “set +p”, broken by OpenBSD ksh change.
...
TODO: I am seriously considering following Chet and changing
the way this works, by explicitly dropping privs unless the
shell is run with -p. Every other shell does it like mksh,
except Heirloom sh, which on the other hand doesn’t know any
explicit set -p or set +p (though it doesn’t know set +foo
for any foo either).
┌──┤ QUESTION: Do we need the ability to do this:
│ tg@blau:~ $ ./suidmksh -p -c 'whoami; set +p; whoami'
│ root
│ tg
If not, I’m seriously considering to drop set ±p as well,
only parse -p on the command line, with +p being the default,
and dropping FPRIVILEGED.
Thanks to RT for noticing and jilles for initial follow-up
discussion, as well as Chet Ramey for doing the sane/secure
thing instead of following Debian.
2013-08-23 14:07:39 +00:00
tg
bb0b409a9d
improve density of .rodata (with net win on .text size(1)) via better struct packing
2013-08-11 14:57:11 +00:00
tg
ead77623d3
Fix most “set -x” problems (LP#1179287)
...
• “set -x” manually (cmdline too) snapshots fd#2 now
• “set -o inherit-xtrace” introduced; default still enabled
• reverted iodup printing to pre-R45 behaviour
• made Flag(FXTRACE) a proper state machine
2013-07-21 18:47:24 +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
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
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
75a4809a3a
fix remaining signed int nonsense I am aware of
2013-04-26 19:10:58 +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
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
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
f654a3dea4
fix libFirm/cparser -Wsign-compare
2012-12-05 19:38:25 +00:00
tg
cf807eb83a
Add assertions and shuffle code around for LLVM+Clang scan-build.
2012-12-04 01:18:34 +00:00
tg
68c4dae6ef
Rewrite the getn function (again) to fix any remaining issues.
2012-12-04 01:12:11 +00:00
tg
e36075e58d
open distinguishes between >=0 and ==-1 but <-1 is undef, make it error
2012-11-30 17:34:46 +00:00
tg
0ce7dcf856
maybe this makes gcc not bitch… again… anal-retentive arsecompiler…
...
found in opensuse buildservice logs for centos 5
2012-10-22 20:52:47 +00:00
tg
d8662eb228
even more hacks to pass “-O666 -fstrict-overflow -Wstrict-overflow=9 -flto=jobserver” with “gcc version 4.8.0 20120930 (experimental) [trunk revision 191865] (Debian 20120930-1)” ☹ plus make the rtchecks mandatory
2012-10-03 17:24:23 +00:00
tg
167995da22
repair choiceless select builtin
2012-10-03 15:13:34 +00:00
tg
9b7b7f742e
implement ksh93 feature ${ foo;}
2012-07-30 21:37:17 +00:00
tg
6724ba505d
make 'typeset -p' (and soon ${foo@$}) output strings safe for re-entry
...
into AT&T ksh93 (that we still must use octal, in this day and age,
because dgk’s \x is broken… tss…)
not round-trip, as ksh93 doesn’t encode hi-bit7 or \v, but safe
2012-07-20 21:18:45 +00:00
tg
4778a2a62f
lesson learned from http://k1024.org/~iusty/blog/entry/perf-null/ – add -DMKSH_SMALL_BUT_FAST which gives more speed (8/20K less cycles, 5/9K less insns, 1.8/2.4k less branches, 65/275 less branch misses) on Debian/amd64 (klibc-static/eglibc) at cost of 0/2 more page faults and 6K/6K more text size
2012-07-01 15:55:00 +00:00
tg
cbeac6b381
disable mksh feature -T in lksh
2012-06-26 19:22:19 +00:00
tg
ea8f29f428
sprinkle CONSERVATIVE_FDS for many older OSes; DISABLE_TTY_WARNING for BeOS and Coherent (probably more to come); NO_CMDLINE_EDITING to Plan 9; put Hurd NO_PATH_MAX into MKSH__ private namespace
2012-05-05 17:37:44 +00:00
tg
64447e738d
my own over-optimisation prevents me from making the MKSH__NO_SYMLINK
...
case as nice as it could be, since part of the “if (0) {” case is jumped
into for the first run of the loop… thanks RT
2012-05-05 15:10:39 +00:00
tg
fef3808126
more symlink(7) nonexistence support code
2012-05-04 22:05:02 +00:00
tg
401116766b
generalise the skipping sete{u,g}id() case for Coherent, not just BeOS
2012-05-04 21:57:38 +00:00
tg
5780bc5eb7
new MKSH_NO_CMDLINE_EDITING to disable command line editing in its entirety
...
mainly for the Plan 9 port though it may also help the WinAPI variant,
other porting efforts, as well as a new project I cannot say yet
2012-05-04 20:49:08 +00:00
tg
7c4bf78446
move bi_getn from misc.c to funcs.c and make it static
...
even antique gcc versions will usually inline it now
2012-05-04 20:08:25 +00:00
tg
4a89ae1cd0
drop the need for strcasestr: just uppercase a copy and compare with uppercased
2012-04-06 12:59:28 +00:00
tg
c30bf73a56
BeOS has no tty nor uid/gid other than 0, a̲n̲d̲ a broken /bin/sh
2012-04-01 16:55:16 +00:00
tg
64afff52c1
winstonw made me discover there is no ELOOP in Plan 9:
...
http://plan9.bell-labs.com/sources/plan9/sys/include/ape/errno.h
2012-03-26 20:04:05 +00:00
tg
24e8a6996b
always keep x_cols and x_lins valid; check once at start including tty init
...
if we find any, but not later; do not check on every read
⇒ allows changing COLUMNS and LINES (independent of each other, or both)
for script shells by passing them in an environment setting, even if
we get a tty; interactive shells still check before each line is read…
reported by the PLD guys, thanks
2012-03-23 21:58:24 +00:00
tg
3795e667c5
drop use of the NOT macro, [^foo] ≠ [!foo] anyway, and we’re not gonna change that
2012-03-23 20:07:13 +00:00
tg
c06e3979a8
I hate having to do those year bumps…
2012-01-04 22:38:33 +00:00
tg
ac29bad3fe
fix regression escaping single-char strings
2012-01-04 19:09:36 +00:00
tg
4af399bd8d
give dumptree an dumpioact helper
2011-12-29 22:54:22 +00:00
tg
24fbbdf31c
-Wpointer-sign
2011-12-03 00:03:25 +00:00
tg
da83890648
move compile-time assertions out of misc.c(#ifdef DEBUG) into Build.sh
2011-12-03 00:01:28 +00:00
tg
92b60a9a5e
forgotten in cid 1004EA5BF612F516747 to take '\n' presence as $'…' quoting reason
2011-10-26 20:46:16 +00:00
tg
fed31331f4
rename more identifiers with trailing underscores
2011-10-25 22:36:39 +00:00
tg
cd7dab250b
also Xcheck_grow_ may not end with an underscore
2011-10-25 22:25:07 +00:00
tg
3b9ec6c3c4
also emit newline as backslash-n to align with GNU bash (and to keep everything on one line)
2011-10-24 19:40:58 +00:00
tg
5416abb2d0
when printing for-reentry parameter values, use dgk’s $'…' for non-ASCII characters
2011-10-24 19:40:46 +00:00
tg
9782f6b4d1
• access(2) is broken in at least kFreeBSD 9.0 as “modern” OS, so bring
...
back the wrapper code as well as refactor most other code calling it
• apparently, names can’t end in ‘_’ or contain ‘__’ anywhere…
2011-09-07 15:24: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
5d9c88ceeb
jg71 reported -DMKSH_ASSUME_UTF8=* breaks defining stristr
2011-08-27 17:30:07 +00:00
tg
3ef67e3296
replace uses of OAAT hash in all its variants by NZAT (mksh internal) or NZAAT (all others)
2011-07-06 22:22:02 +00:00
tg
6807ce3100
drop long-deprecated 'set ±o arc4random'
2011-06-12 15:37:10 +00:00
tg
c133d423df
ACK found a missing "static", gcc on Minix found a missing cast; add more type size checks
2011-06-12 14:45:34 +00:00