Commit graph

3927 commits

Author SHA1 Message Date
dana
c1a33575b4 44275: Fix compset -p/-s multibyte inconsistency and documentation 2019-05-08 16:35:08 -05:00
Oliver Kiddle
cd6fd2b0a3 44274: allow finer control of completion match soring with compadd's -o option 2019-05-07 23:24:49 +02:00
dana
6f202377c7 44267: sort: Restore option to ignore backslashes
Fix regression introduced by workers/41242
2019-05-03 20:13:48 -05:00
Peter Stephenson
588bb77cb6 44271: Fix breaks propagated from until or return.
If the until or return test caused continuation but there was
a pending return, breaks didn't get cancelled causing enclosing
scope to skip commands.
2019-05-03 20:34:53 +01:00
Peter Stephenson
ca456fbba3 44284: Mark SIGQUIT as ignore if ignored on entry to shell.
This prevents us from re-enabling it after a fork if it is being
ignored.
2019-04-25 20:29:54 +01:00
Peter Stephenson
d4972af12c 44254: Handle error case in zgetdir().
When retrieving path to current directory by looking for /,
ensure we have actually reached / by comparing inode.
If the current directory became invalid on some OSes including
Linux the parent directory is valid but is the same as the
current one.
2019-04-25 17:09:26 +01:00
dana
64d1373835 43288: fix line-broken prompts
Without re-breaking the case where a newline character lands in column 0.
2019-04-18 20:54:19 +02:00
dana
78fb8aaccf 44198: Add cd_silent option to suppress all cd output 2019-04-12 14:00:19 -05:00
Peter Stephenson
5e11082349 44168 (tweaked to remove change to errflag): Fix interrupt handling of zle -F.
If interrupted by irrelevant interrupt (EINTR only is set), don't set
the local error flag, just retry.
2019-04-10 20:56:53 +01:00
Eric Freese
5c165453ab 44214: <(...) substitutions shouldn't grab the terminal 2019-04-10 09:44:58 +01:00
Roman Perepelitsa
c551937280 44215: Maintain LASTWIDGET across reset-prompt.
This avoids side effects of asynchronous notifications.
2019-04-10 09:41:04 +01:00
Peter Stephenson
fe228c5984 44202: Rewrite to use memmove() for possibly overlapping copy 2019-04-10 09:31:41 +01:00
Jun-ichi Takimoto
52f3266bd0 44176: warn only if off_t is longer than long 2019-03-25 23:51:57 +09:00
Wesley Schwengle
5ca680c93c 44162 (tweaked): Avoid format-overflow warning in zftp.c 2019-03-25 23:01:43 +09:00
Wesley Schwengle
51d2e91a7e 44164: Avoid stringop-truncation warning 2019-03-25 20:42:54 +09:00
Matthew Martin
5267bdc4ef 44153: rm: Accept -R as equivalent to -r 2019-03-21 22:04:55 -05:00
Charles Blake
084bf17c4b 44132: don't hash commands beginning with / 2019-03-19 14:09:50 +00:00
Peter Stephenson
73b29f079b 44142: Fix hist_reduce_spaces bug.
When there were as an unstripped comment on the line the
pointer for stripping spaces could be bogus.  Don't do
any editing in that case.
2019-03-19 13:44:47 +00:00
Matthew Martin
6331772c5b 44135: Add chmod builtin 2019-03-18 22:17:54 -05:00
Kamil Dudka
00e6ab70b8 44122: turn int into long to avoid overflow 2019-03-14 09:46:23 +00:00
dana
632023acc2 44100: zparseopts: Add -F option, completion, tests; improve documentation
* Enable zparseopts to perform basic usage validation (aborting on an
  unrecognised option-like parameter)

* Officially document the resolution of ambiguous option specs
2019-03-12 19:03:56 -05:00
Yutian Li
0afe9dc02a 44067: Make history read safer on interrupt.
Record if a read was interrupted and if so process it in full
next time a read is needed.
2019-02-18 10:10:00 +00:00
Peter Stephenson
e25de2de74 c.f. 44062: Back off clearflag change to ZLE line init.
This causes problems with failed ZLE reads that printed a message
in the display area, in particular ignoreEOF warnings.

It appears it's not needed for the overall effect of the fixes in
zsh-workers/40302, commit 34656ec2.
2019-02-14 11:41:19 +00:00
dana
ed4c8f3d5e 44030: prompt: Return error for unrecognised colour name 2019-02-03 11:55:40 -06:00
Mikael Magnusson
d683d278c7 44011: Only use fg_start_code for non-truecolor
The sequence for truecolor uses a different prefix from palette colors
2019-01-23 11:51:42 +01:00
Peter Stephenson
232b43571f 43969: untokenize Dash for compctl with GLOB_SUBST set 2019-01-03 13:51:19 +00:00
Peter Stephenson
de31fe1f93 users/23809: ZLE_HIGHLIGHT extensions.
Allow non-termcap use of colours > 7.
Add tests.
2018-12-30 18:18:34 +00:00
Martijn Dekker
2d056ebc31 43945 (tweaked to remove test failure, noted in test):
Fix exit statuses from wait for POSIX_BUILTINS mode.
Also add tests.
2018-12-30 18:11:43 +00:00
Martijn Dekker
4215fcb107 43944: apply NO_UNSET consistently to arithmeitc 2018-12-30 18:03:02 +00:00
dana
7951ede1db unposted (per 43938): Avoid segfault when unmetafying empty string 2018-12-30 03:42:07 -06:00
dana
162c198aab 43953: Fix rounding/truncation error in %. time-format specifier
Also fixes an issue where %. couldn't be used more than once in a format
string without strange results

Tweaked very slightly per workers/43954
2018-12-29 05:24:25 -06:00
dana
f64cd71d44 43935: Reject too-large nanosecond values given to strftime
... and, in so doing, fix an error in the tests on 32-bit machines.

The value for the new too-large test is changed slightly from the patch posted
to the ML to make it test for the right thing on 32-bit machines as well.
2018-12-24 02:42:18 -06:00
Bart Schaefer
c19a0927e1 43921: ${\var} should be an error 2018-12-21 11:41:07 -08:00
Peter Stephenson
ef20425381 43854: Set tok to LEXERR on generic parse error.
Needed by main loop which detects an error this way.
2018-11-29 17:54:02 +00:00
Peter Stephenson
50f8fa972c 43837 plus test from Daniel: Empty string in nested subst.
Skip Nularg or there is a bogus character at the start.
2018-11-21 10:10:03 +00:00
Jun-ichi Takimoto
8d0f7681a0 43829: nearcolor.c: use double instead of float 2018-11-19 14:57:30 +09:00
Ivan Tkachenko
e258e7d251 43823: remove unnecessary metafy() in stattimeprint() 2018-11-15 10:59:09 +09:00
dana
5ad76492af 43800: Add nanosecond support to strftime built-in 2018-11-13 13:01:01 -06:00
Kamil Dudka
d50e204b0c 43790: failed mailstat could leak memory 2018-11-09 11:06:08 +00:00
Kamil Dudka
e27175c7c8 43789: possible use after free clearing up math func from module 2018-11-09 11:04:06 +00:00
Kamil Dudka
d1095bdf74 43723: file descriptor could leak on fork error 2018-11-09 11:02:24 +00:00
Kamil Dudka
031afe4207 43793: computil could overrun buffer 2018-11-09 10:57:09 +00:00
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