Resolves: #1183238 - improve handling of NULL in the 'cd' built-in
This commit is contained in:
parent
cb022dbd05
commit
0a558672ee
59
zsh-5.0.7-cd-sigsegv.patch
Normal file
59
zsh-5.0.7-cd-sigsegv.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 19c75aec6843b827fa7ef3f39174090ee7f8ac18 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
Date: Thu, 22 Jan 2015 20:20:15 +0000
|
||||
Subject: [PATCH] 34331: better handling of NULL in cd.
|
||||
|
||||
Problem was return from symbolic link expander in weird cases
|
||||
where there file system isn't behaving itself properly.
|
||||
|
||||
Upstream-commit: 12b813b5895cae579e403dafe43878868f27fe0f
|
||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||
---
|
||||
Src/builtin.c | 8 +++++---
|
||||
Src/utils.c | 11 +++++++----
|
||||
2 files changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Src/builtin.c b/Src/builtin.c
|
||||
index 2118835..489ca23 100644
|
||||
--- a/Src/builtin.c
|
||||
+++ b/Src/builtin.c
|
||||
@@ -1156,9 +1156,11 @@ cd_new_pwd(int func, LinkNode dir, int quiet)
|
||||
zsfree(getlinknode(dirstack));
|
||||
|
||||
if (chasinglinks) {
|
||||
- s = new_pwd;
|
||||
- new_pwd = findpwd(s);
|
||||
- zsfree(s);
|
||||
+ s = findpwd(new_pwd);
|
||||
+ if (s) {
|
||||
+ zsfree(new_pwd);
|
||||
+ new_pwd = s;
|
||||
+ }
|
||||
}
|
||||
if (isset(PUSHDIGNOREDUPS)) {
|
||||
LinkNode n;
|
||||
diff --git a/Src/utils.c b/Src/utils.c
|
||||
index e6eb8e6..80396a2 100644
|
||||
--- a/Src/utils.c
|
||||
+++ b/Src/utils.c
|
||||
@@ -1049,10 +1049,13 @@ getnameddir(char *name)
|
||||
if ((pw = getpwnam(name))) {
|
||||
char *dir = isset(CHASELINKS) ? xsymlink(pw->pw_dir)
|
||||
: ztrdup(pw->pw_dir);
|
||||
- adduserdir(name, dir, ND_USERNAME, 1);
|
||||
- str = dupstring(dir);
|
||||
- zsfree(dir);
|
||||
- return str;
|
||||
+ if (dir) {
|
||||
+ adduserdir(name, dir, ND_USERNAME, 1);
|
||||
+ str = dupstring(dir);
|
||||
+ zsfree(dir);
|
||||
+ return str;
|
||||
+ } else
|
||||
+ return ztrdup(pw->pw_dir);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_GETPWNAM */
|
||||
--
|
||||
2.1.0
|
||||
|
5
zsh.spec
5
zsh.spec
@ -26,6 +26,9 @@ Patch6: zsh-5.0.7-wait-for-exited.patch
|
||||
# suppress a warning about closing an already closed file descriptor (#1184002)
|
||||
Patch7: zsh-5.0.7-close-fd.patch
|
||||
|
||||
# improve handling of NULL in the 'cd' built-in (#1183238)
|
||||
Patch8: zsh-5.0.7-cd-sigsegv.patch
|
||||
|
||||
BuildRequires: coreutils sed ncurses-devel libcap-devel
|
||||
BuildRequires: texinfo texi2html gawk hostname
|
||||
Requires(post): info grep
|
||||
@ -64,6 +67,7 @@ This package contains the Zsh manual in html format.
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
|
||||
cp -p %SOURCE7 .
|
||||
|
||||
@ -183,6 +187,7 @@ fi
|
||||
%changelog
|
||||
* Fri Jan 23 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.7-5
|
||||
- suppress a warning about closing an already closed file descriptor (#1184002)
|
||||
- improve handling of NULL in the 'cd' built-in (#1183238)
|
||||
|
||||
* Wed Nov 19 2014 Kamil Dudka <kdudka@redhat.com> - 5.0.7-4
|
||||
- update documentation of POSIX_JOBS in the zshoptions.1 man page (#1162198)
|
||||
|
Loading…
Reference in New Issue
Block a user