Commit graph

153 commits

Author SHA1 Message Date
Martijn Dekker
c578f0a08b 45004: Fix typos in comments 2019-12-11 02:37:39 +00:00
Peter Stephenson
4384fdc7f0 44446: Fix here document with file descriptor declarator.
Add unit test.
2019-06-24 20:19:19 +01:00
Peter Stephenson
30e356eb1a 44296: "typeset Q= {X}" crashed the shell. 2019-05-14 12:10:10 +01:00
Kamil Dudka
00e6ab70b8 44122: turn int into long to avoid overflow 2019-03-14 09:46:23 +00:00
Peter Stephenson
11f18457d2 Allow short loops with "while" 2018-04-23 13:45:08 +01: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
Peter Stephenson
97c74dcb0e 42110: Fix redirections between variable assignments at start of line 2017-12-12 09:13:41 +00: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
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
cfd34c75ac 41504: make empty strings work in case patterns with no leading parenthesis 2017-08-09 19:57:47 +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
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
Peter Stephenson
641a764b82 users/22688: Allow mixing redirs and arguments after anon functions.
These are parsed differently from the case of normal functions which
can't take normal arguments at that point.
2017-05-08 17:19:22 +01:00
Peter Stephenson
f25d01a97c Fix combination of HERE document and |&.
A missing flag setting up the HERE document mean that the size
of the wordcode needed to append the 2>&1 was counted incorrectly,
so the resulting wordcode was garbled.

Add test.
2017-05-08 10:54:08 +01:00
Peter Stephenson
f3f8537cfa 40760: Always tokenize unquoted - to Dash.
This fixes use of pattern match character ranges in unusual contexts.

Attempt to detect a tokenized - in cases where we don't care.
2017-03-07 10:43:58 +00:00
Barton E. Schaefer
e51c9c17af 40453: signal handler safety for callers of patcompile(PAT_STATIC), which is not re-entrant. 2017-01-29 08:30:14 -08:00
Peter Stephenson
f26d1ba6b0 Add features associated with autoloading a function using an absolute
path.

-d defaults to normal fpath

-r remembers the path without actually loading.  May be combined with -d.

-R does the same but it's an error if not found

-X can now take a directory path: this is used to output not yet loaded
functions that have an associated path.
2017-01-11 11:26:13 +00:00
Peter Stephenson
bb218704d2 40306 with doc tweaks: Change behaviour expanding alias in () function definition.
Now an error unless the () is part of the same error as the name.
Add ALIAS_FUNC_DEF option to allow it again.
2017-01-10 19:14:26 +00:00
Peter Stephenson
88c42a2ba0 39777: $() is a valid empty command substitution 2016-10-30 17:12:04 +00:00
Oliver Kiddle
fbafc5b509 39332: support ksh's [[ -v varname ]] condition for checking if variables are set 2016-09-16 00:00:28 +02:00
Oliver Kiddle
00708285e9 unposted: remove duplicated assignment 2016-09-15 23:56:06 +02:00
Peter Stephenson
1993a3cd2a 39292: Distinguish "=" and "==" tests in output.
This is both in xtrace output and shell code rebuilt from
internal structures.
2016-09-13 09:42:24 +01:00
Peter Stephenson
28c46c1bfb 38111: Remove redundant return values in parsing.
Return values from par_list() and par_list1() are no longer used.
2016-03-07 10:49:35 +00:00
Barton E. Schaefer
bc958ab275 38106: if...then if...else should be a parse error. 2016-03-06 15:10:27 -08:00
Daniel Shahaf
bced1beb8c 37700: Teach ${(z)} the 'repeat WORD SUBLIST' syntax. 2016-01-29 09:14:53 +00:00
Barton E. Schaefer
62706b1abc 37469: do NOT allow semicolons in place of line breaks in conditionals 2015-12-31 14:16:56 -08:00
Barton E. Schaefer
0504dafa6e 37468: allow line breaks in more places in [[ ... ]] 2015-12-31 12:41:50 -08:00
Peter Stephenson
d45a68c546 36974: fix some functions with empty argument lists 2015-10-27 09:28:36 +00:00
Barton E. Schaefer
e61717b606 36566: check for regular file before lseek() 2015-09-19 23:05:44 -07:00
Peter Stephenson
881474edcb unposted: fix up for 5.0.8-test-2 2015-08-21 21:33:37 +01:00
Peter Stephenson
f4c37a78b1 36265 plus FAQ: fix alias expansion after "function"
Owing to interesting historical parsing, names after the first
were treated as command words so had non-global aliases expanded.
Add an FAQ note that use of the function keyword works around
other alias problems
2015-08-21 16:55:10 +01:00
Barton E. Schaefer
9958684574 36022 fix bug that some loop constructs could not be interrupted, revise signal queueing
There are two underlying ideas here:  (1) Keeping signals queued around
anything that's doing memory management (including push/pop of the heap)
has become crucial.  (2) Anytime the shell is going to run a command, be
it buitin or external, it must be both safe and necessary to process any
queued signals, so that the apparent order of signal arrival and command
execution is preserved.
2015-08-09 16:13:52 -07:00
Peter Stephenson
93e5234532 35643: Redirections after typeset assignments were broken. 2015-06-28 17:47:02 +01:00
Peter Stephenson
39b28980f3 various posts: Implement assignment parsing for typeset.
Typeset assignments now work like raw assignments except
for no "+=" and no GLOB_ASSIGN.

Documented in typeset builtin doc and mentioned in release notes.

Tests to ensure basic sanity.

Enabled by default, can be turned off by "disable -r" with typeset
family of commands.
2015-06-24 10:21:12 +01:00
Peter Stephenson
cb596a55d9 35306: "test -z \(" failed due to parse confusion 2015-05-27 21:25:55 +01:00
Peter Stephenson
a95f2c6071 35250: Fix case documentation (SH_GLOB) 2015-05-21 10:43:32 +01:00
Peter Stephenson
afb78f5d14 35248: treat fully parenthised zsh patterns as complete case patterns again 2015-05-21 10:25:07 +01:00
Peter Stephenson
2d6569e590 35184: Additional case fix for 35168.
Lexical analysis flags got screwed up after a "|", so we
didn't parse patterns properly, in particular those with parentheses.
2015-05-18 12:06:43 +01:00
Peter Stephenson
52aeb9aaeb 35168: Improve parsing of case patterns.
"|" is now found properly by looking for words that come
from the lexical analyser, rather than hacking a pattern
returned in one dollop.

Update some completion functions that need extra quoting
as a result.

Add test for new parsing.

Update version number to 5.0.8-dev-3 because of wordcode
incompatibility.
2015-05-18 09:56:00 +01:00
Peter Stephenson
2e48eceb1a 34921: handle error in recursive par_event().
Here documents in an interrupted list caused bad juju.
2015-04-17 22:43:38 +01:00
Peter Stephenson
4508d25710 34905: no parse error after keyboard interrupt.
Handled generally, though only showing up in special nested
cases.

Also fix ZLE so it doesn't cancel the interrupt flag when
not actually returning from a local keymap.
2015-04-17 10:23:58 +01:00
Barton E. Schaefer
7398fea059 34514: Back out 34485, an alternate solution needs to be worked out.
(Tweaked to keep the unrelated hunk of the E01 test.)
2015-02-12 09:27:53 -08:00
Peter Stephenson
da86d6b4f2 34485: More rationalisation for anonymous functions.
Don't attempt to treat as "simple" case as there are too many
hidden problems.

Pull out some post-execution functions to a common case in
execcmd().
2015-02-09 16:39:29 +00:00
Peter Stephenson
cfd91eac07 Rearrange context saving.
Variables are now associated with the module that declares them, being
initialised and saved/restored there.  However, as many variables are
used for communication between modules, many of them are set in multiple
places, so the assignment is ambiguous.
2015-01-09 21:33:39 +00:00
Peter Stephenson
c0d01a6fe0 Fix command substitutions to parse contents as they are read in.
Do this by refactoring misnamed lexsave()/lexrestore() to allow
continuity of history and input.

Add test.
2015-01-08 12:24:00 +00:00
Peter Stephenson
d067ebcacd 33876: etc.: Separate errors and keyboards interrupts
Combination of 12 commits from interrupt_abort branch.

Basic strategy is to introduce bits to errflag and to set and
reset them separately.

Remove interrupt status on return to main keymap.

Turn off ERRFLAG_INT for always block.

Restore bit thereafter: we probably need a new variable in order
to allow user interrupts to be reset in the always block.

Add TRY_BLOCK_INTERRUPT

This works the same as TRY_BLOCK_ERROR, but for a SIGINT, too.

Ensure propagation of SIGINT from exited job.

If received by foreground job, shell uses ERRFLAG_INT, not
ERRFLAG_ERROR, to set the new state.

Reset errflag before precmd()

Add always block in _main_completion to fix ZLS_COLORS

Ensures we get the right state of $ZLS_COLORS at the end of _main_complete
even if there's an interrupt.  However, the "right state" is a bit messy
as it depends on styles.
2014-12-11 09:41:17 +00:00
Wayne Davison
389954beec unposted: fix compiler set-but-not-used warning. 2014-11-28 11:55:17 -08:00
Bart Schaefer
74e26bf126 33346: another bit of the 33345 repair 2014-10-03 08:50:25 -07:00
Peter Stephenson
31750795fe 33345: fix anonymous function complex command handling.
Longstanding problem caused simple anonymous function incorrectly to
reset the overall "complext" state, causing wordcode to be diverted
into execsimple(), which caused a crash 'cos ist wasn't simple.
2014-10-03 16:29:56 +01:00