Update to latest upstream release: Zsh 5.1

This commit is contained in:
Kamil Dudka 2015-08-31 10:24:37 +02:00
parent b8ecd5913f
commit 818fbe1599
7 changed files with 8 additions and 594 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/zsh-5.*.*.tar.bz2
/zsh-5.*.tar.xz

View File

@ -1 +1 @@
e6759e8dd7b714d624feffd0a73ba0fe zsh-5.0.8.tar.bz2
fbf736a6540873f4fb7bdaf70cafb1f0 zsh-5.1.tar.xz

View File

@ -1,54 +0,0 @@
From 7cde13f288c79c9b3d3b2274e7b3dc1f08ee6eeb Mon Sep 17 00:00:00 2001
From: "Barton E. Schaefer" <schaefer@zsh.org>
Date: Wed, 29 Jul 2015 22:36:45 -0700
Subject: [PATCH] 35953: fix handling of command substitution in math context
Upstream-commit: c0a80171ee615b52a15a6fc8efe83c2bb53451d2
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Src/lex.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Src/lex.c b/Src/lex.c
index 841fb0b..8710f75 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1387,7 +1387,7 @@ dquote_parse(char endchar, int sub)
{
int pct = 0, brct = 0, bct = 0, intick = 0, err = 0;
int c;
- int math = endchar == ')' || endchar == ']';
+ int math = endchar == ')' || endchar == ']' || infor;
int zlemath = math && zlemetacs > zlemetall + addedx - inbufct;
while (((c = hgetc()) != endchar || bct ||
@@ -1994,8 +1994,10 @@ skipcomm(void)
#else
char *new_tokstr;
int new_lexstop, new_lex_add_raw;
+ int save_infor = infor;
struct lexbufstate new_lexbuf;
+ infor = 0;
cmdpush(CS_CMDSUBST);
SETPARBEGIN
add(Inpar);
@@ -2052,6 +2054,7 @@ skipcomm(void)
* the recursive parsing.
*/
lexflags &= ~LEXFLAGS_ZLE;
+ dbparens = 0; /* restored by zcontext_restore_partial() */
if (!parse_event(OUTPAR) || tok != OUTPAR)
lexstop = 1;
@@ -2098,6 +2101,7 @@ skipcomm(void)
if (!lexstop)
SETPAREND
cmdpop();
+ infor = save_infor;
return lexstop;
#endif
--
2.4.6

View File

@ -1,176 +0,0 @@
From a7b7f90b87289bf68c3175f867f77f68f1ef6a26 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 2 Jun 2015 14:43:08 +0100
Subject: [PATCH 1/4] users/20243: turn off GLOB_ASSIGN in completion system.
Upstream-commit: 6b4d6eaa9b040a05ad9796d20cda0b797209a443
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Completion/compinit | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/compinit b/Completion/compinit
index 9470c92..79f9d42 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -142,6 +142,7 @@ _comp_options=(
NO_cshnullglob
NO_cshjunkiequotes
NO_errexit
+ NO_globassign
NO_globsubst
NO_histsubstpattern
NO_ignorebraces
--
2.4.3
From 589d031cc414f44542f335e37052594b7fc89aa6 Mon Sep 17 00:00:00 2001
From: Mikael Magnusson <mikachu@gmail.com>
Date: Tue, 2 Jun 2015 15:33:07 +0200
Subject: [PATCH 2/4] GLOB_ASSIGN should only affect scalar assignments
Upstream-commit: 4dc4e23376888697234e00e0c34184bb308886e1
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Src/exec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Src/exec.c b/Src/exec.c
index 9f163a6..daed3b1 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2264,14 +2264,14 @@ addvars(Estate state, Wordcode pc, int addflags)
state->pc = opc;
return;
}
- if (!isstr || (isset(GLOBASSIGN) &&
+ if (!isstr || (isset(GLOBASSIGN) && isstr &&
haswilds((char *)getdata(firstnode(vl))))) {
globlist(vl, 0);
/* Unset the parameter to force it to be recreated
* as either scalar or array depending on how many
* matches were found for the glob.
*/
- if (isset(GLOBASSIGN))
+ if (isset(GLOBASSIGN) && isstr)
unsetparam(name);
}
if (errflag) {
--
2.4.3
From e4ca35f21b2497fd7fc1477733f5549b399597f5 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 2 Jun 2015 16:23:08 +0100
Subject: [PATCH 3/4] 35369: better GLOB_ASSIGN testing
Upstream-commit: 897ad466920e6d46d317e0630b5263d4c37c907f
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Test/A06assign.ztst | 25 ++++++++++++++++++++++---
Test/E01options.ztst | 10 +---------
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/Test/A06assign.ztst b/Test/A06assign.ztst
index 0ad9a0a..a4401cb 100644
--- a/Test/A06assign.ztst
+++ b/Test/A06assign.ztst
@@ -419,14 +419,14 @@
>worldliness
>world
- integer i n x
+ (integer i n x
float f
setopt globassign
i=tmpfile1
- n=tmp*
+ n=tmpf*
x=*2
f=2+2
- typeset -p i n x f
+ typeset -p i n x f)
0:GLOB_ASSIGN with numeric types
>typeset -i i=0
>typeset -a n
@@ -434,6 +434,25 @@
>typeset x=tmpfile2
>typeset -E f=4.000000000e+00
+ setopt globassign
+ foo=tmpf*
+ print $foo
+ unsetopt globassign
+ foo=tmpf*
+ print $foo
+0:GLOB_ASSIGN option
+>tmpfile1 tmpfile2
+>tmpf*
+
+ (setopt globassign
+ typeset -A foo
+ touch gatest1 gatest2
+ foo=(gatest*)
+ print ${(t)foo}
+ rm -rf gatest*)
+0:GLOB_ASSIGN doesn't monkey with type if not scalar assignment.
+>association-local
+
A=(first second)
A="${A[*]}" /bin/sh -c 'echo $A'
print -l "${A[@]}"
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 5c453c8..d64f7ac 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -473,15 +473,7 @@
>outside2 scalar
>inside3 scalar-export
- setopt globassign
- foo=tmp*
- print $foo
- unsetopt globassign
- foo=tmp*
- print $foo
-0:GLOB_ASSIGN option
->tmpcd tmpfile1 tmpfile2
->tmp*
+# GLOB_ASSIGN is tested in A06assign.ztst.
mkdir onlysomefiles
touch onlysomefiles/.thisfile onlysomefiles/thatfile
--
2.4.3
From e271bb49214b8dd8b2794858769ff186f3076d4a Mon Sep 17 00:00:00 2001
From: Peter Stephenson <pws@zsh.org>
Date: Tue, 23 Jun 2015 12:02:06 +0100
Subject: [PATCH 4/4] 35573: turn off POSIX_BUILTINS in completion.
This is now needed to get suitable OPTIND behaviour.
Upstream-commit: a68d22eb00ea5c85422d70d1be7efa42acfda739
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Completion/compinit | 1 +
1 file changed, 1 insertion(+)
diff --git a/Completion/compinit b/Completion/compinit
index 79f9d42..4b9a778 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -152,6 +152,7 @@ _comp_options=(
NO_kshtypeset
NO_markdirs
NO_octalzeroes
+ NO_posixbuiltins
NO_shwordsplit
NO_shglob
NO_warncreateglobal
--
2.4.3

View File

@ -1,303 +0,0 @@
From 3cf039749f4fa39a2556c4c1e6a9b1960d620fb9 Mon Sep 17 00:00:00 2001
From: Oliver Kiddle <opk@zsh.org>
Date: Tue, 2 Jun 2015 00:49:09 +0200
Subject: [PATCH] =?UTF-8?q?Adrien=20Verg=C3=A9:=2035352:=20completion=20fo?=
=?UTF-8?q?r=20new=20Redhat=20package=20manager?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream-commit: 72ecc2ef36b203175aad3f6dd4b76e474a82d8b6
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Completion/Redhat/Command/_dnf | 278 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 278 insertions(+)
create mode 100644 Completion/Redhat/Command/_dnf
diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf
new file mode 100644
index 0000000..297c95a
--- /dev/null
+++ b/Completion/Redhat/Command/_dnf
@@ -0,0 +1,278 @@
+#compdef dnf
+
+# Main dispatcher
+_dnf() {
+ _arguments -s \
+ '(- *)'{-h,--help}'[show the help message]' \
+ '(-t --tolerant)'{-t,--tolerant}'[be tolerant of errors]' \
+ '(-C --cacheonly)'{-C,--cacheonly}'[run entirely from cache]' \
+ '(-c --config)'{-c,--config=}'[config file location]:config file:_files' \
+ '(-R --randomwait)'{-R,--randomwait=}'[maximum command wait time (in minutes)]:max wait time' \
+ '(-d --debuglevel)'{-d,--debuglevel=}'[debug level (0-10)]:debug level' \
+ '(-e --errorlevel)'{-e,--errorlevel=}'[error level (0-10)]:error level' \
+ '(-y --assumeyes)'{-y,--assumeyes}'[answer yes for all questions]' \
+ '--installroot=[set install root]:install root:_files -/' \
+ '*--enablerepo=[enable or or more repositories]:repos to enable:_dnf_disabled_repos_list' \
+ '*--disablerepo=[disable one or more repositories]:disable repos:_dnf_enabled_repos_list' \
+ {*-x,*--exclude=}'[exclude package(s) by name or glob]:exclude packages' \
+ '--version[show dnf version]' \
+ '--obsoletes[enable obsoletes processing during updates]' \
+ '--nogpgcheck[disable gpg signature checking]' \
+ '--noplugins[disable dnf plugins]' \
+ '--disablepresto[disable Presto plugin and don''''t download any deltarpms]' \
+ '*::dnf command:_dnf_command'
+}
+
+(( $+functions[_dnf_command] )) || _dnf_command() {
+ local -a _dnf_cmds
+ _dnf_cmds=(
+ "install:install the latest version of a package or group of packages"
+ "erase:remove an installed package (with its dependencies)"
+ "remove:remove an installed package (with its dependencies)"
+ "clean:clean local dnf cache"
+ "check-update:check if any updates are available"
+ "info:get description of available packages"
+ "list:is used to list various information about packages"
+ "groupinfo:get info on package groups"
+ "groupinstall:install a package group or groups"
+ "groupremove:remove a package group or groups"
+ "grouplist:list package groups"
+ "groupupdate:update a package group or groups"
+ "localinstall:install packages with local rpm files"
+ "localupdate:update packages with local rpm files"
+ "makecache:makes a local dnf cache"
+ "provides:find out which package provides some feature or file"
+ "whatprovides:find out which package provides some feature or file"
+ "search:find any packages matching pattern"
+ "shell:enter the 'dnf shell'"
+ "update:update one or more packages"
+ "upgrade:upgrade one or more packages"
+ )
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands 'dnf command' _dnf_cmds || compadd "$@"
+ else
+ local curcontext="$curcontext"
+
+ cmd="${${_dnf_cmds[(r)$words[1]:*]%%:*}}"
+ # Deal with any aliases
+ case $cmd in
+ remove) cmd="erase";;
+ whatprovides) cmd="provides";;
+ upgrade) cmd="update";;
+ esac
+
+ if (( $#cmd )); then
+ curcontext="${curcontext%:*:*}:dnf-${cmd}:"
+
+ local update_policy
+ zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+ if [[ -z "$update_policy" ]]; then
+ zstyle ":completion:${curcontext}:" cache-policy _dnf_caching_policy
+ fi
+
+ _call_function ret _dnf_$cmd || _message 'no more arguments'
+ else
+ _message "unknown dnf command: $words[1]"
+ fi
+ return ret
+ fi
+}
+
+# Fills the all pkg cache
+_dnf_all_pkgs() {
+ if ( [[ ${+_all_pkgs} -eq 0 ]] || _cache_invalid ALL ) &&
+ ! _retrieve_cache ALL;
+ then
+ _all_pkgs=( $(dnf -C list all | sed 's/\s.*//' | grep '\.' 2>/dev/null) )
+ _store_cache ALL _all_pkgs
+ fi
+}
+
+# Fills the installed pkg cache
+_dnf_installed_pkgs() {
+ if ( [[ ${+_installed_pkgs} -eq 0 ]] || _cache_invalid INSTALLED ) &&
+ ! _retrieve_cache INSTALLED;
+ then
+ _installed_pkgs=( $(dnf -C list installed | sed 's/\s.*//' | grep '\.' 2>/dev/null) )
+ _store_cache INSTALLED _installed_pkgs
+ fi
+}
+
+# Fills the available pkg cache
+_dnf_available_pkgs() {
+ if ( [[ ${+_available_pkgs} -eq 0 ]] || _cache_invalid AVAILABLE ) &&
+ ! _retrieve_cache AVAILABLE;
+ then
+ _available_pkgs=( $(dnf -C list available | sed 's/\s.*//' | grep '\.' 2>/dev/null) )
+ _store_cache AVAILABLE _available_pkgs
+ fi
+}
+
+# Fills the upgrade pkg cache
+_dnf_upgrade_pkgs()
+{
+ if ( [[ ${+_upgrade_pkgs} -eq 0 ]] || _cache_invalid UPGRADE ) &&
+ ! _retrieve_cache UPGRADE;
+ then
+ _upgrade_pkgs=( $(dnf -C list upgrade | sed 's/\s.*//' | grep '\.' 2>/dev/null) )
+ _store_cache UPGRADE _upgrade_pkgs
+ fi
+}
+
+# Gets the list of defined repos
+__dnf_repos() {
+ local trepo
+ local -a tarray
+ tarray=( $(egrep -h '(^\[.*\]|^enabled.*=)' /etc/dnf.repos.d/*.repo /etc/dnf.conf 2>/dev/null | sed -e 's/ //g' | sed -e 's/\[//g' | sed -e 's/\].*$//g' 2>/dev/null) )
+ local -i eindex=0
+ local -i dindex=0
+ for line in $tarray; do
+ if [[ "$line" = "enabled=1" ]]; then
+ enabled_dnf_repos+=($trepo)
+ elif [[ "$line" = "enabled=0" ]]; then
+ disabled_dnf_repos+=($trepo)
+ elif [[ "$line" != "main" ]]; then
+ trepo=$line
+ fi
+ done
+}
+
+(( $+functions[_dnf_disabled_repos_list] )) || _dnf_disabled_repos_list() {
+ local -a enabled_dnf_repos disabled_dnf_repos
+ __dnf_repos
+ _sequence compadd "$@" - -a disabled_dnf_repos
+}
+
+(( $+functions[_dnf_enabled_repos_list] )) || _dnf_enabled_repos_list() {
+ local -a enabled_dnf_repos disabled_dnf_repos
+ __dnf_repos
+ _sequence compadd "$@" - -a enabled_dnf_repos
+}
+
+# Completion function for erase|remove
+(( $+functions[_dnf_erase] )) || _dnf_erase() {
+ _dnf_installed_pkgs
+ compadd "$@" -a -- _installed_pkgs
+}
+
+# Completion function for install
+(( $+functions[_dnf_install] )) || _dnf_install() {
+ if ! [[ $PREFIX == */* ]]; then
+ _dnf_available_pkgs
+ fi
+
+ local ret=1
+ _tags files packages
+ while _tags; do
+ if _requested files; then
+ compadd "$@" -a -- _available_pkgs
+ fi
+ if _requested packages; then
+ _call_function - _dnf_localinstall
+ fi
+ (( ret )) || break
+ done
+ return ret
+}
+
+# Completion function for localinstall
+(( $+functions[_dnf_localinstall] )) || _dnf_localinstall() {
+ _files -/ -g '(#i)*.rpm(-.)'
+}
+
+# Completion function for localupdate
+(( $+functions[_dnf_localupdate] )) || _dnf_localupdate() {
+ _files -/ -g '(#i)*.rpm(-.)'
+}
+
+# Completion function for update/upgrade
+(( $+functions[_dnf_update] )) || _dnf_update() {
+ _dnf_upgrade_pkgs
+ compadd "$@" -a -- _upgrade_pkgs
+}
+
+_dnf_all() {
+ _dnf_all_pkgs
+ compadd "$@" -a -- _all_pkgs
+}
+
+_dnf_list_or_info() {
+ local -a listlist
+ listlist=(
+ "all:all packages in repositories"
+ "available:packages available in repositories"
+ "updates:packages with updates available"
+ "installed:installed packages"
+ "extras:packages installed that are not available in any dnf repository"
+ "obsoletes:packages installed that are obsoleted"
+ "recent:packages recently added to repositories"
+ )
+
+ if (( CURRENT == 2 )); then
+ _describe -t dnf-list-subcmds "dnf info/list sub-commands" listlist || _dnf_all
+ else
+ local subcmd
+ subcmd="${${listlist[(r)$words[2]:*]%%:*}}"
+ # offer packages selected by the subcommand
+ case $subcmd in
+ all) _dnf_all;;
+ installed) _dnf_erase;;
+ available) _dnf_install;;
+ updates) _dnf_update;;
+ esac
+ fi
+}
+
+# Completion function for list
+(( $+functions[_dnf_list] )) || _dnf_list() {
+ _dnf_list_or_info
+}
+
+# Completion function for info
+(( $+functions[_dnf_info] )) || _dnf_info() {
+ _dnf_list_or_info
+}
+
+# Completion function for provides|whatprovides
+(( $+functions[_dnf_provides] )) || _dnf_provides() {
+ _files
+}
+
+# Completion function for clean
+(( $+functions[_dnf_clean] )) || _dnf_clean() {
+ local -a cleanlist
+ cleanlist=(
+ "all:all cache"
+ "cache:all cache"
+ "dbcache:DB cache"
+ "headers:cache headers"
+ "packages:cache packages"
+ "metadata:cache meta-data"
+ )
+
+ if (( CURRENT == 2 )); then
+ _describe -t dnf-clean-subcmds "dnf clean sub-commands" cleanlist
+ fi
+}
+
+_dnf_caching_policy() {
+ local _dnfrepomds
+ local -a oldp
+
+ # rebuild if cache is more than a week old
+ oldp=( "$1"(mw+1) )
+ (( $#oldp )) && return 0
+
+ _dnfrepomds=( /var/cache/dnf/**/repomd.xml )
+
+ if (( $#_dnfrepomds )); then
+ for repo in $_dnfrepomds; do
+ [[ "$repo" -nt "$1" ]] && return 0
+ done
+ fi
+
+ return 1
+}
+
+_dnf "$@"
--
2.4.3

View File

@ -1,41 +0,0 @@
From d1079f66e2fa1b238fa5b8dd038cb34f5ac001d0 Mon Sep 17 00:00:00 2001
From: Peter Stephenson <p.stephenson@samsung.com>
Date: Wed, 22 Jul 2015 14:38:03 +0100
Subject: [PATCH] 35854: prevent infinite recursion in ihungetc()
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Src/hist.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/Src/hist.c b/Src/hist.c
index 6725313..cf224cb 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -136,6 +136,7 @@ mod_export int hist_skip_flags;
#define HA_NOINC (1<<1) /* Don't store, curhist not incremented */
#define HA_INWORD (1<<2) /* We're inside a word, don't add
start and end markers */
+#define HA_UNGET (1<<3) /* Recursively ungetting */
/* Array of word beginnings and endings in current history line. */
@@ -904,8 +905,13 @@ ihungetc(int c)
while (!lexstop && !errflag) {
if (hptr[-1] != (char) c && stophist < 4 &&
- hptr > chline + 1 && hptr[-1] == '\n' && hptr[-2] == '\\')
- hungetc('\n'), hungetc('\\');
+ hptr > chline + 1 && hptr[-1] == '\n' && hptr[-2] == '\\' &&
+ !(histactive & HA_UNGET)) {
+ histactive |= HA_UNGET;
+ hungetc('\n');
+ hungetc('\\');
+ histactive &= ~HA_UNGET;
+ }
if (expanding) {
zlemetacs--;
--
2.4.6

View File

@ -2,12 +2,12 @@
Summary: Powerful interactive shell
Name: zsh
Version: 5.0.8
Release: 6%{?dist}
Version: 5.1
Release: 1%{?dist}
License: MIT
URL: http://zsh.sourceforge.net/
Group: System Environment/Shells
Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Source0: http://download.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
Source1: zlogin.rhs
Source2: zlogout.rhs
Source3: zprofile.rhs
@ -21,18 +21,6 @@ Patch0: zsh-serial.patch
Patch1: zsh-4.3.6-8bit-prompts.patch
Patch2: zsh-test-C02-dev_fd-mock.patch
# backport completion-related upstream fixes (#1238544)
Patch3: zsh-5.0.8-comp-bz1238544.patch
# backport completion for dnf (#1239337)
Patch4: zsh-5.0.8-comp-dnf.patch
# prevent infinite recursion in ihungetc() (#1245712)
Patch5: zsh-5.0.8-hist-bz1245712.patch
# fix handling of command substitution in math context
Patch6: zsh-5.0.8-cmd-subst.patch
BuildRequires: coreutils sed ncurses-devel libcap-devel
BuildRequires: texinfo texi2html gawk hostname
Requires(post): info grep
@ -69,10 +57,6 @@ This package contains the Zsh manual in html format.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
cp -p %SOURCE7 .
@ -190,6 +174,9 @@ fi
%doc Doc/*.html
%changelog
* Mon Aug 31 2015 Kamil Dudka <kdudka@redhat.com> - 5.1-1
- Update to latest upstream release: Zsh 5.1
* Thu Jul 30 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-6
- fix handling of command substitution in math context