Re: clarification needed: shell 'exec' + function (builtin, ???)

2020-12-10 Thread Thorsten Glaser
Steffen Nurpmeso dixit: > #include > #include > #include > #include > int main(void){ > char inb[16], oub[16], *inbp, *oubp; > iconv_t id; > size_t inl, oul; > > memcpy(inbp = inb, "a\303\244c", sizeof("a\303\244c")); > inl = sizeof("a\303\244c") -1; Not -1 otherwise

Re: clarification needed: shell 'exec' + function (builtin, …) vs. 'env'

2020-12-09 Thread Thorsten Glaser
Joerg Schilling via austin-group-l at The Open Group dixit: >OK, mksh pdksh and posh have te same origin. >I don't know oksh, loksh oksh is basically where mksh took off, an intermediate, pdksh without its compatibility layer and with a small amount of bugfixes; loksh is a GNU/Linux port of

mail encoding not-fun (was Re: clarification needed: shell 'exec' + function (builtin, ???))

2020-12-09 Thread Thorsten Glaser
Steffen Nurpmeso via austin-group-l at The Open Group dixit: > |This is because m4.opengroup.org runs qmail, the arsehole under the MTAs, > |which auto-converted the mail from quoted-printable to 8bit, sending it > |as 8bit even to MTAs that don't offer 8BITMIME (I configured my sendmail > |not

Re: clarification needed: shell 'exec' + function (builtin, ???)

2020-12-09 Thread Thorsten Glaser
ven to MTAs that don't offer 8BITMIME (I configured my sendmail not to do that as well, so I got the same truncated mail back :( other than qmail, exim is known to break the MIME and SMTP standards like that). Here's it from my sent-mail folder, reduced to ASCII: >>From: Thorsten Glaser >

clarification needed: shell 'exec' + function (builtin, …)

2020-12-09 Thread Thorsten Glaser
Hi *, I’ve got a report in IRC by a user who spotted a cross-shell difference. In my opinion, the invocation… sh -c 'ls() { echo meow; }; exec ls' … is supposed to output "meow\n and return to the caller with a zero errorlevel. Some shells execve() the ls(1) binary instead. In

[Bug 1783355] Re: here document + pipe inside COMSUB broken

2020-10-30 Thread Thorsten Glaser
fixed in R59c, hopefully without breaking anything more ** Changed in: mksh Status: Triaged => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

Re: Assoc. arrays in mksh

2020-07-07 Thread Thorsten Glaser
KPECT dixit: >Are you still planning to to implement associative arrays in mksh? This >feature has been long awaited since 2011, but so far there are no Yes, long-term. I’d also wish to add multi-dimensional arrays and JSON {,de}serialisation in the same go, to avoid touching that code twice,

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

2020-05-16 Thread Thorsten Glaser
Hi Martijn, >>> We're at R56 now but nothing seems to have changed here. Status? >> >> It’s on the TODO. > > Here's another attempt at a patch. Note that this version checks for OFF(i) != > OF_CMDLINE to exclude immutable command line-only options (interactive, login, > restricted, stdin). I’ve

Re: '[[' regression in R59

2020-05-05 Thread Thorsten Glaser
Martijn Dekker dixit: > As of mksh-R59 there is a regression in glob pattern matching with '[['. Thanks, fixed. I’m too tired to release R59b tonight, so if you have got any other bugs/regressions to go into it before I do so tomorrow or so… do tell. You seem to have more weird-corner-case test

Re: sleep builtin

2020-04-06 Thread Thorsten Glaser
Salve Noctambule, >I have a question about sleep builtin. I'm writing a script and at the >end, I want it to simply wait for SIGINT (from user) or signals with >kill builtin. The normal way to terminate sleep is SIGALRM though, but SIGINT will most likely also work (try it out). >What is the

Re: mksh trap in functions

2020-04-01 Thread Thorsten Glaser
n8dandy dixit: >Yesterday, I was extensively using traps with mksh and I noticed something >unexpected. >Let's consider the following example, from the book "Learning the Korn shell, >2nd Well, mksh isn’t AT ksh ☺ In general, the *first* edition of that book (orelly/unix/ksh/) works better

[Bug 1869833] [NEW] Please sync mksh 58-1 (universe) from Debian testing (main)

2020-03-30 Thread Thorsten Glaser
] Correct documentation of vi mode @c - [tg] Update to UCD 13.0.0 - [tg] Use nanoseconds in test -nt / -ot (LP#1855325) * Work around debhelper issue #908845 (Niels Thykier) * Update lintian overrides -- Thorsten Glaser Fri, 27 Mar 2020 12:59:25 +0100 With my Debian Developer hat

[Bug 1855167] Re: Comparatively poor += performance

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1855167 Title: Comparatively poor

[Bug 1855325] Re: test -nt and -ot ignore the subsecond part of file timestamps

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Confirmed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1855325 Title: test -nt and -ot

[Bug 1857826] Re: mksh isglobal ASAN heap-buffer-overflow

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857826 Title: mksh isglobal ASAN

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857195 Title: here string

[Bug 1857828] Re: mksh expand ASAN heap-buffer-overflow

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857828 Title: mksh expand ASAN

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857702 Title: " +=" operator

[Bug 1779179] Re: nōn-ASCII heredoc separators

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1779179 Title: nōn-ASCII heredoc

[Bug 1867459] [NEW] Please sync mksh 57-7 (universe) from Debian sid (main)

2020-03-14 Thread Thorsten Glaser
Public bug reported: A roll-up of a couple of bugfixes (this is almost identical to the upcoming new upstream release), but, more importantly, introduction of autopkgtests. I’d prefer these fixes to be in focal due to LTS, and especially as mksh 58 will be very close to this code, have the chance

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2020-03-13 Thread Thorsten Glaser
OK, turns out that this was indeed a bug (but the presence of DOHEREDOC probably predates the existence of DOSCALAR so understandable). I hope this doesn’t introduce any regressions. Testcase also committed. ** Changed in: mksh Status: Triaged => Fix Committed -- You received this bug

Re: Bug#952970: mksh cannot handle non-BMP characters in \Uxxxxxxxx

2020-03-10 Thread Thorsten Glaser
severity 952970 wishlist tags 952970 upstream forwarded 952970 miros-mkshmirbsd.org close 952970 thanks >This isn’t a packaging bug, so I’ll probably close this, but we can >discuss this upstream. Closing as announced, but I’ve added it to the plans: http://www.mirbsd.org/mksh.htm#plans PS:

Re: [MirBSD/mksh] Enable "+" sign in alias name as it was available in original KornShell (#2)

2020-03-09 Thread Thorsten Glaser
Aleksey Cheusov dixit: >Well, to be honest I haven't check ksh88. But '+' sign is allowed for >aliases in ksh (on NetBSD, Solaris), /bin/sh on FreeBSD, ksh93, dash, ^ pdksh ^ ksh93^ ash ^ ash >pdksh, bash, zsh etc. Yes, but, as I said, we had to

Re: Bug#952970: mksh cannot handle non-BMP characters in \Uxxxxxxxx

2020-03-02 Thread Thorsten Glaser
Mingye Wang dixit: >Mksh is unable to handle Unicode characters that are not in the BMP (It’s “mksh”, lowercase ‘m’.) Only short because I’m in a meeting: yes, and this is deliberate at the moment, because mksh is the shell of MirBSD which uses 16-bit Unicode. I noticed the interactive

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread Thorsten Glaser
This totally makes sense in mksh only. $ i=4+4; echo $i This is an assignment of the string "4+4" to the variable i. The string is then, between assignment and storage, parsed as an arithmetic expression, because i is of integer type. The expression is calculated and the result stored. $ i=i+1;

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread Thorsten Glaser
Warning reporting during running of a script is supremely hard, you cannot use any file descriptors; basically, you have to reserve one with a high number for syslog and do it that way and hope someone reads syslog… so I never did. We really need a linting shell runner or something ☹ -- You

[Bug 1857826] Re: mksh isglobal ASAN heap-buffer-overflow

2019-12-29 Thread Thorsten Glaser
** Changed in: mksh Status: New => Fix Committed -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857826 Title: mksh isglobal ASAN

[Bug 1857828] Re: mksh expand ASAN heap-buffer-overflow

2019-12-29 Thread Thorsten Glaser
fix is making it to the anoncvs and github mirrors within the hour ** Changed in: mksh Status: Triaged => Fix Committed -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

Re: [bug] within 'eval', -e/-o errexit appears active, but is inactive

2019-12-29 Thread Thorsten Glaser
Martijn Dekker dixit: > I noticed something strange while executing some 'eval'-ed commands: the -e/-o > errexit appears to become active out of nowhere. > > $ mksh -c 'echo $-; eval '\''echo $-'\''; echo $-' > hc > ehc > hc Found to be caused by reusing bit7 of the ERREXIT flag for nefarious

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-29 Thread Thorsten Glaser
As discussed heavily on IRC, other shells can use ((…)) or let to work like mksh, and the mksh behaviour is semantically correct. I’ve documented this in more detail in the manual page and the mksh FAQ now but kept the behaviour as to not break older scripts written in mksh. You might wish to

[Bug 1857828] Re: mksh expand ASAN heap-buffer-overflow

2019-12-29 Thread Thorsten Glaser
** Changed in: mksh Importance: Undecided => High ** Changed in: mksh Status: New => Triaged ** Changed in: mksh Assignee: (unassigned) => Thorsten Glaser (mirabilos) -- You received this bug notification because you are a member of mksh Mailing List, which is subscribe

[Bug 1857826] Re: mksh ASAN heap-buffer-overflow

2019-12-29 Thread Thorsten Glaser
** Changed in: mksh Importance: Undecided => Medium ** Changed in: mksh Assignee: (unassigned) => Thorsten Glaser (mirabilos) -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-t

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
and it’s most definitely not emulation of ksh93 some ksh88 and little parts of ksh93, but e.g. no float and other crap or complicated things -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions:

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
01 in an integer variable is still 1 on output (010 may be 10 or 8 depending on the posix flag) more later -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2019-12-27 Thread Thorsten Glaser
: mksh Assignee: (unassigned) => Thorsten Glaser (mirabilos) -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857195 Title: here string behaviour

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
Erm… that’s right, += is string concatenation. Write “let” before the line to make it integer addition. -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2019-12-24 Thread Thorsten Glaser
“it should be deterministic/always the same” this is a very good point, and at this, well, point, I’ve not yet got any opinion. I modelled the here strings after here documents: first, the first two “<<” are parsed indicating it’s a here document, then the here document delimiter is parsed; if

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2019-12-22 Thread Thorsten Glaser
Almost a good point, considering… $ x=(a 'b c') $ IFS=, $ a="${x[*]}"; print -r -- "<$a>" $ a="${x[@]}"; print -r -- "<$a>" $ a=${x[*]}; print -r -- "<$a>" $ a=${x[@]}; print -r -- "<$a>" $ a="${u:-"${x[*]}"}"; print -r -- "<$a>" $ a="${u:-"${x[@]}"}"; print -r -- "<$a>" Oh the other hand,

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2019-12-22 Thread Thorsten Glaser
Args, hit Return too early. - contact me in IRC or so if you’re up for SMTP debugging - https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02 for the POSuX reference -- You received this bug notification because you are a member of mksh Mailing List, which is

[Bug 1857195] Re: here string behaviour different in mksh and ksh93

2019-12-21 Thread Thorsten Glaser
Not a definite decision, but consider this: print -r -- "${x[@]}" - vs. - a="${x[@]}" In the first code, the elements of array x are expanded in list context, that is, each element as separate word, unset elements generating no words. In the second code, the elements are expanded in scalar

[Bug 1855167] Re: Comparatively poor += performance

2019-12-12 Thread Thorsten Glaser
np you’re welcome Note that this is special-cased (but easy enough to do and justify in that place). The variable must be set and have its content dynamically allocated (normally so for strings previously set), not a special variable (like IFS, PATH, etc.), not an integer variable, and not have

[Bug 1855167] Re: Comparatively poor += performance

2019-12-11 Thread Thorsten Glaser
Please wait a bit until the anoncvs mirror has caught up. Thanks! -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1855167 Title: Comparatively

[Bug 1855606] Re: Can't parse command substitution containing here-document and pipeline

2019-12-08 Thread Thorsten Glaser
Duplicate of https://bugs.launchpad.net/mksh/+bug/1783355 ** Changed in: mksh Status: New => Invalid -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

[Bug 1855167] Re: Comparatively poor += performance

2019-12-05 Thread Thorsten Glaser
nee: (unassigned) => Thorsten Glaser (mirabilos) ** Changed in: mksh Status: New => Confirmed -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad

passing variable assignments to functions (was Re: Bug#935115: bash: [regression] passing variable assignments to functions broken in POSIX mode, violating POSIX)

2019-08-19 Thread Thorsten Glaser
Dixi quod… >┌──┬┬──┬┬──┐ >│ shell \ what │ inside visible │ exported │ afterwards visible │ exported │ >├──┼┼──┼┼──┤ >│ ksh93│ ✔ as required │ ✗ (ok) │ ✗ no,

Re: recent CVS: 'command .' permanently overrides PPs

2019-08-02 Thread Thorsten Glaser
Martijn Dekker dixit: > One of the recent commits introduced a new bug: if a dot script is sourced > with > 'command .', the positional parameters are permanently overridden by whatever > they were at the point of sourcing, and any changes to them are ignored. Ouch, so it’s not all that easy…

Re: [Bug] 'command readonly/export' exit on error

2019-08-01 Thread Thorsten Glaser
Martijn Dekker dixit: > The 'readonly' and 'export' commands exit the shell on error even if > they are prefixed with 'command', which should stop that exit from > happening. tricky but fixed, thanks //mirabilos -- 11:56⎜«liwakura:#!/bin/mksh» also, i wanted to add mksh to my own distro │ i was

Re: [PATCH] return status 126 on failure to execute

2019-08-01 Thread Thorsten Glaser
Martijn Dekker dixit: > Expected output: > > longargs.sh[8]: /bin/sh: Argument list too long > status 126 merged, thanks

Re: 'command set' does not set PPs

2019-08-01 Thread Thorsten Glaser
Martijn Dekker dixit: >$ mksh -c 'command set -- one two three; printf %s\\n "$@"' fixed, thanks

Re: [PATCH] return status 126 on failure to execute

2019-07-03 Thread Thorsten Glaser
Hi Martijn, > Currently, when a utility fails to execute due to something like E2BIG, mksh > sets the exit status to 1. That is not satisfactory because there is no way to agreed; thanks for the patch, it’s consistent, will apply. bye, //mirabilos -- 21:12⎜ sogar bei opensolaris haben die von

[Bug 1817789] Re: misleading error message for SELinux denials

2019-03-01 Thread Thorsten Glaser
I changed the error message, as indicated. ** Changed in: mksh Status: Opinion => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

[Bug 1817959] Re: "test -e" inaccurately returns false when stat() is disallowed

2019-02-28 Thread Thorsten Glaser
I don’t consider it a bug. If you break stat(2) in your system, expect follow-up breakage, as per the GIGO principle. -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

[Bug 1817789] Re: misleading error message for SELinux denials

2019-02-27 Thread Thorsten Glaser
I vaguely recall something about access() succeeding for file foo when foo.exe exists on some platforms, or the other way round, and that the modes are also not always correct. The manpage supports the latter… Even if a process has appropriate privileges and indicates success for X_OK,

[Bug 1817959] Re: "test -e" inaccurately returns false when stat() is disallowed

2019-02-27 Thread Thorsten Glaser
On unix. test whether a file exists is done using stat. access is not portable and buggy on many platforms. Honestly, write your security policies to not block stat. I’m not even going to bother with this one. ** Changed in: mksh Importance: Undecided => Wishlist ** Changed in: mksh

[Bug 1817789] Re: misleading error message for SELinux denials

2019-02-27 Thread Thorsten Glaser
“5) A failure of the stat() system call is not an accurate indicator of the exec()-ability of the file. The only way to determine if a file is executable is to execute it.” This is not generally true. We need to check for +x, and there was something with strange operating systems, *and* the shell

[Bug 1817789] Re: misleading error message for SELinux denials

2019-02-27 Thread Thorsten Glaser
stat() must always succeed, because we must check that the executable bits are set before accepting the file as command (if not for anything else, then because POSIX was changed to demand distinguishing $? between 126 and 127 for these cases). -- You received this bug notification because you

[Bug 1817789] Re: misleading error message for SELinux denials

2019-02-27 Thread Thorsten Glaser
What do you think of “not found or inaccessible”? (I hope I spelt that right.) -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1817789 Title:

[Bug 1817789] Re: misleading error message for SELinux denials

2019-02-26 Thread Thorsten Glaser
No. When you do mksh -c /tmp/d/f you ask mksh to find it as a command. The “not found” error message there is more general; for example, it also happens if the interpreter is not found: print '#!/nonexistent-int' >/tmp/ff chmod 755 /tmp/ff mksh -c /tmp/ff (This even results in

Re: Bug in kill-region? (not actually killing region)

2019-01-10 Thread Thorsten Glaser
Hi John, > It seems I might have come across an actual bug this time :-) perhaps ;) But thanks for writing anyway, it’s always nice to see what users run into. > From the man page: > > kill-region: ^W > Deletes the input between the cursor and the mark. But also from the

[Bug 1804504] Re: -o pipefail makes while read loop ugly

2019-01-05 Thread Thorsten Glaser
This is, unfortunately, by design. I’ve committed a manpage change (in CAVEATS) with a rationale, though. ** Changed in: mksh Status: Triaged => Invalid -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching

Re: Bug#910276: mksh does never execute an "EXIT trap", if it is created with the "trap" command in a sub shell

2019-01-05 Thread Thorsten Glaser
>I still cannot confirm either way, but some preliminary research >with an extended test script: I’ve found something interesting: tg@blau:~ $ mksh -c 'echo a; (trap -- "echo subshell_exit >&2" EXIT); echo b' a b tg@blau:~ $ mksh -c 'echo a; (trap -- "echo subshell_exit >&2" EXIT;); echo b' a b

Re: Bug in mksh when counting line length

2019-01-04 Thread Thorsten Glaser
Hi John, >> no, you’ve discovered you did not read the manpage ☺ > > I did read it, but I didn't understand it...! Adding the \r and surrounding > all escape sequences with \1 solves my problem, but I don't understand why > (?). Ah okay. Basically, the first \1\r says: make the \1 into a

Re: Bug in mksh when counting line length

2019-01-04 Thread Thorsten Glaser
Hi John, > I think I've discovered a bug in mksh. According to the man page: no, you’ve discovered you did not read the manpage ☺ PS1 The primary prompt for interactive shells. Parameter, com- […] Since backslashes and other special characters may be inter-

Re: [Bug] 'command readonly/export' exit on error

2018-12-31 Thread Thorsten Glaser
Hoi Martijn, > they are prefixed with 'command', which should stop that exit from > happening. Almost certainly a bug (from what I remember without needing to look it up), indeed. > Test cases: Thanks! Putting this on my TODO. bye, //mirabilos -- “ah that reminds me, thanks for the stellar

Re: mksh -l login shell bug on Fedora 29 fc29 in etc profile.d PackageKit.sh

2018-12-31 Thread Thorsten Glaser
Calvin Crowley dixit: >mksh: /etc/profile.d/PackageKit.sh[14]: syntax error: unexpected >operator/operand '=~' Please report this as a bug against the PackageKit packaging in Fedora instead. Make clear that files in /etc/profile.d/ can be sourced by any POSIX sh-compatible shell and thus MUST

[Bug 1804504] [NEW] -o pipefail makes while read loop ugly

2018-11-21 Thread Thorsten Glaser
so that the loop always has $?=0, or: while :; do IFS=' ' read a b || break Interestingly enough, removing the “| sort -u” also makes it work. ** Affects: mksh Importance: Medium Assignee: Thorsten Glaser (mirabilos) Status: Triaged -- You received this

[Bug 1783355] Re: here document + pipe inside COMSUB broken

2018-10-20 Thread Thorsten Glaser
The entire tree printing code is currently not suited for that, a major rewrite is needed. -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1783355

[Bug 1719035] Re: mksh.htm "Patching" section should mention KSH_VERSIONNAME_VENDOR_EXT

2018-10-20 Thread Thorsten Glaser
** Changed in: mksh Status: New => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1719035 Title: mksh.htm "Patching" section

[Bug 1779179] Re: nōn-ASCII heredoc separators

2018-10-20 Thread Thorsten Glaser
** Changed in: mksh Status: Triaged => Fix Committed -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1779179 Title: nōn-ASCII heredoc

[Bug 1798397] Re: too eager expansion in substitution

2018-10-20 Thread Thorsten Glaser
Found to be not a bug: $ i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : ${var#${q[i=777]}}; echo $i must return 777 twice, because the pattern must always be expanded before looking at $var. $ i=42; : ${var+${q[i=777]}}; echo $i; var=meow; : ${var+${q[i=777]}}; echo $i already behaves

[Bug 1798397] [NEW] too eager expansion in substitution

2018-10-17 Thread Thorsten Glaser
Public bug reported: “If word is not needed, it shall not be expanded.” (POSIX) 00:52 < izabera> i=42; : ${var#${q[i=777]}}; echo $i; var=meow; : ${var#${q[i=777]}}; echo $i 00:52 < izabera> prints 42 777 in bash and ksh93 00:52 < izabera> and 777 777 in mkmsh The #/##/%/%% of course need to

Re: Bug#910276: mksh does never execute an "EXIT trap", if it is created with the "trap" command in a sub shell

2018-10-06 Thread Thorsten Glaser
Bernd Schumacher dixit: >Please confirm, that this is a bug and not the expected behaviour of mksh. I still cannot confirm either way, but some preliminary research with an extended test script: $ cat script fkt() { trap -- "echo $1 >&2" EXIT } fkt shell_exit $(fkt fn_exit) $(trap -- "echo

[Bug 1790571] [NEW] Zombies left when backgrounded jobs run for longer than until the main script execs away

2018-09-03 Thread Thorsten Glaser
Public bug reported: The following construct causes a zombie to hang around: #!/bin/sh cd /home/tglase/Misc/vpn.w (sleep 20; sudo route -n add -host x.x.x.x gw 172.28.0.1) & exec sudo openvpn --config /home/tglase/Misc/vpn.w/vpn-bn-01.ovpn "$@" Adding an “exec” before the sudo in the subshell

[Bug 1783355] [NEW] here document + pipe inside COMSUB broken

2018-07-24 Thread Thorsten Glaser
Public bug reported: tglase@tglase:~ $ mksh x Foo BlA9907BAr try2 x: syntax error: unexpected '|' 1|tglase@tglase:~ $ bash x Foo BlA9910BAr try2 tglase@tglase:~ $ ksh93 x Foo BlA9917BAr try2 ** Affects: mksh Importance: Medium Status: Triaged ** Attachment added: "bug

[Bug 1783355] Re: here document + pipe inside COMSUB broken

2018-07-24 Thread Thorsten Glaser
Syntax is valid POSuX as per https://stackoverflow.com/a/7046926/2171120 -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1783355 Title: here

Re: mksh: [bug] command line option -m ineffective

2018-05-08 Thread Thorsten Glaser
Seb dixit: >As if '-m' was just ignored. It gets worse: if “-m” is passed, interactive is also broken. I’ve tracked this down to between pdksh 4.0 (usenet posting) and pdksh-5.0.6.tar.gz, even the changelog entry I believe responsible, and I agree it’s probably a thinko instead of intended

Re: tty state not restored after restarted stopped job

2018-04-27 Thread Thorsten Glaser
Hi again, >Thinking a bit more about this, I found a valid reason not to keep the >terminal state after a restarted job exits (successfully): the tty >state in which that job was started can be obsolete at the time it is >restarted because the tty state may have been modified while the job was

Re: tty state not restored after restarted stopped job

2018-04-01 Thread Thorsten Glaser
G.raud Meyer dixit: >First one should know what is the correct behaviour. The feature of […] >Before a patch fixing the strange case of a "successful but temporarily >stopped job has failed" it would be good to document the feature (and >the bug, if it is one). I honestly don’t know. It is

Re: [PATCH] quote empties

2018-03-17 Thread Thorsten Glaser
Hoi Martijn, >Here's a patch. Indeed. Thanks, applied. I’ll look at your other and Stéphane’s bugreport once I’m over the current edition of the “common cold” ☹ Much appreciated, //mirabilos -- (gnutls can also be used, but if you are compiling lynx for your own use, there is no reason to

[Bug 1749741] Re: bash-style for (()) loops

2018-02-15 Thread Thorsten Glaser
No. They’re ugly enough in C, and they can easily be transformed into something portable: for ((a; b; c)); do blah done ↓ (( a )) while (( b )); do blah (( c )) done So, *really*, no. I’m translating for loops in C source into while loops as I go,

Re: [Patch] Support for changing locale in running mksh

2017-12-15 Thread Thorsten Glaser
Hi, >for better support of the UTF-8 mode of the mksh I've done a small >patch which enables the mksh to change to UTF-8 mode even if the >locale is changed at runtime ', e.g in ~/.profile, ~/.mkshrc or >in the system wide /etc/profile. The attached patch is for R54. locale tracking is on the

Re: strerror/strsignal or sys_errlist/sys_signame

2017-11-23 Thread Thorsten Glaser
Dr. Werner Fink dixit: >> Just to make sure: this is with LTO disabled? >... AFAICS ftom the build log the link-time optimizer is not disabled Just a short look, don't have much time atm: call Build.sh *without* "-c lto". >> This will indicate it uses those functions instead of the >> arrays

Re: Request 543328 requires review (submit openSUSE:Leap:15.0/mksh)

2017-11-22 Thread Thorsten Glaser
Dr. Werner Fink dixit: >Morning Thorsten, Morning ☺ >On Wed, Nov 22, 2017 at 12:42:52AM +, Thorsten Glaser wrote: >> what’s -D_DEFAULT_SOURCE for? > -- Macro: _DEFAULT_SOURCE > If you define this macro, most features are included apart from > X/Open, L

Re: strerror/strsignal or sys_errlist/sys_signame

2017-11-22 Thread Thorsten Glaser
Hi, >HAVE_SYS_SIGLIST=0 >HAVE_SYS_ERRLIST=0 >HAVE_SYS__SIGLIST=0 >HAVE_SYS__ERRLIST=0 >export HAVE_SYS_SIGLIST HAVE_SYS_ERRLIST HAVE_SYS_SIGLIST HAVE_SYS__ERRLIST you have no less than *three* mistakes in there ;) 1. You export HAVE_SYS_SIGLIST twice (second one is missing the extra

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

2017-09-26 Thread Thorsten Glaser
Martijn Dekker dixit: >> I’ll put the issue on my TODO only, for now, but thanks anyway. > >We're at R56 now but nothing seems to have changed here. Status? It’s on the TODO. bye, //mirabilos -- 11:56⎜«liwakura:#!/bin/mksh» also, i wanted to add mksh to my own distro │ i was disappointed that

Re: mksh R56 - change in '0' movement in vi command mode

2017-08-27 Thread Thorsten Glaser
Hi Larry, >In mksh R56, with 'set -o vi' in effect, entering '0' no longer >moves the cursor to the beginning of the line. That seems like a thanks, indeed a regression, fixed in commitid 10059A356DB182F3791. bye, //mirabilos -- 22:20⎜ The crazy that persists in his craziness becomes a master

[Bug 1694943] Re: history from one of many parallel shell sessions sometimes not stored

2017-08-10 Thread Thorsten Glaser
According to multiplexd this is likely fixed in R56. If not, pleas e open a new issue. ** Changed in: mksh Status: New => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions:

[Bug 1709716] Re: FAIL ./check.t:arith-ternary-prec-1 with GCC >= 6.3 and LTO

2017-08-09 Thread Thorsten Glaser
It’s known that mksh’s testsuite exhibits problems in the infrastructure (kernel, libraries, toolchain, compiler). In this case, GCC’s LTO (and before that, -fwhole-program --combine) is a repeat offender of breaking code. If your builds exhibit this problem, you should *disable LTO for your

Re: 'exec' runs shell functions and builtins

2017-08-07 Thread Thorsten Glaser
Robert Elz dixit: >there is no right answer - and that the only rational result is that portable >scripts cannot expect to be able to exec a function (or any builtin that is Yes, but the others in this thread want to allow portable scripts to rely on the exec builtin always resulting in a PATH

Re: 'exec' runs shell functions and builtins

2017-08-04 Thread Thorsten Glaser
Martijn Dekker dixit: >> And this is utter nonsense, the builtin does replace the shell process, > >No. On mksh, 'exec builtin' is exactly equivalent to 'builtin; exit'. >The builtin is run in the existing shell process. No >replacing/overlaying of the shell process takes place. It's easy to

Re: 'exec' runs shell functions and builtins

2017-07-25 Thread Thorsten Glaser
Robert Elz dixit: > | This specifically means that builtins MAY be made available > | to exec, and that thatbs an expected modus operandi. > >It means nothing of the kind. The System Interfaces volume of POSIX.1-2008 >is the part that defines the system calls. There’s no “exec” system

Re: 'exec' runs shell functions and builtins

2017-07-25 Thread Thorsten Glaser
Martijn Dekker dixit: >And under what theory should 'exec' run a shell function? Read up on what a “command” can be, pretty far up in the Shell part. Although I did not manage to get a pipeline or loop run. Not sure if that’s a bug, but looking at the way statements are parsed, probably not.

Re: 'exec' runs shell functions and builtins

2017-07-25 Thread Thorsten Glaser
Martijn Dekker dixit: >to be a bug in POSIX terms; 'exec' is supposed to launch a program that >overlays the current shell[2], implying the program launched by 'exec' >is always external to the shell. The built-in utility is “the program implementing command”, and, with exec, it is not returning

Re: 'exec' runs shell functions and builtins

2017-07-25 Thread Thorsten Glaser
Martijn Dekker dixit: >This behaviour also appears to be contrary to the documentation in >mksh(1) ("The command is executed without forking, replacing the shell >process"). The test script below demonstrates that neither "exec" And this is utter nonsense, the builtin does replace the shell

[Bug 1694943] [NEW] history from one of many parallel shell sessions sometimes not stored

2017-06-01 Thread Thorsten Glaser
Public bug reported: Natureshadow reports that, when having multiple parallel mksh sessions that share the same HISTFILE, after exiting one of them and then starting a new one, the history from the shell just terminated is not available. We currently believe this is due to history truncation

Re: An additional quote test for check.t

2017-05-18 Thread Thorsten Glaser
Hi Steffen, >i think, the \r is expanded, the output is a bit unsure what exactly you’re talking about, but you cannot ever use echo to display strings portably. Use 'print -r -- "$foo"' to display the contents of the foo parameter. Is there anything you think mksh fails to do correctly? If

Re: \uXXXX on EBCDIC systems

2017-05-03 Thread Thorsten Glaser
Daniel Richard G. dixit: >While UTF-8 isn't a thing in the z/OS environment, I think there could >be value in printing something that will be converted by the existing >EBCDIC->ASCII terminal/NFS conversion into correctly-formed UTF-8 >characters. […] >in the terminal. Effectively an

Re: mksh on EBCDIC, testing

2017-05-03 Thread Thorsten Glaser
Daniel Richard G. dixit: […] >but that's about it. OK. >Note that "cc" isn't even the same type of compiler as xlc. The option >syntax is different/incompatible, for starters. It’s likely still an xlc frontend, as it’s detected as xlc. >I saw that you put in a change to use xlc on this

mksh on EBCDIC, testing

2017-04-27 Thread Thorsten Glaser
Hi, I’m starting a new thread so I can archive the old one. I’ve merged most of your patch, only did some things differently. I also added your copyright to misc.c which had the most logic from you; feel free to send patches to change your copyright info on files you feel you have co-authorship

[Bug 625164] Re: some extended Korn shell globs are really slow

2017-04-27 Thread Thorsten Glaser
mksh’s globbing really sucks. Way out: parse them as special kind of regex (NFA with making $KSH_MATCH an array, possibly). References: - https://research.swtch.com/glob - https://swtch.com/~rsc/regexp/regexp1.html -- You received this bug notification because you are a member of mksh Mailing

  1   2   3   >