1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-07 01:30:59 +02:00
Commit graph

59 commits

Author SHA1 Message Date
Philippe Altherr
23dc19f005 51001: Reverts 8839e969b, most of 1ba8714a, and d873ed60.
Also correct ChangeLog
2022-12-03 20:31:42 -08:00
Bart Schaefer
d873ed6026 50897: nonzero status of complex commands should trigger ERR_EXIT 2022-11-08 20:36:49 -08:00
Bart Schaefer
cf5c4828d1 48857: declare "volatile" all globals that may be modified by signal handlers 2021-05-16 19:51:11 -07:00
Peter Stephenson
9e38ab8178 48787: Fix command status after failed if
If "if" had a hard error in the condition, and there was no
else clause, the command status was incorrectly cleared to zero.

Add test.
2021-05-06 10:03:27 +01:00
Daniel Shahaf
a2a0293d4f 47296 (+ unposted additional tests and comments): 'repeat' loops: Let the repeat count use $?.
It's an arithmetic expression.
2020-08-08 06:11:00 +00:00
Peter Stephenson
2a9674862e 45616: Remove token from count argument to repeat 2020-03-26 20:54:37 +00:00
Daniel Shahaf
6fc8e8628f Merge remote-tracking branch 'origin/master' into 5.9
* Test/D02glob.ztst:
  On the "unreadable directories can be globbed (users/24619, users/24626)"
  test, resolve conflicts by removing the Cygwin-only skip that has been added
  in master, since the test is passing on this branch.  This effectively reverts
  workers/45492.  See discussion starting in workers/45504.

* origin/master:
  unposted: Remove 'sgi', as that OpenBSD port has been discontinued.
  45509: fix typos in B01cd.ztst
  45490 (+45495 and a test): refactor rlimits.c
  github : Fix typo: longson should be loongson
  users/24710: Fix job control problem with sudo.
  45492: skip test added by users/24633 on Cygwin
  45488: COMP_WORDS for bash need "$@"-style quoting
  45487: Missing mod_export declarations for AIX
  45447: Complete vcs_info_hookadd and vcs_info_hookdel. Expose _vcs_info_hooks as a top-level helper function.
  45463: test: kill: Document why we use SIGURG
  45453: builtins: kill: Do not signal current process group when pid is empty
  45452: builtins: kill: Add `kill ''` regression test with explicit sigspec
  45451: builtins: kill: Add basic test suite
  github #48/0002: vcs_info git: properly detect bare repositories
  github #48/0001: vcs_info git: avoid warnings in bare repositories
  unposted: Post-release version bump
  unposted: Release 5.8
  CVE-2019-20044: Update change log for preceding commits
  Update NEWS/README
  Add unsetopt/PRIVILEGED tests
  Clean up error-message white space
  Improve PRIVILEGED fixes (again)
  Improve PRIVILEGED fixes
  Drop privileges securely
  unposted: V01zmodload: Fix failing test from workers/45385
  45423: _su: Improve arg handling, shell look-ups
  unposted: _zip: Recognise '--'
  45385: Add a test for 'zmodload -Fa' preemptively disabling ("blacklisting"?) features.
  unposted: Test release: 5.7.1-test-3
  zsh/system: Fix infinite loop in sysread
  _diff_options: Restore -w completion lost in workers/43351
  unposted: Fix ChangeLog typo.
  45368: Add tests for workers/45367's issue about double slashes in 'cd -P' and /home/daniel/in/zsh.
  45373: Fix ERR_EXIT bug in else branch of if.
  45372: Record a symlink loop bug involving :P
  45365: _git: Fix __git_recent_branches for the case when a commit has an empty message
  45343: Queue signals around arithmetic evaluations
  45344: Document where third-party completion functions should be installed.
  45345: internal: ztst.vim: Fix highlighting of zsh comments in test payload
  unposted: internal: Add some comments and fix indentation.  No functional change.
  45340: internal: Document the difference between paramtab and realparamtab.
  45332: _git: add completion for git-version
  _brace_parameter: add missing \

Conflicts:
	ChangeLog
	Test/D02glob.ztst
	Test/V01zmodload.ztst
2020-03-07 21:36:46 +00:00
Peter Stephenson
e01223a26c 45373: Fix ERR_EXIT bug in else branch of if.
The flags need resetting for this branch otherwise e.g. command
substitution with non-zero status doesn't cause exit.
2020-02-02 18:05:47 +00:00
Daniel Shahaf
7ca2b06501 45304: Do execute the always block even when the try/always block itself is the last command.
Fixes the test added in the previous commit (workers/45305).
2020-01-16 18:29:13 +00:00
Daniel Shahaf
a90e93f454 45076: internal: Simplify handling of try_tryflag. No functional change.
try_tryflag isn't assigned anywhere, other than at initialization and by these
lines, so we don't need to save and restore the value.
2019-12-18 06:01:55 +00: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
Barton E. Schaefer
d29ad85533 41723: one more case of 41627 in "while" loops. 2017-09-18 08:40:02 -07: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
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
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
c03228f9ed Extra case for ERR_RETURN and ERR_EXIT.
Don't trigger just because status is non-zero at end of
complex shell construct as this may be a case we've already
suppressed.
2016-12-05 11:21:01 +00:00
Barton E. Schaefer
ff36590910 39844: fix "while" condition as per 39839 (commit 2c56c7e5) 2016-11-05 18:23:04 -07:00
Barton E. Schaefer
2c56c7e5e8 39839: fix "return" from "if" condition 2016-11-05 13:54:16 -07:00
Martijn Dekker
31c6cfca9c 39625: case needs to reset lastval if no pattern matched 2016-10-13 10:49:02 +01:00
Peter Stephenson
8f2ce89a0c 39599: Don't reset status before "case" execution 2016-10-10 10:55:48 +01:00
Martijn Dekker
f0ecf54ea6 39448: reset REPLY in select on user action 2016-09-26 19:52:55 +01:00
Peter Stephenson
016929e043 38734: fix final case clauses terminating with ;& 2016-06-21 16:12:51 +01:00
Barton E. Schaefer
0b37b5149d 37804 (plus 37816): first word following "repeat" should be evaluated as math 2016-01-27 22:10:38 -08:00
Barton E. Schaefer
cb26e11c70 unposted: back out 36707, add test case for 36766 2015-10-03 22:11:09 -07:00
Barton E. Schaefer
2bf4f667fb 36707: distinguish ERR_RETURN value of retflag so that execif() can ignore it in the test sublist 2015-09-30 20:01:13 -07: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
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
Mikael Magnusson
573679c34b select: Fix leak of 256 bytes on every loop when zle is not used
Reproduce by
yes | head -n 1000000 | zsh -c 'select foo in a b c; do done; sleep 30; echo'

Found by Coverity (Issue 439082).
2015-01-10 08:48:18 +01:00
Barton E. Schaefer
d6a32ddeed 34065: following an "if" condition, do not test lastval for ERR_EXIT until a new command is run
Includes unposted regression tests.
2014-12-27 21:55:58 -08: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
Barton E. Schaefer
05e919dc56 33791: fatal errors in an "always" construct yield nonzero status
Fatal errors in the try-block part of an "always" construct cause the
entire construct to have nonzero status, even when TRY_BLOCK_ERROR is
used to suppress the error.
2014-11-25 09:15:20 -08:00
Barton E. Schaefer
9da59238ff 32569: lastval ($?) should not be reset between word list substitution and loop body execution in for/select
Remove one other redundant and therefore confusing assignment to lastval.
2014-04-20 11:09:51 -07:00
Barton E. Schaefer
848badaa5f 32568: consistency in handling of errflag condition during substitutions
Affects for/select word lists, function definition name position, and
anonymous function argument lists.
2014-04-20 10:27:15 -07:00
Peter Stephenson
d89361739a 29165: use term.h globally if needed at all. 2011-05-09 09:49:08 +00:00
Peter Stephenson
0c9830d23c 25345, 25347: neaten interface from main shell to zle 2008-07-31 08:44:16 +00:00
Peter Stephenson
bd70d684fc 25002: only ZLE should update attributes resulting from prompt expansion 2008-05-12 13:50:42 +00:00
Peter Stephenson
58580d31f5 24996: improve xtrace output for patterns 2008-05-11 19:55:21 +00:00
Peter Stephenson
bab70abe6b users/12848: return, break, continue in always block override try block 2008-05-11 19:03:58 +00:00
Peter Stephenson
4d52b7ebe6 23670: rationalise some linked list functions 2007-06-27 13:56:10 +00:00
Peter Stephenson
de272e0309 23115: ";|" at end of case clause causes later patterns to be tested 2007-01-19 21:36:00 +00:00
Peter Stephenson
dd5602f59b 22474: use variable argument lists to improve error message handling 2006-05-30 22:35:03 +00:00
Bart Schaefer
174ad4a80f 21814: error handling for traps in "always" constructs. 2005-12-15 04:24:04 +00:00
Wayne Davison
e79af955f0 Got rid of some unsigned-char/char pointer casts. 2005-11-15 08:44:17 +00:00
Peter Stephenson
88a37cc187 c.f. 20675: improve zle as a basis for Unicode.
unposted: update version to 4.2.3-dev-1
2005-01-14 13:04:47 +00:00
Peter Stephenson
86ae90bc1c 20149: improve prompt-reset code
20150: commit ancient memory leak fix(?) in completion
2004-07-11 22:53:01 +00:00
Peter Stephenson
d591334e9d 20076, 20084: { ... } always { ... } syntax. 2004-06-22 13:09:55 +00:00
Wayne Davison
fb0937a69e Marked unused parameters with the new UNUSED() macro. 2004-06-02 22:14:25 +00:00
Wayne Davison
f297798397 Made a variable (t2) size_t so that it matched the size of the
other variable it gets compared with (fw).
2004-05-28 19:18:17 +00:00
Peter Stephenson
6eb5f99f1e 19295: $CONTEXT zle parameter 2003-12-15 22:45:27 +00:00
Peter Stephenson
4c149a8abc 18252: pass ignoreeof as flag to zleread 2003-02-17 14:06:39 +00:00