which escapes $(…) content does not know if an imbedded ‘#’ is a comment
leader or something else like “16#foo”, “${#bla[*]}”, “${foo#bar}”, &c.
and the comment skip code does not know about nesting beforehand
⇒ document this problem in the place where it already documents that
the current code does not properly handle nested $($(…)) expressions
patches welcome
12:58⎜<gps23:#ksh> someone please tell me why: code=1; if [ "code" -eq 1 ] returns true
13:10⎜<mira|AO:#ksh> hm but I see the problem
13:10⎜<mira|AO:#ksh> code=1; x=code; [ "$x" -eq 1 ]
13:10⎜<mira|AO:#ksh> this is indeed unexpected
13:10⎜«pgas:#ksh» gps23: code=1+1;[ "code" -eq 2 ] && echo true #also works
as of now, we consider
13:13⎜«pgas:#ksh» gps23: when you use -eq there is something like an implicit $(( )) around the
⎜ arguments
13:14⎜«pgas:#ksh» [ code -eq 1 ] is the same as [ $((code)) -eq 1 ]
to be documented.
on Debian Lenny/amd64 (XXX need more verification; this
can be used for 64 bit arithmetics later too)
PPID, PGRP, RANDOM, USER_ID are now unsigned by default
“-sh” if -DMKSH_BINSHREDUCED was passed during compilation, for example
for Debian, but d̲e̲f̲i̲n̲i̲t̲i̲v̲e̲l̲y̲ n̲̲o̲̲t̲̲ for MirBSD™
• split up regression test to force this behaviour
• remove the gunk from our MirBSD™ startup scripts again
• mention arc4random.c changes on website, sync clog, warn packagers
abortion (^G – ^C is SIGINT and doesn’t work like this, but
that’s actually good IMO)
prompted by enquiry about the Emacs editing mode by <smultron:#MidnightBSD>
in a somewhat hackish way, and it’s still quite different from zsh,
but probably closer to a desired functionality
XXX this makes state by abusing 「modified」 and 「xmp」 (“the mark”).
‣ only if !MKSH_SMALL
‣ add appropriate regression test
• if FPOSIX is set, do not close fds > 2 on exec, Debian #499139
• add appropriate regression tests for keeping fds private or not
developers, I understand about 1% of the source code only) yet still
functional (just not en par with the emacs editing mode, but no known
regressions over oksh (in -current) and better functionality than most
other korn shells, according to Yofuh)
and make it fit into mksh’s model (also gives us a couple of things
GNU bash doesn’t have
• add regression tests for all of these
Lukas “smultron” Upton from MidnightBSD spotted a script with /bin/sh
shebang invalidly using “&>” in some Apple backup toolkit, 10x
XXX why fds are limited to one digit?
* initialise the integers PPID, OPTIND, RANDOM, SECONDS, and TMOUT to base-10
* bring back PGRP as base-10 integer to the process group via getpgrp(2)
* initialise USER_ID as base-10 integer to the effective user id as retrieved
from geteuid(2) = $(id -u)
* use $USER_ID in dot.mkshrc instead of spawning an id(1) process
-> dot.mkshrc,v 1.34 now requires mksh R34
* convert more int to bool where appropriate
* remove dead code - getpgrp(2) cannot fail
* sync manual page to reality
* bump to mksh R34(beta) - feature freeze
XXX check if our_pgrp in jobs.c is still really needed, the setpgid call
XXX probably just makes us our own pgrp leader, and we might have to use
XXX and update kshpgrp accordingly - need feedback/help here but I think
XXX this simplification should be possible if I grok the code correctly.
etc/profile:
* adjust to $USER_ID changes in mksh (speed-up here, too)
mksh.hts:
* sync changelog
• more int → bool
• more regression tests: check if the utf8-hack flag is really disabled
at non-interactive startup, enabled at interactive startup, if the
current locale is a UTF-8 one
• make the mksh-local multibyte handling functions globally accessible,
change their names, syntax and semantics a little (XXX more work needed)
• optimise
• utf_wctomb: src → dst, as we’re writing to that char array (pasto?)
• edit.c:x_e_getmbc(): if the second byte of a 2- or 3-byte multibyte
sequence is invalid utf-8, ungetc it (not possible for the 3rd byte yet)
• edit.c:x_zotc3(): easier (and faster) handling of UTF-8
• implement, document and test for base-1 numbers: they just get the
ASCII (8-bit) or Unicode (UTF-8) value of the octet(s) after the ‘1#’,
or do the same as print \x## or \u#### (depending on the utf8-hack flag),
plus support the PUA assignment of EF80‥EFFF for the MirBSD encoding “hack”
(print doesn’t, as it has \x## and \u#### to distinguish, but we cannot use
base-0 numbers which I had planned to use for raw octets first, as they are
used internally): http://thread.gmane.org/gmane.os.miros.general/7938
• as an application example, add a hexdumper to the regression tests ☺
(3 weeks, 5 days ago) by millert
Make ulimit able to get and set multiple limits in a single invocation
like bash and zsh do. Requested by espie@, OK deraadt@
matches mksh pre-R29 (the one introducing the bug), and typeset matches
the behaviour intended with the R29 changes (better AT&T ksh93 compati-
bility) but never reached
• adjust the man page description of “typeset -p”, as it’s different from
the “typeset” and “typeset -” actions
| csh -cf '/command/svscanboot &'
and
| /usr/mpkg/bin/pgrphack /usr/mpkg/bin/svscanboot &
can now be replaced with
| /bin/mksh -T- /usr/mpkg/bin/svscanboot
with GNU groff – add some special handling to the BSD mdoc macros for it so
that the manual pages look good in both utf8 and ps (PDF) mode; also fix in
mksh wrong display of ` (groff: ‘), ' (groff: ’), \' (groff: ´), \- (groff:
U+2212 −), the en dash (nroff doesn’t have it, use the em dash there ONLY),
and ~ and ^ (groff: placed atop and size-reduced, for use as diacritics, in
manual pages bad since these are control characters there)
→ PDF manpage now has ‘’ “” and good-looking hyphens and mini and ~ and ^
→ utf8 manpage now has ‘’ “”, good-looking hyphens, cut’n’pasteable mini
→ nroff manpage still has '' "" instead of ugly `' ``'' or even `´
→ Debian lintian won’t complain any longer
me, which points out that “gnroff -Tutf8” mangles the ‘-’ characters
(hyphen/minus) from the input into ‘‐’ characters (hyphen), which does
not make sense in many cases and prevent copy’n’paste → fix
no change in nrcon output
In contrast to AT&T ksh93, its semantics are like GNU bash in that it ap-
pends the current working directory to the search path; it is implemented
as a shell alias instead of enhancing funcs.c:shbuiltins[] like in ksh93.
so that archite@midnightbsd won’t have to add evil kludges to oksh again if
they switch their ksh to mksh ☺
both “clear-screen” and “error” aren’t bound; default binding for ^L stays,
as usual, “redraw” (principle of least surprise); however GNU bash converts
also might want to put “bind ^L=clear-screen” into their ~/.mkshrc.
namely Dr. Robert “Pfeffer” Arnold (in this case, in FreeWRT), make
a half-completed attempt at implementing ${foo:2:3} substring evals
(of course, negatives can't work right now and that the numbers are
in face expressions is something I only read later too – this is to
be revisited later, but it's already late)
don't depend on this behaviour yet though
if someone wants to add more regression tests, feel free to…
is a compromise anyway; these lunox people will have to live with that, too
many existing korn shell alike scripts depend on it even if not on the full
korn shell syntax availability (note: this doesn't mean using these in some
script with #!/bin/sh is ok)
and have it return an API-correct const char *
• enhance and stylify comments
• a little KNF and simplifications
• #ifdef DEBUG: replace strchr and strstr with ucstrchr and ucstrstr
that take and return a non-const char *, and fix the violations
• new cstrchr, cstrstr (take and give const char *)
• new vstrchr, vstrstr (take const or not, give boolean value)
• new afreechk(x) = afreechv(x,x) = if (x1) afree(x2, ATEMP)
• new ksh_isdash(str) = (str != NULL) && !strcmp(str, "-")
• replace the only use of strrchr with inlined code to shrink
• minor man page fixes
• Minix 3 signames are autogenerated with gcc
• rename strlfun.c to strlcpy.c since we don't do strlcat(3) anyway,
only strlcpy(3), and shorten it
• dot.mkshrc: move MKSH=… down to the export line
to not disturb the PS1 visual impression ☺
• dot.mkshrc: Lstripcom(): optimise
• bump version
¹) side effect from creating API-correct cstrchr, cstrstr, etc.
uses goto so it must be better ☻
tested on mirbsd-current via both Makefile and Build.sh
actually within a (the emacs) editing mode does not work at
all, whether forced or not, only if we leave the editing mode
(at end of input); probably due to it saving stuff from e.g.
x_cols into xx_cols, etc.
-> remove SIGWINCH handling(!)
-> TIOCGWINSZ is now executed at end of every input line
-> use 'ESC #' if you direly need to change line size
only if we got a SIGWINCH -> interactive use speed-up on the
slower boxen (slowness courtesy of otto@obsd)
* ^L (redraw line) now (always) checks window size; use this
instead if required while editing the prompt; changes to the
variables will still be propagated after the line is entered
"set +o emacs-usemeta" and "set -o vi-show8" which are always on now,
since we have proper internationalisation (i.e. utf-8) support, and
assume the user either has a 'C' locale and can't enter 8-bit chars,
his terminal is 8bit-transparent, or he has a 'UTF-8' locale.
twkm (from #ksh on freenode), that $RANDOM is always an unsigned
15-bit decimal integer.
(RANDOM << 15 | RANDOM) thusly yields 30 bit, which is still more
than 36^5, so we can use it on the baselife CD to speed things up
cought by crib in IRC, thanks
(our textproc/groff port is unaffected since it uses the MirOS implementation,
a BSD derived one with fixes, by default instead but can reproduce the defect
with -mgdoc instead of -mdoc as parametre)
* a mksh -> an mksh
While here:
* fix list of shells that don't match . and .. with .* (pdksh went
missing in transit)
* Try to make fit on 39 pages by shortening a few
lines of redundant commentary about non-mksh books
* AT&T -> .At
* integrate compat.h, version.h into sh.h (dependency trick didn't work anyway)
* mention #ksh in mksh(1) since the founder (twkm) said it's on topic too
(don't remove mention of #mksh despite it's usually empty because of control)
not to stuff, even if TIOCSTI is available
* it's transpose-chars not transpose
bug spotted by hondza who wondered that on ^T the line repeats itself forever
to keys with a trailing tilde (after prefix + control char); the
function is then invoked after prefices, control char and one more
character X are entered; if X is not a tilde, it is ungetc(3)d
* mksh.1: rework prompt ($PS1) section, simplify example,
point to packaged dot.mkshrc example
* mksh.1: fix description of 'redraw' regarding redrawal
of prompts longer than one screen line
* all: bump version/date
(yeah, that's what you get from developing with a
16-bit MS-DOS(R) executable of your favourite text editor)
* lex.c, mksh.1: do not print the delimiting character for
not-to-be-counted character sequences (i.e. ANSI escapes)
in prompts any more, mostly because ASCII 01h is printable
on both Interix and Cygwin and I'm lazy
(this also fixes prompt width counting if a printable character
such as 'x' is used as delimiting character)
* lex.c: through printing the prompt character by character,
also print the delimited sequences if skipping, fixes some
prompt redrawal not honouring colours stuff while not totally
redrawing the entire prompt
* add another ksh book, referenced from amazon
* fix reference mdoc code
* add page count for the books
* fix old 10-digit ISBNs
* add new 13-digit ISBNs
* add myself as current maintainer/developer
* add miros-discuss eMail address for bug reports
* note that no book documents mksh
but sync RCS IDs for easier future adaption:
* Simplify savefd() by removing the "noclose" flag and make noclose
behavior the default. Almost all uses of savefd() are followed
by an implicit or explicit close.
* fix typos
* might as well make ksh_getopt() match real getopt(), ie. get rid of that
stupid EOF concept that was never true. adobriyan@gmail
* use SEEK_* for lseek()
* fix lint comments, no functional changes
* remove excessive optimization; from adobriyan@gmail
* only santa checks things twice; from adobriyan@gmail
* Interpret zero-filled numbers as decimal; PR 4213; from Alexey Dobriyan
have been read, for non-priviledgued shells only. If $ENV is
set, ~/.mkshrc is ignored (even if the file pointed to by $ENV
does not exist in the first place).
Feature requested by Jari Aalto for portable mksh because some
operating systems' vendors do not allow touching the profile.
Initial diff and manual page addition by Jari Aalto <jari.aalto@cante.net>
Code changes and manual page correctness by me.
important for the signedness of the target, to enable using
high-bit7 characters on the command line (eg. in UTF-8 locales)
* make emacs-usemeta and vi-show8 equivalent and document that
in the manual page (i.e. beware if you're in a latin1 locale)
* do not reference SUSv3 (helps GNU groff), write \&" out instead
according to SUSv3 and other modern shells (POSIX allows both).
Idea for the patch (add another lex state) from OpenBSD, but the
implementation differs slightly (and is better in quality).
Also add two testcases (/bin/sh passes both, old mksh only one),
and document the change in the manual page. Sync RCS IDs with OBSD.
but write a good chunk of that code myself (better structured, better error
handling, more gotos, less function calls, int -> bool)
passes all tests on mirbsd; this will become mksh R25 once tested on other
supported OSes