Fix regression with trap on left hand side of pipe.
Fix forced return from shell structure within nested function.
Fix tests exiting too early.
Add new test case.
* Teach ztrftime() %9. and %N for nanoseconds
* Update prompt expansion to pass sub-second times for time formatting
* Update zsh/stat to pass sub-second times for atime/mtime/ctime
Patch heavily based on Oliver's earlier work @ workers/24059
This is too hard to make robust. Problems include
- Reading input in different places causes lines to appear and disappear
- There is no easy way to sequence the asynchronous operations
following bg.
- Response to job control of user commands on some OSes (MacOS,
for example) is unpredicatble.
Don't close associated file descriptors in the closem()
tidy up function as they should remain visible to external
processes. Override if about to exit.
Unit test for the failing case: note this relies on the
existence of /proc/self/fd or equivalent.
Seen with magic-space.
If there's a parse error in command subtitution we need to complete
reading history to ensure the command line buffer is finished.
Move detection of key/value pairs down into prefork().
Detect normal array assignment and [key]=val array assignemnt
separately. Mark key / value pairs with Marker and pass up flag. Deal
with marked triads specially later on.
Works for both normal and typeset case, also var+=...
Still to do: allow to be mixed with straight array assignment,
improve typeset -p, implement [key]+=value.
This sets the shell emulation mode similarly to ARGV0=... which
doesn't work from other shells.
Note that this gives more comprehensive emulation than running
emulate within the shell.
It wasn't suppressed properly in the code following an if
in some circumstances, in particular in initialsation scripts
and also in a nested function where the caller had suppressed
it.
There was an exception to the usual ERR_EXIT pattern that causes
problems when executing a function in an else branch. It seems
the exception is no longer needed as the regression tests pass
without it.
When we went off the end of the array but measured the length
implicitly, we got lucky before. After 41308 we were looking up lengths
in stale memory.
Rename some variables, clean up the logic, be easier to understand.
Add tests.