diff options
-rw-r--r-- | ChangeLog | 94 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 66 | ||||
-rw-r--r-- | Config/version.mk | 4 | ||||
-rw-r--r-- | Doc/Zsh/contrib.yo | 2 | ||||
-rw-r--r-- | Doc/Zsh/manual.yo | 26 | ||||
-rw-r--r-- | Doc/Zsh/params.yo | 2 | ||||
-rw-r--r-- | Doc/Zsh/zle.yo | 5 | ||||
-rw-r--r-- | Etc/FAQ.yo | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 | ||||
-rw-r--r-- | Functions/Zle/bracketed-paste-magic | 2 | ||||
-rw-r--r-- | Functions/Zle/url-quote-magic | 2 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | Src/Zle/complist.c | 2 | ||||
-rw-r--r-- | Src/Zle/zle_refresh.c | 3 | ||||
-rw-r--r-- | Src/Zle/zle_tricky.c | 2 | ||||
-rw-r--r-- | Src/Zle/zle_utils.c | 5 | ||||
-rw-r--r-- | Src/exec.c | 4 | ||||
-rw-r--r-- | Src/hashtable.c | 5 | ||||
-rw-r--r-- | Src/params.c | 9 | ||||
-rw-r--r-- | Src/pattern.c | 26 | ||||
-rw-r--r-- | Src/signals.c | 5 | ||||
-rw-r--r-- | Src/text.c | 4 | ||||
-rw-r--r-- | Src/utils.c | 10 | ||||
-rw-r--r-- | Test/A02alias.ztst | 3 | ||||
-rw-r--r-- | Test/A04redirect.ztst | 31 | ||||
-rw-r--r-- | Test/A05execution.ztst | 9 | ||||
-rw-r--r-- | Test/A06assign.ztst | 8 | ||||
-rw-r--r-- | Test/D07multibyte.ztst | 17 |
29 files changed, 323 insertions, 48 deletions
@@ -1,3 +1,97 @@ +2015-09-06 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * unposted: Config/versiom.mk, Etc/FAQ.yo, NEWS, README: make + 5.1-test-1 with updates for 5.1.1. + +2015-09-05 Daniel Shahaf <d.s@daniel.shahaf.name> + + * unposted: Doc/Zsh/params.yo Doc/Zsh/zle.yo: Minor documentation + tweaks. + + * 36410: Doc/Zsh/contrib.yo + Functions/VCS_Info/Backends/VCS_INFO_get_data_git: vcs_info git: + Present merge heads as patches + +2015-09-04 Peter Stephenson <p.stephenson@samsung.com> + + * 36421: Src/pattern.c: can't-get-the-staff fix for idiocy in + 36415. + +2015-09-04 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 36417: Doc/Zsh/manual.yo: fix/update top level texinfo menu + +2015-09-04 Peter Stephenson <p.stephenson@samsung.com> + + * 36415: Src/pattern.c, Test/D07multibyte.ztst: remap bytes from + invalid multibyte characters to 0xDC00 + index which is invalid + in Unicode. Strictly this only works if whcar_t is + ISO-10646-compliant, however it ought to be at least as good as + the current fudge in any case. + +2015-09-03 Peter Stephenson <p.stephenson@samsung.com> + + * 36416: Src/Zle/zle_refresh.c, Src/Zle/zle_utils.c: If + keyboard interrupt during getzlequery(), don't propagate further, + just redraw the line. Also handle logical error that we + attempted to redraw the line partially if an error or interrupt + was propagated. + +2015-09-03 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 36403: Src/hashtable.c Test/A02alias.ztst: type -w += + suffix alias + +2015-09-02 Barton E. Schaefer <schaefer@zsh.org> + + * unposted: Test/A05execution.ztst: test for 36393 + + * 36393: Src/signals.c: process queued signals during dotrap() + +2015-09-02 Peter Stephenson <p.w.stephenson@ntlworld.com> + + * 36378: Src/exec.c: skip directories when looking for autoload + files. + +2015-09-02 Peter Stephenson <p.stephenson@samsung.com> + + * 36399: Src/text.c, Test/A04redirect.ztst: shell code with + multiple here documents wasn't shown properly. + +2015-09-01 Mikael Magnusson <mikachu@gmail.com> + + * 36380: Src/utils.c: Avoid gcc case syntax + + * 36347: Src/params.c, Test/A06assign.ztst: Fix appending empty + array to associations + +2015-09-01 Barton E. Schaefer <schaefer@zsh.org> + + * 36376: Src/utils.c: handle signals during read1char() so it is + possible to interrupt correct/correctall prompts + +2015-09-01 Peter Stephenson <p.stephenson@samsung.com> + + * 36365: Src/Zle/zle_tricky.c: magic-space removed the rest of + the line if the lexer found something complicated. + + * unposted: Config/version.mk: update version to 5.1-dev-0 to + avoid clash with 5.1 release. + +2015-09-01 Daniel Shahaf <d.s@daniel.shahaf.name> + + * 36353: Completion/Unix/Command/_git: _git: Unbreak after + previous. + +2015-08-30 Mateusz Karbowy <mateusz.karbowy@gmail.com> + + * 36328 + 36340: Completion/Unix/Command/_git: _git-cherry-pick: + Complete other branches only + +2015-08-30 Axel Beckert <abe@deuxchevaux.org> + + * 36338: Functions/Zle/*-magic: s/5.0.9/5.1/ in source comments + 2015-08-30 Peter Stephenson <p.w.stephenson@ntlworld.com> * unposted: Config/version.mk: Release version 5.1 diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 740969903..7f7c3ebc7 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -493,6 +493,8 @@ _git-checkout () { (( $+functions[_git-cherry-pick] )) || _git-cherry-pick () { + local -a git_commit_opts + git_commit_opts=(--all --not HEAD --not) _arguments \ '(- :)--quit[end revert or cherry-pick sequence]' \ '(- :)--continue[resume revert or cherry-pick sequence]' \ @@ -509,7 +511,7 @@ _git-cherry-pick () { '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ - ': :__git_commit_ranges' + ': : __git_commit_ranges -O expl:git_commit_opts' } (( $+functions[_git-citool] )) || @@ -5556,20 +5558,31 @@ __git_remote_branch_names_noprefix () { (( $+functions[__git_commit_objects_prefer_recent] )) || __git_commit_objects_prefer_recent () { - __git_recent_commits || __git_commit_objects + local -a argument_array_names + zparseopts -D -E O:=argument_array_names + + __git_recent_commits $argument_array_names || __git_commit_objects } (( $+functions[__git_commits] )) || __git_commits () { + local -a argument_array_names + zparseopts -D -E O:=argument_array_names + # Turn (-O foo:bar) to (foo bar) + (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" ) + set -- "${(@P)argument_array_names[1]}" + local commit_opts__argument_name=$argument_array_names[2] + # TODO: deal with things that __git_heads and __git_tags has in common (i.e., # if both exists, they need to be completed to heads/x and tags/x. - local -a sopts ropt + local -a sopts ropt expl zparseopts -E -a sopts S: r:=ropt R: q sopts+=( $ropt:q ) + expl=( "$@" ) _alternative \ "heads::__git_heads $sopts" \ "commit-tags::__git_commit_tags $sopts" \ - 'commit-objects::__git_commit_objects_prefer_recent' + 'commit-objects:: __git_commit_objects_prefer_recent -O expl:$commit_opts__argument_name' } (( $+functions[__git_heads] )) || @@ -5624,29 +5637,44 @@ __git_commit_objects () { (( $+functions[__git_recent_commits] )) || __git_recent_commits () { local gitdir expl start - declare -a descr tags heads commits + declare -a descr tags heads commits argument_array_names commit_opts local i j k ret integer distance_from_head + local label + + zparseopts -D -E O:=argument_array_names + # Turn (-O foo:bar) to (foo bar) + (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" ) + (( $#argument_array_names > 1 )) && (( ${(P)+argument_array_names[2]} )) && + commit_opts=( "${(@P)argument_array_names[2]}" ) # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log -20 --format='%h%n%d%n%s\ \(%cr\)')"}") + commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)')"}") __git_command_successful $pipestatus || return 1 for i j k in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 - if (( distance_from_head == 0 )); then - descr+=($i:"[HEAD] $k") + if (( $#commit_opts )); then + # $commit_opts is set, so the commits we receive might not be in order, + # or might not be ancestors of HEAD. However, we must make the + # description unique (due to workers/34768), which we do by including the + # hash. Git always prints enough hash digits to make the output unique.) + label="[$i]" + elif (( distance_from_head == 0 )); then + label="[HEAD] " elif (( distance_from_head == 1 )); then - descr+=($i:"[HEAD^] $k") + label="[HEAD^] " elif (( distance_from_head == 2 )); then - descr+=($i:"[HEAD^^] $k") + label="[HEAD^^] " elif (( distance_from_head < 10 )); then - descr+=($i:"[HEAD~$distance_from_head] $k") + label="[HEAD~$distance_from_head] " else - descr+=($i:"[HEAD~$distance_from_head] $k") + label="[HEAD~$distance_from_head]" fi + # label is now 9 bytes, so the descriptions ($k) will be aligned. + descr+=($i:"${label} $k") (( ++distance_from_head )) j=${${j# \(}%\)} # strip leading ' (' and trailing ')' @@ -5713,13 +5741,23 @@ __git_commits2 () { (( $+functions[__git_commit_ranges] )) || __git_commit_ranges () { + local -a argument_array_names + zparseopts -D -E O:=argument_array_names + # Turn (-O foo:bar) to (foo bar) + (( $#argument_array_names )) && argument_array_names=( "${(@s/:/)argument_array_names[2]}" ) + set -- "${(@P)argument_array_names[1]}" + local commit_opts__argument_name=$argument_array_names[2] + local -a suf + local -a expl if compset -P '*..(.|)'; then - __git_commits $* + expl=( $* ) else compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' ) - __git_commits $* $suf + expl=( $* $suf ) fi + + __git_commits -O expl:$commit_opts__argument_name } (( $+functions[__git_commit_ranges2] )) || diff --git a/Config/version.mk b/Config/version.mk index 90ed6b17f..777a852d8 100644 --- a/Config/version.mk +++ b/Config/version.mk @@ -27,5 +27,5 @@ # This must also serve as a shell script, so do not add spaces around the # `=' signs. -VERSION=5.1 -VERSION_DATE='August 30, 2015' +VERSION=5.1-test-1 +VERSION_DATE='September 6, 2015' diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index db0940d94..741d4ad07 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1339,7 +1339,7 @@ tt(formats) and tt(actionformats) and will be available in the global tt(backend_misc) array as tt(${backend_misc[bookmarks]}). ) item(tt(gen-applied-string))( -Called in the tt(git) (with tt(stgit) or during rebase), and tt(hg) +Called in the tt(git) (with tt(stgit) or during rebase or merge), and tt(hg) (with tt(mq)) backends and in tt(quilt) support when the tt(applied-string) is generated; the tt(use-quilt) zstyle must be true for tt(quilt) (the tt(mq) and tt(stgit) backends are active by default). diff --git a/Doc/Zsh/manual.yo b/Doc/Zsh/manual.yo index e0b0f14cb..86c72c0ff 100644 --- a/Doc/Zsh/manual.yo +++ b/Doc/Zsh/manual.yo @@ -61,8 +61,6 @@ menu(The Zsh Web Page) menu(The Zsh Userguide) menu(See Also) -Roadmap - Invocation menu(Compatibility) @@ -107,12 +105,10 @@ menu(Single Letter Options) Zsh Line Editor -menu(Movement) -menu(History Control) -menu(Modifying Text) -menu(Arguments) -menu(Completion) -menu(Miscellaneous) +menu(Keymaps) +menu(Zle Builtins) +menu(Zle Widgets) +menu(Character Highlighting) Completion Widgets @@ -143,6 +139,14 @@ Zsh Modules includefile(Zsh/manmodmenu.yo) +Calendar Function System + +menu(Calendar File and Date Formats) +menu(Calendar System User Functions) +menu(Calendar Styles) +menu(Calendar Utility Functions) +menu(Calendar Bugs) + TCP Function System menu(TCP Functions) @@ -159,8 +163,14 @@ menu(Miscellaneous Features) User Contributions menu(Utilities) +menu(Recent Directories) +menu(Version Control Information) menu(Prompt Themes) menu(ZLE Functions) +menu(Exception Handling) +menu(MIME Functions) +menu(Mathematical Functions) +menu(User Configuration Functions) menu(Other Functions) endmenu() diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index a4067883a..ba2856b34 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -60,7 +60,7 @@ When the integer attribute, tt(-i), or a floating point attribute, tt(-E) or tt(-F), is set for var(name), the var(value) is subject to arithmetic evaluation. Furthermore, by replacing `tt(=)' with `tt(+=)', a parameter can be incremented or appended to. See noderef(Array Parameters) and -ifzman(em(Arithmetic Evaluation) LPAR()in zmanref(zshexpn)RPAR())\ +ifzman(em(Arithmetic Evaluation) LPAR()in zmanref(zshmisc)RPAR())\ ifnzman(noderef(Arithmetic Evaluation)) for additional forms of assignment. diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo index c06e2260e..4e9369508 100644 --- a/Doc/Zsh/zle.yo +++ b/Doc/Zsh/zle.yo @@ -34,7 +34,8 @@ The parameter tt(zle_highlight) is also used by the line editor; see ifzman(em(Character Highlighting) below)\ ifnzman(noderef(Character Highlighting)). Highlighting of special characters and the region between the cursor and the -mark (as set with tt(set-mark-command) in Emacs mode) is enabled +mark (as set with tt(set-mark-command) in Emacs mode, or by tt(visual-mode) +in Vi mode) is enabled by default; consult this reference for more information. Irascible conservatives will wish to know that all highlighting may be disabled by the following setting: @@ -43,7 +44,7 @@ example(zle_highlight=(none)) In many places, references are made to the tt(numeric argument). This can by default be entered in emacs mode by holding the alt key and typing -a number, or pressing escape before each number, and in vi command mode +a number, or pressing escape before each digit, and in vi command mode by typing the number before entering a command. Generally the numeric argument causes the next command entered to be repeated the specified number of times, unless otherwise noted below. See also diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo index 3188c95c6..0cd1e81ca 100644 --- a/Etc/FAQ.yo +++ b/Etc/FAQ.yo @@ -306,7 +306,7 @@ sect(On what machines will it run?) sect(What's the latest version?) - Zsh 5.1 is the latest production version. For details of all the + Zsh 5.1/1 is the latest production version. For details of all the changes, see the NEWS file in the source distribution. A beta of the next version is sometimes available. Development of zsh is diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 3fc861eeb..638ea4572 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -231,6 +231,23 @@ elif [[ -d "${gitdir}/rebase-apply" ]]; then git_patches_unapplied=($(seq $cur $(< "${patchdir}/last"))) VCS_INFO_git_handle_patches +elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then + # This is 'git merge --no-commit' + local -a heads=( ${(@f)"$(<"${gitdir}/MERGE_HEAD")"} ) + local subject; + IFS='' read -r subject < "${gitdir}/MERGE_MSG" + # $subject is the subject line of the would-be commit + # Maybe we can get the subject lines of MERGE_HEAD's commits cheaply? + + local p + for p in $heads[@]; do + git_patches_applied+=("$p $subject") + done + unset p + + # Not touching git_patches_unapplied + + VCS_INFO_git_handle_patches else gitmisc='' fi diff --git a/Functions/Zle/bracketed-paste-magic b/Functions/Zle/bracketed-paste-magic index daf5aec5a..49f4b6620 100644 --- a/Functions/Zle/bracketed-paste-magic +++ b/Functions/Zle/bracketed-paste-magic @@ -1,4 +1,4 @@ -# Starting with zsh-5.0.9, ZLE began to recognize the "bracketed paste" +# Starting with zsh-5.1, ZLE began to recognize the "bracketed paste" # capability of terminal emulators, that is, the sequences $'\e[200~' to # start a paste and $'\e[201~' to indicate the end of the pasted text. # Pastes are handled by the bracketed-paste widget and insert literally diff --git a/Functions/Zle/url-quote-magic b/Functions/Zle/url-quote-magic index 362d15c44..0e49573db 100644 --- a/Functions/Zle/url-quote-magic +++ b/Functions/Zle/url-quote-magic @@ -8,7 +8,7 @@ # autoload -Uz url-quote-magic # zle -N self-insert url-quote-magic -# As of zsh-5.0.9, the following may also be necessary in order to apply +# As of zsh-5.1, the following may also be necessary in order to apply # quoting to copy-pasted URLs: # autload -Uz bracketed-paste-magic # zle -N bracketed-paste bracketed-paste-magic @@ -4,6 +4,8 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH Note also the list of incompatibilities in the README file. +There are no significant changes between 5.1 and 5.1.1. + Changes from 5.0.8 to 5.1 ------------------------- @@ -5,11 +5,13 @@ THE Z SHELL (ZSH) Version ------- -This is version 5.1 of the shell. This is a stable release. There are +This is version 5.1.1 of the shell. This is a stable release. There are a few visible improvements since 5.0.8 as well as many bugfixes. Note in particular the two changes highlighted under "Incompatibilites between 5.0.8 and 5.1" below. See NEWS for more information. +There are only bug fixes between 5.1 and 5.1.1. + Installing Zsh -------------- diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c index fd90ccb31..01bcb7cf8 100644 --- a/Src/Zle/complist.c +++ b/Src/Zle/complist.c @@ -2386,7 +2386,7 @@ domenuselect(Hookdef dummy, Chdata dat) * to be metafied locally in a couple of places. * It's horrifically difficult to work out where the line * is metafied, so I've resorted to the following. - * Unfortunately we need to unmetatfy in zrefresh() when + * Unfortunately we need to unmetafy in zrefresh() when * we want to display something. Maybe this function can * be done better. */ diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c index 78046fb7b..0c28c0a2d 100644 --- a/Src/Zle/zle_refresh.c +++ b/Src/Zle/zle_refresh.c @@ -1761,7 +1761,8 @@ singlelineout: inlist = 1; listmatches(); inlist = 0; - zrefresh(); + if (!errflag) + zrefresh(); } if (showinglist == -1) showinglist = nlnct; diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index 97bdcc020..b1a6f9e7e 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -2812,6 +2812,8 @@ doexpandhist(void) do { ctxtlex(); } while (tok != ENDINPUT && tok != LEXERR); + if (tok == LEXERR) + lexstop = 0; while (!lexstop) hgetc(); /* We have to save errflags because it's reset in zcontext_restore. Since * diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c index d1d320613..9751f7a1f 100644 --- a/Src/Zle/zle_utils.c +++ b/Src/Zle/zle_utils.c @@ -1183,6 +1183,11 @@ getzlequery(void) /* get a character from the tty and interpret it */ c = getfullchar(0); + /* + * We'll interpret an interruption here as only interrupting the + * query, not the line editor. + */ + errflag &= ~ERRFLAG_INT; if (c == ZWC('\t')) c = ZWC('y'); else if (ZC_icntrl(c) || c == ZLEEOF) diff --git a/Src/exec.c b/Src/exec.c index 45f1c66f0..109a04a26 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5392,7 +5392,9 @@ getfpfunc(char *s, int *ksh, char **fname) } unmetafy(buf, NULL); if (!access(buf, R_OK) && (fd = open(buf, O_RDONLY | O_NOCTTY)) != -1) { - if ((len = lseek(fd, 0, 2)) != -1) { + struct stat st; + if (!fstat(fd, &st) && S_ISREG(st.st_mode) && + (len = lseek(fd, 0, 2)) != -1) { d = (char *) zalloc(len + 1); lseek(fd, 0, 0); if ((rlen = read(fd, d, len)) >= 0) { diff --git a/Src/hashtable.c b/Src/hashtable.c index 90739a882..2d1ff87cb 100644 --- a/Src/hashtable.c +++ b/Src/hashtable.c @@ -1234,7 +1234,10 @@ printaliasnode(HashNode hn, int printflags) } if (printflags & PRINT_WHENCE_WORD) { - printf("%s: alias\n", a->node.nam); + if (a->node.flags & ALIAS_SUFFIX) + printf("%s: suffix alias\n", a->node.nam); + else + printf("%s: alias\n", a->node.nam); return; } diff --git a/Src/params.c b/Src/params.c index 00f43e47d..de151a4cd 100644 --- a/Src/params.c +++ b/Src/params.c @@ -3312,9 +3312,12 @@ arrhashsetfn(Param pm, char **val, int augment) zerr("bad set of key/value pairs for associative array"); return; } - if (alen) - if (!(augment && (ht = paramtab = pm->gsu.h->getfn(pm)))) - ht = paramtab = newparamtable(17, pm->node.nam); + if (augment) { + ht = paramtab = pm->gsu.h->getfn(pm); + } + if (alen && (!augment || !paramtab)) { + ht = paramtab = newparamtable(17, pm->node.nam); + } while (*aptr) { /* The parameter name is ztrdup'd... */ v->pm = createparam(*aptr, PM_SCALAR|PM_UNSET); diff --git a/Src/pattern.c b/Src/pattern.c index 7d38988a0..b4ba33e49 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -224,6 +224,22 @@ typedef zlong zrange_t; typedef unsigned long zrange_t; #endif +#ifdef MULTIBYTE_SUPPORT +/* + * Handle a byte that's not part of a valid character. + * + * This range in Unicode is recommended for purposes of this + * kind as it corresponds to invalid characters. + * + * Note that this strictly only works if wchar_t represents + * Unicode code points, which isn't necessarily true; however, + * converting an invalid character into an unknown format is + * a bit tricky... + */ +#define WCHAR_INVALID(ch) \ + ((wchar_t) (0xDC00 + STOUC(ch))) +#endif /* MULTIBYTE_SUPPORT */ + /* * Array of characters corresponding to zpc_chars enum, which it must match. */ @@ -353,10 +369,10 @@ metacharinc(char **x) return wc; } - /* Error. Treat as single byte. */ + /* Error. */ /* Reset the shift state for next time. */ memset(&shiftstate, 0, sizeof(shiftstate)); - return (wchar_t) STOUC(*(*x)++); + return WCHAR_INVALID(*(*x)++); } #else @@ -1867,10 +1883,10 @@ charref(char *x, char *y) ret = mbrtowc(&wc, x, y-x, &shiftstate); if (ret == MB_INVALID || ret == MB_INCOMPLETE) { - /* Error. Treat as single byte. */ + /* Error. */ /* Reset the shift state for next time. */ memset(&shiftstate, 0, sizeof(shiftstate)); - return (wchar_t) STOUC(*x); + return WCHAR_INVALID(*x); } return wc; @@ -1922,7 +1938,7 @@ charrefinc(char **x, char *y, int *z) *z = 1; /* Reset the shift state for next time. */ memset(&shiftstate, 0, sizeof(shiftstate)); - return (wchar_t) STOUC(*(*x)++); + return WCHAR_INVALID(*(*x)++); } /* Nulls here are normal characters */ diff --git a/Src/signals.c b/Src/signals.c index f45c1860c..aa0b5aaa7 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -1348,6 +1348,7 @@ void dotrap(int sig) { void *funcprog; + int q = queue_signal_level(); if (sigtrapped[sig] & ZSIG_FUNC) { HashNode hn = gettrapnode(sig, 0); @@ -1370,5 +1371,9 @@ dotrap(int sig) if ((sigtrapped[sig] & ZSIG_IGNORED) || !funcprog || errflag) return; + dont_queue_signals(); + dotrapargs(sig, sigtrapped+sig, funcprog); + + restore_queue_signals(q); } diff --git a/Src/text.c b/Src/text.c index 3978a26a9..7e65f43a4 100644 --- a/Src/text.c +++ b/Src/text.c @@ -77,8 +77,8 @@ taddpending(char *str1, char *str2) */ if (tpending) { int oldlen = strlen(tpending); - tpending = zrealloc(tpending, len + oldlen); - sprintf(tpending + oldlen, "%s%s", str1, str2); + tpending = zrealloc(tpending, len + oldlen + 1); + sprintf(tpending + oldlen, "\n%s%s", str1, str2); } else { tpending = (char *)zalloc(len); sprintf(tpending, "%s%s", str1, str2); diff --git a/Src/utils.c b/Src/utils.c index 4c4dc55cd..ca68eae32 100644 --- a/Src/utils.c +++ b/Src/utils.c @@ -2538,11 +2538,16 @@ static int read1char(int echo) { char c; + int q = queue_signal_level(); + dont_queue_signals(); while (read(SHTTY, &c, 1) != 1) { - if (errno != EINTR || errflag || retflag || breaks || contflag) + if (errno != EINTR || errflag || retflag || breaks || contflag) { + restore_queue_signals(q); return -1; + } } + restore_queue_signals(q); if (echo) write_loop(SHTTY, &c, 1); return STOUC(c); @@ -3083,7 +3088,8 @@ morefmt: case '#': case '_': case '-': - case '0' ... '9': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': goto morefmt; strftimehandling: default: diff --git a/Test/A02alias.ztst b/Test/A02alias.ztst index b294e65ca..389617898 100644 --- a/Test/A02alias.ztst +++ b/Test/A02alias.ztst @@ -91,5 +91,8 @@ 0:unalias -a alias -s foo=print + type bar.foo; type -w bar.foo unalias -as 0:unalias -as +>foo is a suffix alias for print +>foo: suffix alias diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst index 602341d05..d7fe22fb0 100644 --- a/Test/A04redirect.ztst +++ b/Test/A04redirect.ztst @@ -555,3 +555,34 @@ 0:Assignment with exec used for redirection: POSIX_BUILTINS >x=And this ?This should appear, too + + fn-two-heres() { +# tabs below + cat <<-x <<-y + foo + x + bar + y + } + which -x2 fn-two-heres + fn-two-heres + eval "$(which -x2 fn-two-heres)" + fn-two-heres + print $functions[fn-two-heres] +0:Two here-documents in a line are shown correctly. +>fn-two-heres () { +> cat <<x <<y +>foo +>x +>bar +>y +>} +>foo +>bar +>foo +>bar +> cat <<x <<y +>foo +>x +>bar +>y diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst index a504ac41a..52738181d 100644 --- a/Test/A05execution.ztst +++ b/Test/A05execution.ztst @@ -288,3 +288,12 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline >0 >0 >0 + +# Regression test for workers/36392 + print -u $ZTST_fd 'This test takes 3 seconds and hangs the shell when it fails...' + callfromchld() { true && { print CHLD } } + TRAPCHLD() { callfromchld } + sleep 2 & sleep 3; print OK +0:Background job exit does not affect reaping foreground job +>CHLD +>OK diff --git a/Test/A06assign.ztst b/Test/A06assign.ztst index 302659c7e..1e3d2ede9 100644 --- a/Test/A06assign.ztst +++ b/Test/A06assign.ztst @@ -249,6 +249,14 @@ >2 >3 + typeset -A h + h=(a 1 b 2) + h+=() + print -l $h +0:add empty array to association +>1 +>2 + # tests of var[range]+=scalar s=sting diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst index 0e3e98d38..3fadd8066 100644 --- a/Test/D07multibyte.ztst +++ b/Test/D07multibyte.ztst @@ -508,3 +508,20 @@ cd .. } 0:cd with special characters + + test_array=( + '[[ \xcc = \xcc ]]' + '[[ \xcc != \xcd ]]' + '[[ \xcc != \ucc ]]' + '[[ \ucc = \ucc ]]' + '[[ \ucc = [\ucc] ]]' + '[[ \xcc != [\ucc] ]]' + # Not clear how useful the following is... + '[[ \xcc = [\xcc] ]]' + ) + for test in $test_array; do + if ! eval ${(g::)test} ; then + print -rl "Test $test failed" >&2 + fi + done +0:Invalid characters in pattern matching |