Re: ksh: quote empties

2018-12-30 Thread Martijn Dekker
Op 30-12-18 om 23:43 schreef Philip Guenther: This thread was never resolved/committed. Looking again at the diffs, I still think I prefer that we_not_ touch print_value_quoted(), as the other callers all use the 'key=value' format and don't need special handling of empty values, [...] Not ac

Re: ksh: quote empties

2018-04-14 Thread Martijn Dekker
Op 15-04-18 om 04:09 schreef Martijn Dekker: Op 15-04-18 om 03:41 schreef Philip Guenther: On Sun, 15 Apr 2018, Klemens Nanni wrote: It also badly effects non-empty cases: ... $ ./obj/ksh -c alias autoload='' functions='' Hah!  The original diff i actually

Re: ksh: quote empties

2018-04-14 Thread Martijn Dekker
Op 15-04-18 om 03:41 schreef Philip Guenther: On Sun, 15 Apr 2018, Klemens Nanni wrote: It also badly effects non-empty cases: ... $ ./obj/ksh -c alias autoload='' functions='' Hah! The original diff i actually broken (it tests the wrong variable) but I fixed that by

Re: ksh: quote empties

2018-04-14 Thread Martijn Dekker
Op 15-04-18 om 03:03 schreef Philip Guenther: On Sun, 15 Apr 2018, Martijn Dekker wrote: $ ksh -c 'trap "" CONT; trap' trap -- CONT That is not "suitable for re-entry into the shell". Empty words must be quoted, or they disappear. Expected output: trap -- &#

ksh: quote empties

2018-04-14 Thread Martijn Dekker
$ ksh -c 'trap "" CONT; trap' trap -- CONT That is not "suitable for re-entry into the shell". Empty words must be quoted, or they disappear. Expected output: trap -- '' CONT Patch below. OK? - M. Index: misc.c === RCS file: /

ksh: ${foo#'bar'} problem in here-document

2018-03-08 Thread Martijn Dekker
x=notOK cat <

Re: [PATCH] bc(1) should write error messages to standard error

2017-02-20 Thread Martijn Dekker
Op 21-02-17 om 04:08 schreef Martijn Dekker: > bc() { > _bc_err=$(command -p bc "$@" 1>&3 2>&1) Correction, the redirections should be the other way around: _bc_err=$(command -p bc "$@" 2>&1 1>&3) Sorry about that, - M.

[PATCH] bc(1) should write error messages to standard error

2017-02-20 Thread Martijn Dekker
Upon encountering a parsing error, bc(1) passes an error message on to dc(1), which writes the error message to standard output along with the normal output. That is a bug. Error messages should go to standard error instead, as POSIX specifies: http://pubs.opengroup.org/onlinepubs/9699919799/utili

Re: [ksh] [patch] Make "$@" POSIX-compliant with empty IFS

2016-05-06 Thread Martijn Dekker
Op 24-03-16 om 04:04 schreef Theo Buehler: On Fri, Mar 04, 2016 at 11:29:38AM +0100, Dmitrij D. Czarkoff wrote: Martijn Dekker said: So this patch makes quoted "$@" act according to the standard even when IFS is empty. Quoted "$*" is unchanged. For the unspecified (not st

[PATCH] make 'set +o' useful and POSIX compatible

2016-03-05 Thread Martijn Dekker
The command 'set -o' shows the current shell options in an unspecified format. Less well-known is the variant 'set +o', which should output the current shell options "in a format that is suitable for reinput to the shell as commands that achieve the same options settings".[*] That means it should

Re: cp -i might violate POSIX

2016-03-05 Thread Martijn Dekker
David Vasek schreef op 05-03-16 om 23:16: > while echo n; do done > is shorter (and even faster). But it doesn't help either. It's also a syntax error on everything except {pd,m}ksh and zsh. Even AT&T ksh doesn't support it. >>> pax -rwk ${files} dst/ > > It works when the ${files} contains

Re: cp -i might violate POSIX

2016-03-05 Thread Martijn Dekker
David Vasek schreef op 05-03-16 om 10:34: > On Sat, 5 Mar 2016, Dmitrij D. Czarkoff wrote: > >> So the goal of the diff is to replace something like >> >> $ for src in ${files}; do [ -r "$src" ] && cp ${src} dst/; done >> >> with >> >> $ yes n | cp -i ${files} dst/ >> > > The former line doesn'

Re: [ksh] [patch] Make command -v and command -p[vV] POSIX compliant

2016-03-04 Thread Martijn Dekker
Martijn Dekker schreef op 04-03-16 om 22:46: > Martijn Dekker schreef op 04-03-16 om 19:30: >> Some minor updates to the man page are also needed. I'll make a new patch. > Here's take 2. It was correctly pointed out that I made some unrelated edits to sh.1 that would b

Re: [ksh] [patch] Make command -v and command -p[vV] POSIX compliant

2016-03-04 Thread Martijn Dekker
Martijn Dekker schreef op 04-03-16 om 19:30: > Todd C. Miller schreef op 04-03-16 om 19:22: >> This also looks fine but we should add a similar regress for whence's >> -p and -v flags. > > Some minor updates to the man page are also needed. I'll make a new patch. H

Re: [ksh] [patch] Make command -v and command -p[vV] POSIX compliant

2016-03-04 Thread Martijn Dekker
Todd C. Miller schreef op 04-03-16 om 19:22: > This also looks fine but we should add a similar regress for whence's > -p and -v flags. Some minor updates to the man page are also needed. I'll make a new patch. - M.

Re: [ksh] [patch] Make "$@" and "$*" POSIX-compliant with 'set -u'

2016-03-04 Thread Martijn Dekker
Martijn Dekker schreef op 04-03-16 om 16:21: > I've also attached a simple regression test. I didn't know what existing > .t file that would fit in, so I made a new one. Perhaps it should be added to obsd-regress.t -- it seems to have all the miscellaneous tests added for OpenBSD. - M.

[ksh] [patch] Make "$@" and "$*" POSIX-compliant with 'set -u'

2016-03-04 Thread Martijn Dekker
Here is another patch related to "$@" and "$*". It makes their behaviour in combination with 'set -u' (set -o nounset) POSIX-compliant and consistent with other current shells. As of 2009, POSIX mandates that the special parameters "$@" and "$*" be exempt from 'set -u' checking. The reason is that

[ksh] [patch] Make "$@" POSIX-compliant with empty IFS

2016-03-03 Thread Martijn Dekker
Hi all, I'm new here and posting at Theo de Raadt's request. I'm developing a general-purpose cross-platform library for the POSIX shell language and in the process I encounter lots of bugs in various shells. I will be posting here a few times with some patches and bug reports against OpenBSD ksh.