1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-25 05:27:12 +02:00
Commit Graph

3985 Commits

Author SHA1 Message Date
Kamil Dudka
a8cc017c74 43791: File descriptor could be closed twice in clone 2018-11-09 10:54:47 +00:00
Oliver Kiddle
5a70701788 43805: make nearcolor module use the default colour rather than black as a fallback 2018-11-08 11:01:36 +01:00
Oliver Kiddle
9eba4d3a44 43804: also need to be able to turn colour attributes back into hex triples for region_highlight variable 2018-11-08 11:01:29 +01:00
Oliver Kiddle
71c9130ede unposted: add usual copyright header to nearcolor module sources 2018-11-08 11:01:27 +01:00
Oliver Kiddle
50597692e0 43759: add support for true colour terminals 2018-11-05 22:24:12 +01:00
Oliver Kiddle
37d0005a9e 43747: new module to map colours from hex triplets to the nearest matching colour 2018-11-05 22:24:05 +01:00
Sebastian Gniazdowski
5556e00c65 43695: minor but simple optmiisation to use existing string length 2018-10-23 09:33:55 +01:00
Daniel Shahaf
bf9da44931 unposted: internals: Document sepjoin(). 2018-10-14 14:02:34 +00:00
Peter Stephenson
fa5b9bf6ee 43674: Split more PM_ flags for variables and functions.
This avoids using sign bit.

Also bump dev version because of wordcode incompatibility.
2018-10-12 09:25:04 +01:00
Peter Stephenson
0d3a786b7c 43669: ensure explicit exit status is used over implicit 2018-10-10 11:17:58 +01:00
Peter Stephenson
bbccbe0c85 43660: extend 43653 when final exit is implicit.
Combine logic for case after committed to exit (shell_exiting) with
case where exit occurred in a function we nee to unwind (exit_pending).

Add sarky note for future generations to be confused at.
2018-10-09 14:38:26 +01:00
Peter Stephenson
9ede8c657f 43656: special tied arrays don't have tieddata 2018-10-09 11:21:47 +01:00
Peter Stephenson
d768a7492a 43653: explicit exit from EXIT trap overrides exit status 2018-10-09 10:05:05 +01:00
Peter Stephenson
f99f7dca75 43616: Various parameter setting and display fixes.
Mostly to do with typeset -p and tied variables and their interaction.

Some general tied variable fixes.
2018-10-08 10:10:42 +01:00
Peter Stephenson
623294a3ed 43589: Further improved subjob reporting.
Show subjob status instead of user-visible superjob any time
the subjob still has associated processes.
2018-10-03 11:32:39 +01:00
Daniel Shahaf
d756c4d5cb 43531: Completion: Fix some false positives in the logic for "are these two candidates completions equivalent". 2018-09-30 22:18:46 +00:00
Daniel Shahaf
80ff65dc42 43570: Start documenting jobs.c, in particular superjobs. 2018-09-28 16:21:47 +00:00
Peter Stephenson
c2d65a3a6e 43564: improve job control report about stopped subjob 2018-09-26 16:23:00 +01:00
Daniel Shahaf
db67cc2f4b 43489: Add error checking on a new write() call.
Silences a compiler warning (write(2) is declared with warn_unused_result
in current Debian Unstable).
2018-09-25 19:35:15 +00:00
Peter Stephenson
464065f429 43543: Further improvements to fg/bg of superjob/subjob.
Attempt to keep STAT_STOPPED correct for superjob, rendering additional
"stopped = 1" unnecessary.

Wait for subjob before superjob.
2018-09-25 19:25:10 +01:00
Stephane Chazelas
a75b47973d 43546: "typeset -p" should show -U flag 2018-09-25 10:06:18 +01:00
Peter Stephenson
0a20f4e5a6 43535: Fixes for bg / fg handling of superjobs.
Be more consistent about marking both superjob and subjob as
running when sending SIGCONT.

Send SIGCONT to superjob / subjob combination any time it is put
in foreground, even if thought running, since subjob may invisibly
have suspended.

When waiting for superjob, wait for subjob, too.
2018-09-24 21:32:40 +01:00
Peter Stephenson
e76ea18477 43511: Initialiase alias entry on input stack.
This didn't happen if neither history nor alias expansion was in use.
2018-09-21 16:29:07 +01:00
Peter Stephenson
551ff84272 43464: Another attachtty() fix.
If list_pipe_job triggered more than once we need to know
the most recent process group leader, so record that
both if the attach happened in the main shell on in
entersubsh().

Also don't pass back proocess group for ESUB_ASYNC subshells.
2018-09-16 19:13:38 +01:00
Peter Stephenson
07ad7fd970 Fix windowsize when reattaching to terminal on process exit 2018-09-12 09:49:14 +01:00
Peter Stephenson
7c5241edf3 43446: More entersubsh() / addproc() wiring.
Fix additional races by passing back use of list_pipe_job
from subshell.
2018-09-12 09:22:10 +01:00
Jörg Thalheim
03a51a6f09 GitHub #28: Add missing math.h include for builtins
math.h is required for isnan/isinf
2018-09-10 13:05:46 +00:00
Peter Stephenson
0d5275c6b9 43409: Fix process group setting in main shell.
A newly forked subshell now reports back the process group it
will be using for the main shell to record.

This prevents an error where the shell incorrectly thought an
exiting process owned the terminal and so grabbed it back,
putting the foreground process into the background.
2018-09-07 17:49:35 +01:00
Anthony Sottile
1c4c7b6a4d
CVE-2018-0502, CVE-2018-13259: Fix two security issues in shebang line parsing.
See NEWS for more information.

Patch by Anthony Sottile and Buck Evan.
2018-09-03 15:07:47 +00:00
Peter Stephenson
3ad2ca3305 Don't handle ZLE functions for single key.
For read -k and read -q where we use ZLE, we just want a single
key and not full ZLE processing.  So don't handle timed
ZLE functions when preforming the read.
2018-09-03 10:09:22 +01:00
Oliver Kiddle
014eaf7e81 43358: enforce consistent patchlevel form 2018-08-31 23:34:11 +02:00
Peter Stephenson
3c93497eb7 43294: Add ZLE_RECURSIVE parameter. 2018-08-17 19:43:17 +01:00
dana
b21a641d4c 43275: Add log2 to match func 2018-08-13 09:36:55 +01:00
Peter Stephenson
f58b35bf88 43264: fix ${+assoc[nonexistent]} with KSH_ARRAYS 2018-08-09 09:48:35 +01:00
Peter Stephenson
225b35c907 43261: Fix unary minus with base.
Apply unary minus to a complete lexical constant rather than the
first component that comes along.
2018-08-08 17:11:54 +01:00
Jun-ichi Takimoto
ad9f07e66f 43227: fix memory leaks in term{cap,info}.c 2018-08-01 21:36:44 +09:00
Jun-ichi Takimoto
baedd62f0d 43219 (except term{cap,info}.c): fix several memory leaks 2018-07-31 22:15:58 +09:00
Peter Stephenson
e6f2d776d3 43225: Recalculate ZLE timeout.
Needed when looping owing to having handled a special fd.
2018-07-30 15:39:51 +01:00
Peter Stephenson
3e9fc32fc3 43156, 43157: Need to allow for extra space in gethere().
The point can now increment twice per iteration.
2018-07-10 14:42:02 +01:00
Peter Stephenson
17178db1a4 users/23531: Error exit/return fixes.
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.
2018-07-09 11:07:53 +01:00
Daniel Shahaf
3d7215cc82 43091: In the (u) glob qualifier, expand and correct "unknown user" error messages. 2018-06-25 11:18:41 +00:00
Peter Stephenson
0a6cb5078d 43084: Variable warning suppression enhancements.
Add vared -g option along the lines of typeset -g.

Set reply safely in zsh_directory_name_cdr.
2018-06-25 09:31:40 +01:00
dana
394f3a47e4 43075: Support nanosecond-precision time formatting
* 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
2018-06-20 17:29:56 -05:00
Peter Stephenson
eada7e1138 43077: Fix shift builtin status.
If the math evaulation to get the shift count failed the status
wasn't passed back from the builtin.
2018-06-20 12:09:43 +01:00
Eitan Adler
f311619e30 433029: Testing signal return type is no longer needed 2018-06-18 10:18:29 +01:00
dana
796637362a 43039: Mark functions_source (et al.) for auto-loading 2018-06-17 20:34:17 -05:00
Peter Stephenson
9408c4825b users/23472: Add $sysparams[procsubstpid] to zsh/system 2018-06-15 15:02:36 +01:00
Peter Stephenson
f37c181b29 43008: Improve code to remove privileges.
Remove warnings of unused values as we always check the finally
result later.

Put segid before setuid as the setgid could fail if UID
no longer privileged.
2018-06-15 10:27:29 +01:00
Eitan Adler
96ec8cbbf4 42938: name argument to math_func is not unused 2018-06-06 09:35:38 +01:00
Eitan Adler
6a3b23e9cc 42939: pm argument to set_registers is not unused 2018-06-06 09:33:28 +01:00
Jun-ichi Takimoto
1a97dcbed1 42870: another improvement of 'compset -q'
zlemetall need not count the 'x' added at the cursor in set_comp_sep()
2018-05-31 21:07:53 +09:00
Jun-ichi Takimoto
e5f356a95e 42809: slightly improve 'compset -q' 2018-05-25 21:11:20 +09:00
Stephane Chazelas
5ac1c6f555 42790: make [[:blank:]] match non-ASCII blanks 2018-05-17 23:42:27 +02:00
Peter Stephenson
1d2f684c9b 42793: Always define FDT_PROC_SUBST even if not needed.
This avoids proliferating #ifdef's.
2018-05-17 10:00:37 +01:00
Peter Stephenson
ee7dda7806 42785: Allow redefining math function to work silently.
Previously it failed with an error message that the function
was already defined.  This is inconsistent with most other
aspects of shell usage.
2018-05-17 09:32:26 +01:00
dana
b066cc3ea9 42297: (e) subscript flag needs extra work with scalars 2018-05-14 16:54:19 +01:00
Peter Stephenson
449f13a467 42234: Stephane: don't kill a process if not running.
This could happen when kiiling a job.  The processs might be reused.
2018-05-14 16:47:29 +01:00
Oliver Kiddle
a93abe1170 42488: test cases for 42369 and address some issues in the code 2018-05-13 10:13:42 +02:00
Oliver Kiddle
373efa085d Nelson H. F. Beebe: 19597 (rebased 42369): return Inf, NaN etc from floating point operations instead of errors to allow non-stop IEEE 754 arithmetic 2018-05-13 10:02:01 +02:00
Oliver Kiddle
f0c2cf8607 42760: move stack variable outside while loop scope as it is accessed in the while condition 2018-05-13 09:51:05 +02:00
dana
eeeba19c96 42185: safety when removing separators in completion 2018-05-11 09:33:05 +01:00
dana
805192311f 42101 (tweaked): assigning shell status to array was broken 2018-05-11 09:29:14 +01:00
Peter Stephenson
c8ceb66ba3 42751: Protect shell status in ZLE timed function handler.
Otherwise status from sched and other asynchronous functions
could escape back to the main shell.
2018-05-08 10:18:19 +01:00
Peter Stephenson
faf0035e53 unposted (branch fork_early): Fork early for pipelines.
If executing a command not at the end of a pipeline, and
not optimised in the calling code, we can fork before
"prefork" substitutions, at the same point as
for background commands.

Move fork before our preliminary scan of arguments to find
a command: in the cases of early fork
we don't need this information before forking.

Ensure we _exit if forked in execcmd_exec().

Rationalise use of forks and pipes.

Ensure we _exit instead of returning from execcmd_exec() if we
have forked.  Before the optimisation code after the fork always ran
to the check at the end, but that code is overkill for the logic
between the early fork and the existing one.

Remove old workaround to fork in caller of execcmd for current shell
constructs as no longer needed with early fork below.

Close input of newly created pipe on fork (destined for RHS of pipe
which we never execute): this replaces a workaround from
zsh-workers/32171, commit 9887fc3d7b.

Set last1 on early fork as needed by some instances of shell
constructs on LHS of pipeline to know they are exiting.
2018-05-01 10:27:35 +01:00
Ricardo Giorni
f7519811e1 47201: fix 42355 for multiple backslashes 2018-04-29 12:05:39 -07:00
Daniel Shahaf
76b5b3a504 unposted: Correct process substitution buffer size in the PATH_DEV_FD codepath. 2018-04-25 15:31:39 +00:00
Peter Stephenson
95d861d028 42708: fix for process substitution.
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.
2018-04-24 11:48:11 +01:00
Peter Stephenson
9ad9c5cda1 42705: Another safety fix for pgrp reclaiming.
Only do this if killpg(dead_pid, 0) returns -1, indicating
the pgprp doesn't exist any more, else there is a race
if other proceses have started using it.
2018-04-23 15:11:34 +01:00
Peter Stephenson
11f18457d2 Allow short loops with "while" 2018-04-23 13:45:08 +01:00
Peter Stephenson
9e2afb9298 42684 (with extra comments): Fork early if in bg.
In execcmd the case of running the last command in a pipeline
asynchronously for the purpose of & and &! is easy to work out,
and we can avoid side effects and unnecessary execution time in
the parent shell by forking earlier.
2018-04-20 10:36:39 +01:00
Peter Stephenson
0f29b5148e 42686: Fix previous pgrp patch.
We shouldn't do any fix ups unless the process has actually
exited.
2018-04-19 13:58:10 +01:00
Peter Stephenson
3c74891fcd 42630: Improve process group handling in pipelines.
If process group leader exits, allow a newly forked process to become
process leader.  If a foreground job, reattach the shell to the
terminal until that happens.

Unblock signals when reading output for command subsitution so that
we can do this reattaching immediately.
2018-04-17 17:14:20 +01:00
Barton E. Schaefer
68d9526220 42650: fix 42156 for zero-sized terminals
Also fix harmless no-op typo from hand-applying 42636 for previous commit.
2018-04-15 11:06:43 -07:00
Barton E. Schaefer
517cda3832 42636: fix GLOB_DOTS for !(RM_STAR_SILENT)
Also fix paste-o in older log entry
2018-04-15 10:57:27 -07:00
Oliver Kiddle
65b265f3c0 42624 (plus test): avoid freeing memory that's still needed
This was occurring in a multiple function definition where a
function name is duplicated.
2018-04-12 23:15:29 +02:00
Oliver Kiddle
8e6c1d8b47 42605: properly free the vi registers hash 2018-04-07 18:52:37 +02:00
Oliver Kiddle
d8753f47bb 42601: tidy up code for set -A/+A to not increment a NULL pointer and to be more efficient 2018-04-07 18:48:00 +02:00
Oliver Kiddle
31f7220563 42607, CVE-2018-1100: check bounds on buffer in mail checking 2018-04-07 18:28:38 +02:00
Oliver Kiddle
4044d73706 42600: error paths for _values leaked the exclusion list array 2018-04-07 14:37:46 +02:00
Oliver Kiddle
90afd36922 42597: plug memory leak found by coverity 2018-04-07 14:37:46 +02:00
Oliver Kiddle
bd05c4b2de 42595: remove dead code flagged by coverity 2018-04-07 14:37:46 +02:00
Oliver Kiddle
25da576c29 42575: fix to not complete options in the argument to another option 2018-04-05 11:14:58 +02:00
Peter Stephenson
3517e4a9a5 42581(?): Fix ZLE inline history expansion.
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.
2018-04-04 18:33:00 +01:00
Oliver Kiddle
bdf09270be 42560: silence sign-compare compiler warnings 2018-03-30 12:13:59 +02:00
Oliver Kiddle
c053c6a079 42539: prevent overflow of PATH_MAX-sized buffer in spelling correction 2018-03-28 09:00:58 +02:00
Martijn Dekker
fa0105f78c 42538: Temporarily set umask for here document.
Done while signals are queued.
2018-03-27 09:32:55 +01:00
Barton E. Schaefer
9bc391105f 42480: optimize $#var for single-byte character sets 2018-03-25 18:01:25 -07:00
Oliver Kiddle
259ac472ea 42519, CVE-2018-1083: check bounds on PATH_MAX-sized buffer used for file completion candidates 2018-03-24 15:04:39 +01:00
Oliver Kiddle
679b71ec4d 42518, CVE-2018-1071: check bounds when copying path in hashcmd() 2018-03-24 15:04:02 +01:00
Jun-ichi Takimoto
beadc29214 unposted: add 'static' to a file-local variable 2018-03-24 15:32:43 +09:00
Jun-ichi Takimoto
e4a8069b32 42501: avoid out of bound pointer (as 42487) 2018-03-24 15:22:10 +09:00
Peter Stephenson
bc349023aa 42487: Fix pointer problems in compctl.
Pointing off the front of a string caused warnings with
gcc 7.3.0 and is somewhat murky C anyway.
2018-03-21 10:29:22 +00:00
Stephane Chazelas
d2350a1e80 42469: necessary repairs to 42465 found by "make check" 2018-03-18 16:49:42 -07:00
Stephane Chazelas
1219eae829 42465: Pass up error status from readoutput().
This improves the consistency of error reporting from $(...) constructs.
2018-03-15 09:21:47 +00:00
Peter Stephenson
7fd8e380bf 42453: Fix race in look up of status for wait.
Background jobs that had just exited could still be in
the table when the process had already finished and the
status was recorded, causing the wrong status to be reported.
2018-03-12 15:26:34 +00:00
Martijn Dekker
54ea6a8cd5 42365: Use .zwc file if timestamp identical to source.
This can happen if the files are bundled together.
2018-03-05 09:31:11 +00:00
Taylor West
14c17aa178 42411: Assume current C librarires handle free(NULL) 2018-03-04 20:57:58 +00:00
Peter Stephenson
1d6954bd2f 23180: Fix expand-or-complete with ~[...].
The square brackets shouldn't be treated as wildcards.
2018-02-26 21:43:12 +00:00
Peter Stephenson
14743c0dfd 42401: workaround for gcc -foptimize-strlen oddit.
Use realloc(NULL, ...) instead of malloc in zsh-mem calloc().
2018-02-26 20:21:56 +00:00
Peter Stephenson
5b946f6c4d 42362: protect REPORTTIME logic from bad status 2018-02-17 22:35:32 +00:00
Peter Stephenson
47aa60950c 42355: Fix use of backslashes on here doc input.
Handling of white space in particular was confusing and inconsistent
with other shells.
2018-02-12 10:06:45 +00:00
Peter Stephenson
2cbf6b6a19 42332: Special case unsigned printf formats.
For constants we can avoid a conversion to signed by examining
the expression before passing to math eval.
2018-01-31 09:14:40 +00:00
Peter Stephenson
758966502c 42322 (tweaked): Fix interactive_comments history with just a coment.
Don't discard the line from the history merely because it produced
no synactic words.
2018-01-24 17:40:56 +00:00
Joey Pabalinas
110b13e109 42313: avoid null-pointer deref when using ${(PA)...} on an empty array result 2018-01-23 22:28:08 -08:00
Mikael Magnusson
5c656716ff 42243: Free stuff properly in zsh/pcre module 2018-01-20 13:33:12 +01:00
Warepire
d8d9fee137 42285: off by one fix in multiple prompts 2018-01-16 09:31:16 +00:00
Barton E. Schaefer
de6a293159 42136: empty string check in %~ / %C prompt expansions 2018-01-14 03:15:49 -08:00
Barton E. Schaefer
b476d89fa2 42043: ZSH_DEBUG_CMD should not WARN_CREATE_GLOBAL 2018-01-14 03:07:32 -08:00
Peter Stephenson
36fcaeb167 42245: Abort last word on interactve comment.
Last recorded word should be the previous one.
2018-01-08 17:26:33 +00:00
dana
1af28cbfd7 42164: fix digits in format escapes in completion listings 2018-01-04 17:16:18 +00:00
Stephane Chazelas
c2cc8b0fbe Avoid crash copying empty hash table.
Visible with typeset -p.
2018-01-04 17:12:13 +00:00
Sebastian Gniazdowski
1e46f73b8e 42188: Close flock descriptor in failure cases 2018-01-04 17:06:22 +00:00
Peter Stephenson
5f6a52c06c 42156: new CHECK_RUNNING_JOBS option demanded by bash groupies
Also new job options.

Also suppress debug error if rows or columns are reported as zero as
this is normal without a physical terminal.
2017-12-22 20:21:23 +00:00
Peter Stephenson
8ec3d17b4b 33395: Improvments for function managment.
Functions defined inside other fucntions needs file line number
adding.  Particularly useful for anonymous fucntions.

Add flag to indicate a function is anonymous.  Done up to now
by comparing the name to a pointer but this is more consistent.
2017-12-22 19:51:04 +00:00
dana
932ed86483 dana: 42145: Fix additional completion cases with option arguments. 2017-12-20 09:07:28 +00:00
Daniel Shahaf
4b55c0f40c 42146: type -w += global aliases
Follow-up to 36403, which did the same for suffix aliases.
2017-12-20 05:43:42 +00:00
Daniel Shahaf
a9e60dc179 users/13148 (and workers/42060): Abort the command line when replying
"[n] No" to the RM_STAR_SILENT prompt.

Patch by Stephane, rebased by Mikael.
2017-12-20 04:13:01 +00:00
Jun-ichi Takimoto
dae5d1d5ba 42412: fix a bug in 42116
Also fix a few widgets which were calling wrong function when negative
numeric argument was given.
2017-12-18 23:49:31 +09:00
Jun-ichi Takimoto
5f33a93afb 42116: multibyte support for ZLE vi-mode word motion 2017-12-18 12:48:25 +09:00
Peter Stephenson
aab0f6d763 42123 (tweaked): take account of Dash in function names.
Needed when comparing word code function name with autoload request.

Add test.
2017-12-15 09:00:37 +00:00
dana
cb04ae40af add millisecond and microsecond options to TIMEFMT variable 2017-12-14 15:36:46 +00:00
Peter Stephenson
97c74dcb0e 42110: Fix redirections between variable assignments at start of line 2017-12-12 09:13:41 +00:00
dana
755f8571d4 42063: getopts errors now report "+" in front of option where appropriate 2017-12-01 09:19:13 +00:00
Daniel Shahaf
77a39b57bf 42031 + 42048: Make [[ -o invalidoption ]] a normal(ish) false value, rather than a syntax error. 2017-11-24 22:10:27 +00:00
Dima Kogan
487489c522 stat() for glob qualifiers lost information in corner case 2017-11-20 09:59:51 +00:00
Oliver Kiddle
1bfcff129d 41983: fix exclusion of long options with (-) on a normal argument 2017-11-04 00:57:48 +01:00
Martijn Dekker
bf04ffb542 41866: No error unsetting nonexistent function for POSIXBUILTINS 2017-11-02 20:03:45 +00:00
Barton E. Schaefer
dcd4f02845 41902: ${(z)...} continues parsing on unmatched quote when CSH_JUNKIE_QUOTES is set
Tests for 41902 and 41873
2017-10-17 20:29:47 -07:00
Barton E. Schaefer
1fb6939b94 41873: temporarily disable effects of ${(Z:n:)...} for parsing $(...) within the parameter value
Also fix minor typo in commit b3fa5c52 ChangeLog.
2017-10-13 13:50:18 -07:00
Peter Stephenson
b3fa5c528c 41877: Separate out SH_FILE_EXPANSION loop from parameter substitution.
Parameter substitution can add nodes that need to be rescanned by
it, but not by file expansion, so the two don't play well together.
2017-10-13 18:17:09 +01:00
Oliver Kiddle
233c0e8903 41835: handle multibyte characters with compset -p and -s 2017-10-11 01:23:42 +02:00
Barton E. Schaefer
b84d69cf52 41828, 41830: skip SHFILEEXPANSION for new nodes added by stringsubst() in prefork() 2017-10-08 18:08:09 -07:00
Oliver Kiddle
12902206b7 41824: fix to not complete rest args from an _arguments set alongside the argument to and option in a separate set 2017-10-07 22:35:59 +02:00
Peter Stephenson
e573857a03 41802 (minor tweaks): use heap during shell function call.
Replaces stack for more efficient memory management.

Also fix debug message when FUNCNEST is increased.
2017-10-04 09:18:51 +01:00
Peter Stephenson
174e560a23 41787 (plus minor tweaks): use $FUNCSTACK for function nesting depth.
Initialised from existing configuration value.
2017-10-02 09:44:26 +01:00
Peter Stephenson
728f2adfc8 Add typeset -p1, like typeset -p with newlines 2017-10-01 17:53:56 +01:00
Peter Stephenson
a1276c88e1 41789: Don't save fd if -1.
We try to move an fd which isn't opend but it will feel.
This needs handling specially in the new code for marking
saved fd's.
2017-09-29 16:29:49 +01:00
Oliver Kiddle
80a02c10aa 41772: fix bug in handling of long options with _arguments' -A option 2017-09-28 09:31:35 +02:00
Barton E. Schaefer
7a0718796a 41767: preserve nonzero exit status on interrupt 2017-09-27 20:34:11 -07:00
Peter Stephenson
6230e82d44 41764 (test tweaked): allow [key]+=value when modifying arrays 2017-09-27 09:41:50 +01:00
Peter Stephenson
03af5fdbee 41761: Ensure status from interrupt is propagated by builtin 2017-09-26 09:26:57 +01:00
Peter Stephenson
7d4b41b52a 41747: Don't create hash entry if just checking existence.
Pass a flag in indicating this case.
2017-09-25 20:03:05 +01:00
Peter Stephenson
85b0dd7133 Updates for ksh array element syntax.
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.
2017-09-24 17:33:07 +01:00
Daniel Shahaf
ced82745ea unposted (cf. 41672): checkrmall: Record the 41672 bug in a TODO. 2017-09-21 18:17:19 +00:00
Daniel Shahaf
15bed0db40 unposted (cf. 41707): internal: Document the count==0 case of checkrmall(). 2017-09-21 18:14:01 +00:00
Barton E. Schaefer
d1914c5af4 41736: NO_INTERACTIVE_COMMENTS in $(...) 2017-09-20 10:17:59 -07:00
Barton E. Schaefer
d29ad85533 41723: one more case of 41627 in "while" loops. 2017-09-18 08:40:02 -07:00
Peter Stephenson
ab7be4238c More [key]=value tweaks
Some rephrasings.

Update typeset -p for associative arrays to use new syntax.
2017-09-14 21:43:37 +01:00
Peter Stephenson
54b3958440 First go at var=([key]=value) syntax.
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.
2017-09-13 20:54:00 +01:00
Peter Stephenson
da4146bdff 41688: builtin wait for all jobs should ignore STAT_NOPRINT 2017-09-13 10:49:06 +01:00
Daniel Shahaf
ed7497e379 unposted: internal: Document zreaddir(). 2017-09-11 15:06:08 +00:00
Thierry Ghelew
9f2271168d 41666: zpty compatibility for OpenBSD 2017-09-11 10:15:15 +01:00
Peter Stephenson
2ef3dff65a 41668: New --emulate option on invocation.
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.
2017-09-11 10:12:17 +01:00
Peter Stephenson
c9df6bc8d4 41662: exec -a arguments weren't sanitised 2017-09-10 18:02:52 +01:00
Peter Stephenson
e44600d9aa 41661: Need to remove tokens before using bufferwords() for (z) 2017-09-10 18:01:39 +01:00
Peter Stephenson
ea5b38935a 41641: Some math operations shouldn't be lvalues.
This includes pre- and post- increment and decrement.  Simply
mark all values after operations as rvalues.
2017-09-05 13:15:30 +01:00
Peter Stephenson
5a8155f7b7 41633: Fix problem backgrounding function definitions.
Owing to being marked as simple sublists the instruction to
background was ignored.  This applied to anonymous functions.
2017-09-04 21:36:46 +01:00
Peter Stephenson
ebcea98eca Fix problem with ERR_RETURN.
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.
2017-08-31 16:54:19 +01:00
Peter Stephenson
7d1877da4e 41608 (plus tests): restore ERR_EXIT before function.
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.
2017-08-29 19:52:18 +01:00
Peter Stephenson
97d4bdbc7e 41590 modified as 41595: make ERR_RETURN more logical.
It now operates separately at each function depth.

To keep ERR_EXIT global, make the noerrexit variable usd bit flags.

Extend tests.
2017-08-24 19:46:20 +01:00
Peter Stephenson
ddb8675901 posted but has not shown up: fix fd problem in subshell.
Record fd's that have been saved in fdtable and if the shell
forks close them as they will never be restored.
2017-08-15 20:49:23 +01:00
Peter Stephenson
74aff4106a 41542: Fix pcre logic for extracting matched parentheses.
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.
2017-08-14 11:17:48 +01:00
Phil Pennock
b5f40f4156 41527 (tweaked for heap memory): fix [[ -<cond> ]] from modules 2017-08-11 15:02:06 +01:00
Peter Stephenson
cfd34c75ac 41504: make empty strings work in case patterns with no leading parenthesis 2017-08-09 19:57:47 +01:00
Peter Stephenson
a9b579a9d3 Revert "41499 (with one further tweak): POSIX_STRINGS behaviour."
This reverts commit 2eacbef919.

Conflicts:
	ChangeLog
2017-08-08 19:04:49 +01:00
Peter Stephenson
2eacbef919 41499 (with one further tweak): POSIX_STRINGS behaviour.
Ignore a terminating delimiter when splitting as separators
despite being called separators are terminators.
2017-08-07 18:47:43 +01:00
Martijn Dekker
a51cd62b45 41484: Make ${(q+)...} quote backsleshes. 2017-08-03 21:32:20 +01:00
Peter Stephenson
d4b94b5e83 41464, 41466: With POSIX_BUILTINS, exec only executes sexternal commands.
Document the default behaviour and add a test.
2017-07-27 09:22:04 +01:00
Peter Stephenson
a3b3f00575 41420: "{.." wasn't check for brace expansion properly 2017-07-13 17:20:24 +01:00
Sebastian Gniazdowski
b31f947795 41402: Delay has_tokens() in ecstrcode as may not be needed 2017-07-09 17:38:01 +01:00
Sebastian Gniazdowski
e556f9c78d 41402: Add hasher to ecstrcode to reduce string comparisons 2017-07-09 17:34:55 +01:00
Peter Stephenson
a955065cda Delay processing "disown" for superjob.
This is a job forked from the current shell when a job partly
running from the current shell was suspended.  When all associated
processes started from the main shell are finished the job is
continued and at this point the disown can complete.
2017-07-04 09:40:45 +01:00
Maxime de Roucy
cdd9402224 Avoid invalid access with isearch in completion list 2017-07-04 09:38:23 +01:00
Sebastian Gniazdowski
6116fdb277 41375: GDBM interface bug fixes 2017-07-03 10:02:01 +01:00
Peter Stephenson
ae10f88bfb 41386: when backgrounding a STAT_CURSH job, remove the flag.
This typical applies to a STAT_SUPERJOB.  It prevents it from
getting copied interrupts as a foreground process.
2017-07-02 21:00:56 +01:00
Peter Stephenson
e8edd42f7f 22760: fix partial string length reports with NO_MULTIBYTE 2017-07-02 20:29:00 +01:00
Peter Stephenson
e19955614f 41368: Add missing unqueue_signals() to compctl. 2017-06-27 10:12:55 +01:00
Phil Pennock
825f84c77e 41308 (tweaked): behaviour of PCRE with NUL bytes 2017-06-22 09:24:33 +01:00
Mikael Magnusson
8a62bbb46a 41319: dupstring a possibly readonly string before modifying 2017-06-19 16:18:36 -07:00
Barton E. Schaefer
9de905b22f 41322: reduce number of changes in signal queuing/blocking state during shingetline() to improve read speed 2017-06-19 16:14:32 -07:00
Barton E. Schaefer
a5ed661f25 41317: use heap allocation in getoutputfile() to plug memory leak
Heap is usable ever since addfilelist() of workers/31528 (commit 3c573222).
2017-06-19 16:06:38 -07:00
Barton E. Schaefer
efae75f648 41242: zstrbcmp(...) removed in favor of zstrcmp(..., SORTIT_IGNORING_BACKSLASHES)
This should make sorting consistent in completion listings vs. elsewhere.
2017-06-17 10:25:43 -07:00
Stephane Chazelas
4d007e269d 41275: Leave stdin open when executing widgets 2017-06-13 21:34:55 -04:00
Peter Stephenson
eb783754bd 41284: Fix NULL dereference in cd.
This happened in sh compatiblity mode if HOME was not set
and cd was used with no argument.
2017-06-13 15:41:00 +01:00
Peter Stephenson
d5c22d356b 41244: Add zmodload -s option.
Doesn't complain if module is unavailable, but prints more
obscure errors.

Use existing low-level silent flag by passing through
intermediate module loading hierarchy.
2017-06-12 10:10:23 +01:00
Peter Stephenson
d4947e67cc 41239: Save and restore default history event on context stack.
This ensures that the default event set by an expansion in ZLE
doesn't propagate to the command line expansion.
2017-06-07 10:03:41 +01:00
Barton E. Schaefer
11d2dbda38 41225: sethparam() should not attempt to change special parameters into hashes 2017-06-05 09:45:45 -07:00
Peter Stephenson
a6135f6114 41191: Check for immortal thingies when checking for specific thingies 2017-06-01 17:56:14 +01:00
Peter Stephenson
151a4660e2 41164: Don't free a history entry if it's curline.
This replaces 41113 / 94014ff65b with a simple local change for the
immediate problem.  It's not entirely clear if this reflects wider
changes in the structure of the history code.
2017-05-30 09:39:32 +01:00
Sebastian Gniazdowski
284b5aaeb0 41151: propagate flags when creating new parameter 2017-05-28 13:17:26 -07:00
Sebastian Gniazdowski
ca0607c4c2 41153: finish module setup only after all error conditions have been checked 2017-05-28 13:15:06 -07:00
Sebastian Gniazdowski
62c416915b 41146: careul in GDBM freeing strings with embedded nulls 2017-05-24 15:55:42 +01:00
Sebastian Gniazdowski
135075e48c 40898: fix GDBM error handling 2017-05-24 15:53:42 +01:00
Stephane Chazelas
99fff8f15c 41142: Ensure close-on-exec is passed to moved file descriptor 2017-05-23 17:03:31 +01:00
Peter Stephenson
94014ff65b 41113 (tweaked): Save current line linkage to history ring.
When saving history state save whether the current history line
is linked into the ring and remove it, and restore as appropriate
later.  This avoids surprises where the history ring is freed
and incorrectly frees the current state in curline, which has
a different allocation strategy.

Original patch tweaked to make restoring more logical.
2017-05-18 09:33:08 +01:00
Jun-ichi Takimoto
171e7fa4c1 41090: Replace iswprint() if unicode9 is enabled.
If wcwidth() or iswprint() is broken, force enable unicode9.
2017-05-12 12:10:13 +09:00
Peter Stephenson
4bb81eefbd 41096: Don't assume null termination copying string.
At this point the string may contain embedded nulls or not have
a null termination at all.

Also, as we always have the length memcpy() is more efficient.
2017-05-11 17:33:30 +01:00
Peter Stephenson
c7a9cf465d 40181: Fix buffer overrun in xsymlinks.
There was no check for copying to the internal xbuf2 for a
preliminary test.
2017-05-09 17:49:18 +01:00
Peter Stephenson
263a0c2476 41078: Empty psvar could cause bad dereference in prompt expansion 2017-05-09 09:46:23 +01:00
Peter Stephenson
af1c82d646 40173: Off-by-one error checking for {varid}.
This caused a single unprintable character in braces before a
redirection to be treated as an indentifier.
2017-05-08 18:00:55 +01:00