[Pkg-zsh-commits] [zsh] 06/09: Cherry-pick 2d14c085 (33445: fix handling of -s when combined with -i at shell invocation) from upstream

Axel Beckert abe at deuxchevaux.org
Mon Oct 13 21:11:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch debian
in repository zsh.

commit adb279146c7bab48aa040f9c7d5a886f1bafbdfc
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Mon Oct 13 22:42:51 2014 +0200

    Cherry-pick 2d14c085 (33445: fix handling of -s when combined with -i at shell invocation) from upstream
---
 ...-when-combined-with-i-at-shell-invocation.patch | 66 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 67 insertions(+)

diff --git a/debian/patches/cherry-pick-2d14c085-33445-fix-handling-of-s-when-combined-with-i-at-shell-invocation.patch b/debian/patches/cherry-pick-2d14c085-33445-fix-handling-of-s-when-combined-with-i-at-shell-invocation.patch
new file mode 100644
index 0000000..1fdc5cf
--- /dev/null
+++ b/debian/patches/cherry-pick-2d14c085-33445-fix-handling-of-s-when-combined-with-i-at-shell-invocation.patch
@@ -0,0 +1,66 @@
+Origin: commit 2d14c085b761c71e35cc362f87cd4fecbc8e0676
+Author: Barton E. Schaefer <schaefer at zsh.org>
+Date:   Sun Oct 12 11:18:30 2014 -0700
+Description: 33445: fix handling of -s when combined with -i at shell invocation
+ Fixes a long-standing (25+ years) bug where using -i -s together did have
+ the documented effect of disabling command line script files but also had
+ the side-effect of invoking ZLE, thereby ignoring the redirected input.
+
+diff --git a/Src/init.c b/Src/init.c
+index 6d005dc..68d3612 100644
+--- a/Src/init.c
++++ b/Src/init.c
+@@ -243,12 +243,24 @@ parseargs(char **argv, char **runscript)
+      */
+     opts[MONITOR] = 2;   /* may be unset in init_io() */
+     opts[HASHDIRS] = 2;  /* same relationship to INTERACTIVE */
++    opts[USEZLE] = 1;    /* see below, related to SHINSTDIN */
+     opts[SHINSTDIN] = 0;
+     opts[SINGLECOMMAND] = 0;
+ 
+     if (parseopts(NULL, &argv, opts, &cmd, NULL))
+ 	exit(1);
+ 
++    /*
++     * USEZLE remains set if the shell has access to a terminal and
++     * is not reading from some other source as indicated by SHINSTDIN.
++     * SHINSTDIN becomes set below if there is no command argument,
++     * but it is the explicit setting (or not) that matters to USEZLE.
++     * USEZLE may also become unset in init_io() if the shell is not
++     * interactive or the terminal cannot be re-opened read/write.
++     */
++    if (opts[SHINSTDIN])
++	opts[USEZLE] = (opts[USEZLE] && isatty(0));
++
+     paramlist = znewlinklist();
+     if (*argv) {
+ 	if (unset(SHINSTDIN)) {
+@@ -603,7 +615,7 @@ init_shout(void)
+ 
+     if (SHTTY == -1)
+     {
+-	/* Since we're interative, it's nice to have somewhere to write. */
++	/* Since we're interactive, it's nice to have somewhere to write. */
+ 	shout = stderr;
+ 	return;
+     }
+@@ -616,7 +628,8 @@ init_shout(void)
+     /* Associate terminal file descriptor with a FILE pointer */
+     shout = fdopen(SHTTY, "w");
+ #ifdef _IOFBF
+-    setvbuf(shout, shoutbuf, _IOFBF, BUFSIZ);
++    if (shout)
++	setvbuf(shout, shoutbuf, _IOFBF, BUFSIZ);
+ #endif
+   
+     gettyinfo(&shttyinfo);	/* get tty state */
+@@ -1608,8 +1621,7 @@ zsh_main(UNUSED(int argc), char **argv)
+     emulate(zsh_name, 1, &emulation, opts);   /* initialises most options */
+     opts[LOGINSHELL] = (**argv == '-');
+     opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
+-    opts[USEZLE] = 1;   /* may be unset in init_io() */
+-    /* sets INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
++    /* sets ZLE, INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
+     parseargs(argv, &runscript);
+ 
+     SHTTY = -1;
diff --git a/debian/patches/series b/debian/patches/series
index 315656f..f481959 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ cherry-pick-a03227de-33405-vcs-info-make-sure-maxexports-is-set-when-vcs-info-se
 cherry-pick-22c4ea42-33403-be-conservative-about-redirecting-call-program-stderr-the-caller-may-have-already-done-so.patch
 cherry-pick-605a73e4-33429-disallow-non-integer-values-for-histsize-and-savehist-of-fc-p-and-fix-crash-on-zero-values-for-same.patch
 cherry-pick-521313b4-tests-for-workers-33429.patch
+cherry-pick-2d14c085-33445-fix-handling-of-s-when-combined-with-i-at-shell-invocation.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git



More information about the Pkg-zsh-commits mailing list