Sun Nov 6 20:58:00 2022 UTC ()
zsh: add candidate upstream patch for bg/fg issue with shell functions
Bump PKGREVISION.
(wiz)
diff -r1.104 -r1.105 pkgsrc/shells/zsh/Makefile
diff -r1.78 -r1.79 pkgsrc/shells/zsh/distinfo
diff -r0 -r1.1 pkgsrc/shells/zsh/patches/patch-Src_jobs.c
--- pkgsrc/shells/zsh/Makefile 2022/07/01 23:31:49 1.104
+++ pkgsrc/shells/zsh/Makefile 2022/11/06 20:58:00 1.105
| @@ -1,17 +1,17 @@ | | | @@ -1,17 +1,17 @@ |
1 | # $NetBSD: Makefile,v 1.104 2022/07/01 23:31:49 rin Exp $ | | 1 | # $NetBSD: Makefile,v 1.105 2022/11/06 20:58:00 wiz Exp $ |
2 | | | 2 | |
3 | DISTNAME= zsh-5.9 | | 3 | DISTNAME= zsh-5.9 |
4 | PKGREVISION= 1 | | 4 | PKGREVISION= 2 |
5 | CATEGORIES= shells | | 5 | CATEGORIES= shells |
6 | MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=zsh/} | | 6 | MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=zsh/} |
7 | EXTRACT_SUFX= .tar.xz | | 7 | EXTRACT_SUFX= .tar.xz |
8 | | | 8 | |
9 | MAINTAINER= pkgsrc-users@NetBSD.org | | 9 | MAINTAINER= pkgsrc-users@NetBSD.org |
10 | HOMEPAGE= https://zsh.sourceforge.io/ | | 10 | HOMEPAGE= https://zsh.sourceforge.io/ |
11 | COMMENT= The Z shell | | 11 | COMMENT= The Z shell |
12 | LICENSE= gnu-gpl-v2 AND zsh | | 12 | LICENSE= gnu-gpl-v2 AND zsh |
13 | | | 13 | |
14 | USE_LANGUAGES= c c99 | | 14 | USE_LANGUAGES= c c99 |
15 | USE_TOOLS+= makeinfo | | 15 | USE_TOOLS+= makeinfo |
16 | GNU_CONFIGURE= yes | | 16 | GNU_CONFIGURE= yes |
17 | INFO_FILES= yes | | 17 | INFO_FILES= yes |
--- pkgsrc/shells/zsh/distinfo 2022/07/01 23:31:49 1.78
+++ pkgsrc/shells/zsh/distinfo 2022/11/06 20:58:00 1.79
| @@ -1,9 +1,10 @@ | | | @@ -1,9 +1,10 @@ |
1 | $NetBSD: distinfo,v 1.78 2022/07/01 23:31:49 rin Exp $ | | 1 | $NetBSD: distinfo,v 1.79 2022/11/06 20:58:00 wiz Exp $ |
2 | | | 2 | |
3 | BLAKE2s (zsh-5.9.tar.xz) = 1ab2ab9dd0debc176bdefd661b62e102153c26f591e35916ccc7527c337d0530 | | 3 | BLAKE2s (zsh-5.9.tar.xz) = 1ab2ab9dd0debc176bdefd661b62e102153c26f591e35916ccc7527c337d0530 |
4 | SHA512 (zsh-5.9.tar.xz) = d9138b7f379ad942a5f46819d2dd52d31f3a1129f2a0d1b53d4c5cd43c318b60396da6d37c57c477b8e958fb750209aca0ae93f8c9dd42ac958de006a0ff067e | | 4 | SHA512 (zsh-5.9.tar.xz) = d9138b7f379ad942a5f46819d2dd52d31f3a1129f2a0d1b53d4c5cd43c318b60396da6d37c57c477b8e958fb750209aca0ae93f8c9dd42ac958de006a0ff067e |
5 | Size (zsh-5.9.tar.xz) = 3332400 bytes | | 5 | Size (zsh-5.9.tar.xz) = 3332400 bytes |
6 | SHA1 (patch-Completion_BSD_Command___bsd__pkg) = fe0d9cc399fe185ce71a64431e4086ed07920cb8 | | 6 | SHA1 (patch-Completion_BSD_Command___bsd__pkg) = fe0d9cc399fe185ce71a64431e4086ed07920cb8 |
7 | SHA1 (patch-Completion_Unix_Command___gpg) = 8eba031838b1cfb0bfadf0fa539e760fd1cb539c | | 7 | SHA1 (patch-Completion_Unix_Command___gpg) = 8eba031838b1cfb0bfadf0fa539e760fd1cb539c |
8 | SHA1 (patch-Config_installfns.sh) = ef0b250a0121c0e4925022e02553aefa23e6cc8d | | 8 | SHA1 (patch-Config_installfns.sh) = ef0b250a0121c0e4925022e02553aefa23e6cc8d |
| | | 9 | SHA1 (patch-Src_jobs.c) = d4be7424283f22a5ce26ba6aebfe51f105c033ce |
9 | SHA1 (patch-configure) = 1b757f0ba6611a206f2e9c4d3de5c11fc629a364 | | 10 | SHA1 (patch-configure) = 1b757f0ba6611a206f2e9c4d3de5c11fc629a364 |
$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 */