pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/shells/zsh zsh: add candidate upstream patch for bg/fg...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/725fa14f85ce
branches:  trunk
changeset: 387788:725fa14f85ce
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Sun Nov 06 20:58:00 2022 +0000

description:
zsh: add candidate upstream patch for bg/fg issue with shell functions

Bump PKGREVISION.

diffstat:

 shells/zsh/Makefile                 |   4 +-
 shells/zsh/distinfo                 |   3 +-
 shells/zsh/patches/patch-Src_jobs.c |  70 +++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 3 deletions(-)

diffs (102 lines):

diff -r 694740666b4d -r 725fa14f85ce shells/zsh/Makefile
--- a/shells/zsh/Makefile       Sun Nov 06 18:46:14 2022 +0000
+++ b/shells/zsh/Makefile       Sun Nov 06 20:58:00 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.104 2022/07/01 23:31:49 rin Exp $
+# $NetBSD: Makefile,v 1.105 2022/11/06 20:58:00 wiz Exp $
 
 DISTNAME=      zsh-5.9
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    shells
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=zsh/}
 EXTRACT_SUFX=  .tar.xz
diff -r 694740666b4d -r 725fa14f85ce shells/zsh/distinfo
--- a/shells/zsh/distinfo       Sun Nov 06 18:46:14 2022 +0000
+++ b/shells/zsh/distinfo       Sun Nov 06 20:58:00 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.78 2022/07/01 23:31:49 rin Exp $
+$NetBSD: distinfo,v 1.79 2022/11/06 20:58:00 wiz Exp $
 
 BLAKE2s (zsh-5.9.tar.xz) = 1ab2ab9dd0debc176bdefd661b62e102153c26f591e35916ccc7527c337d0530
 SHA512 (zsh-5.9.tar.xz) = d9138b7f379ad942a5f46819d2dd52d31f3a1129f2a0d1b53d4c5cd43c318b60396da6d37c57c477b8e958fb750209aca0ae93f8c9dd42ac958de006a0ff067e
@@ -6,4 +6,5 @@
 SHA1 (patch-Completion_BSD_Command___bsd__pkg) = fe0d9cc399fe185ce71a64431e4086ed07920cb8
 SHA1 (patch-Completion_Unix_Command___gpg) = 8eba031838b1cfb0bfadf0fa539e760fd1cb539c
 SHA1 (patch-Config_installfns.sh) = ef0b250a0121c0e4925022e02553aefa23e6cc8d
+SHA1 (patch-Src_jobs.c) = d4be7424283f22a5ce26ba6aebfe51f105c033ce
 SHA1 (patch-configure) = 1b757f0ba6611a206f2e9c4d3de5c11fc629a364
diff -r 694740666b4d -r 725fa14f85ce shells/zsh/patches/patch-Src_jobs.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/shells/zsh/patches/patch-Src_jobs.c       Sun Nov 06 20:58:00 2022 +0000
@@ -0,0 +1,70 @@
+$NetBSD: patch-Src_jobs.c,v 1.1 2022/11/06 20:58:00 wiz Exp $
+
+Candidate fix for shell function pipeline bg/fg issue, from
+https://zsh.org/mla/workers/2022/msg01204.html
+
+--- Src/jobs.c.orig    2022-05-08 06:18:22.000000000 +0000
++++ Src/jobs.c
+@@ -544,16 +544,14 @@ update_job(Job jn)
+ 
+     if (isset(MONITOR)) {
+       pid_t pgrp = gettygrp();           /* get process group of tty      */
++      int deadpgrp = (mypgrp != pgrp && inforeground && pgrp > 1 &&
++                      kill(-pgrp, 0) == -1 && errno == ESRCH);
+ 
+       /* is this job in the foreground of an interactive shell? */
+       if (mypgrp != pgrp && inforeground &&
+-          (jn->gleader == pgrp ||
+-           (pgrp > 1 &&
+-            (kill(-pgrp, 0) == -1 && errno == ESRCH)))) {
++          ((jn->gleader == pgrp && signalled) || deadpgrp)) {
+           if (list_pipe) {
+-              if (somestopped || (pgrp > 1 &&
+-                                  kill(-pgrp, 0) == -1 &&
+-                                  errno == ESRCH)) {
++              if (somestopped || deadpgrp) {
+                   attachtty(mypgrp);
+                   /* check window size and adjust if necessary */
+                   adjustwinsize(0);
+@@ -566,6 +564,12 @@ update_job(Job jn)
+                    * when the job is finally deleted.
+                    */
+                   jn->stat |= STAT_ATTACH;
++                  /*
++                   * If we're in shell jobs on the right side of a pipeline
++                   * we should treat it like a job in the current shell.
++                   */
++                  if (inforeground == 2)
++                      inforeground = 1;
+               }
+               /* If we have `foo|while true; (( x++ )); done', and hit
+                * ^C, we have to stop the loop, too. */
+@@ -1488,10 +1492,7 @@ addproc(pid_t pid, char *text, int aux, 
+        * set it for that, too.
+        */
+       if (gleader != -1) {
+-          if (jobtab[thisjob].stat & STAT_CURSH)
+-              jobtab[thisjob].gleader = gleader;
+-          else
+-              jobtab[thisjob].gleader = pid;
++          jobtab[thisjob].gleader = gleader;
+           if (list_pipe_job_used != -1)
+               jobtab[list_pipe_job_used].gleader = gleader;
+           /*
+@@ -1500,7 +1501,7 @@ addproc(pid_t pid, char *text, int aux, 
+            */
+           last_attached_pgrp = gleader;
+       } else if (!jobtab[thisjob].gleader)
+-              jobtab[thisjob].gleader = pid;
++          jobtab[thisjob].gleader = pid;
+       /* attach this process to end of process list of current job */
+       pnlist = &jobtab[thisjob].procs;
+     }
+@@ -2488,6 +2489,7 @@ bin_fg(char *name, char **argv, Options 
+               jobtab[job].stat &= ~STAT_CURSH;
+           }
+           if ((stopped = (jobtab[job].stat & STAT_STOPPED))) {
++              /* WIFCONTINUED will makerunning() again at killjb() */
+               makerunning(jobtab + job);
+               if (func == BIN_BG) {
+                   /* Set $! to indicate this was backgrounded */



Home | Main Index | Thread Index | Old Index