Resolves: #1184002 - suppress a warning about closing an already closed file descriptor
This commit is contained in:
parent
85e12d8f44
commit
cb022dbd05
97
zsh-5.0.7-close-fd.patch
Normal file
97
zsh-5.0.7-close-fd.patch
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
From dc0675a5b8f89b8e504fe1641d57a896674caac5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Stephenson <pws@zsh.org>
|
||||||
|
Date: Tue, 20 Jan 2015 09:29:22 +0000
|
||||||
|
Subject: [PATCH 1/2] users/19751: remove error on failure to close file
|
||||||
|
descriptor by number.
|
||||||
|
|
||||||
|
Keep it when closing file descriptor stored in a variable, i.e.
|
||||||
|
explicitly opened by the user.
|
||||||
|
|
||||||
|
Upstream-commit: e6d964246700581fe22ea834b2ea12dd301e8c3d
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
Src/exec.c | 7 ++++++-
|
||||||
|
Test/A04redirect.ztst | 10 ++++++----
|
||||||
|
2 files changed, 12 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Src/exec.c b/Src/exec.c
|
||||||
|
index a9c4688..04c8b50 100644
|
||||||
|
--- a/Src/exec.c
|
||||||
|
+++ b/Src/exec.c
|
||||||
|
@@ -3167,7 +3167,12 @@ execcmd(Estate state, int input, int output, int how, int last1)
|
||||||
|
}
|
||||||
|
if (fn->fd1 < 10)
|
||||||
|
closemn(mfds, fn->fd1, REDIR_CLOSE);
|
||||||
|
- if (!closed && zclose(fn->fd1) < 0) {
|
||||||
|
+ /*
|
||||||
|
+ * Only report failures to close file descriptors
|
||||||
|
+ * if they're under user control as we don't know
|
||||||
|
+ * what the previous status of others was.
|
||||||
|
+ */
|
||||||
|
+ if (!closed && zclose(fn->fd1) < 0 && fn->varid) {
|
||||||
|
zwarn("failed to close file descriptor %d: %e",
|
||||||
|
fn->fd1, errno);
|
||||||
|
}
|
||||||
|
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
|
||||||
|
index a39ce46..cb67788 100644
|
||||||
|
--- a/Test/A04redirect.ztst
|
||||||
|
+++ b/Test/A04redirect.ztst
|
||||||
|
@@ -152,11 +152,13 @@
|
||||||
|
>hello
|
||||||
|
>goodbye
|
||||||
|
|
||||||
|
- ({ exec 3<&- } 2>/dev/null
|
||||||
|
- exec 3<&-
|
||||||
|
- read foo <&-)
|
||||||
|
+ (exec {varid}<&0
|
||||||
|
+ exec {varid}<&-
|
||||||
|
+ print About to close a second time >&2
|
||||||
|
+ read {varid}<&-)
|
||||||
|
1:'<&-' redirection
|
||||||
|
-*?\(eval\):*: failed to close file descriptor 3:*
|
||||||
|
+?About to close a second time
|
||||||
|
+*?\(eval\):*: failed to close file descriptor *
|
||||||
|
|
||||||
|
print foo >&-
|
||||||
|
0:'>&-' redirection
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
||||||
|
|
||||||
|
From 206fdc852a0f28dddce7411eafeb3ab29b0259ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Peter Stephenson <pws@zsh.org>
|
||||||
|
Date: Tue, 20 Jan 2015 11:53:42 +0000
|
||||||
|
Subject: [PATCH 2/2] users/19756: test for case of closing fd with no error
|
||||||
|
message
|
||||||
|
|
||||||
|
Upstream-commit: 638bfa93a009987e57bd7eaa8b2a1c1067a3652a
|
||||||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||||||
|
---
|
||||||
|
Test/A04redirect.ztst | 7 ++++++-
|
||||||
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/Test/A04redirect.ztst b/Test/A04redirect.ztst
|
||||||
|
index cb67788..13f1f7c 100644
|
||||||
|
--- a/Test/A04redirect.ztst
|
||||||
|
+++ b/Test/A04redirect.ztst
|
||||||
|
@@ -152,11 +152,16 @@
|
||||||
|
>hello
|
||||||
|
>goodbye
|
||||||
|
|
||||||
|
+ ({exec 3<&- } 2>/dev/null
|
||||||
|
+ exec 3<&-
|
||||||
|
+ read foo <&-)
|
||||||
|
+1:'<&-' redirection with numeric fd (no error message on failure)
|
||||||
|
+
|
||||||
|
(exec {varid}<&0
|
||||||
|
exec {varid}<&-
|
||||||
|
print About to close a second time >&2
|
||||||
|
read {varid}<&-)
|
||||||
|
-1:'<&-' redirection
|
||||||
|
+1:'<&-' redirection with fd in variable (error message on failure)
|
||||||
|
?About to close a second time
|
||||||
|
*?\(eval\):*: failed to close file descriptor *
|
||||||
|
|
||||||
|
--
|
||||||
|
2.1.0
|
||||||
|
|
9
zsh.spec
9
zsh.spec
@ -3,7 +3,7 @@
|
|||||||
Summary: Powerful interactive shell
|
Summary: Powerful interactive shell
|
||||||
Name: zsh
|
Name: zsh
|
||||||
Version: 5.0.7
|
Version: 5.0.7
|
||||||
Release: 4%{?dist}
|
Release: 5%{?dist}
|
||||||
License: MIT
|
License: MIT
|
||||||
URL: http://zsh.sourceforge.net/
|
URL: http://zsh.sourceforge.net/
|
||||||
Group: System Environment/Shells
|
Group: System Environment/Shells
|
||||||
@ -23,6 +23,9 @@ Patch5: zsh-test-C02-dev_fd-mock.patch
|
|||||||
# make the wait built-in work for already exited processes (#1162198)
|
# make the wait built-in work for already exited processes (#1162198)
|
||||||
Patch6: zsh-5.0.7-wait-for-exited.patch
|
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
|
||||||
|
|
||||||
BuildRequires: coreutils sed ncurses-devel libcap-devel
|
BuildRequires: coreutils sed ncurses-devel libcap-devel
|
||||||
BuildRequires: texinfo texi2html gawk hostname
|
BuildRequires: texinfo texi2html gawk hostname
|
||||||
Requires(post): info grep
|
Requires(post): info grep
|
||||||
@ -60,6 +63,7 @@ This package contains the Zsh manual in html format.
|
|||||||
%patch4 -p1
|
%patch4 -p1
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%patch6 -p1
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
|
||||||
cp -p %SOURCE7 .
|
cp -p %SOURCE7 .
|
||||||
|
|
||||||
@ -177,6 +181,9 @@ fi
|
|||||||
%doc Doc/*.html
|
%doc Doc/*.html
|
||||||
|
|
||||||
%changelog
|
%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)
|
||||||
|
|
||||||
* Wed Nov 19 2014 Kamil Dudka <kdudka@redhat.com> - 5.0.7-4
|
* 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)
|
- update documentation of POSIX_JOBS in the zshoptions.1 man page (#1162198)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user