Saturday, May 28, 2022

Re: fdm-2.0pl20211129 in ports returns 1 on success

On 2022-05-28, Jacqueline Jolicoeur <fented@airmail.cc> wrote:
> Hi,
>
> I recently noticed that fdm no longer returns 0 on success.
>
> Is this related to the following?
>
> https://marc.info/?l=openbsd-ports-cvs&m=165330370732379
>
> https://github.com/nicm/fdm/commit/6d5aade623da551838791bb3aaf22572eaf7d99f

Yes it seems to be.

Can you try this?
(patch from https://github.com/nicm/fdm/issues/94#issuecomment-1059969559)

Index: Makefile
===================================================================
RCS file: /cvs/ports/mail/fdm/Makefile,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile
--- Makefile 23 May 2022 11:02:53 -0000 1.27
+++ Makefile 28 May 2022 18:37:15 -0000
@@ -8,6 +8,8 @@ V= 2.0pl20211129
DISTNAME= fdm-$V
CATEGORIES= mail

+REVISION= 0
+
MAINTAINER= Nicholas Marriott <nicm@openbsd.org>

# BSD
Index: patches/patch-fdm_c
===================================================================
RCS file: patches/patch-fdm_c
diff -N patches/patch-fdm_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-fdm_c 28 May 2022 18:37:15 -0000
@@ -0,0 +1,41 @@
+https://github.com/nicm/fdm/issues/94#issuecomment-1059969559
+
+Index: fdm.c
+--- fdm.c.orig
++++ fdm.c
+@@ -253,6 +253,8 @@ wait_children(
+ child2 = ARRAY_ITEM(children, j);
+ if (child2->parent != child)
+ continue;
++ if (child2->exit_req)
++ continue;
+
+ log_debug2("parent: child %ld died: killing %ld",
+ (long) child->pid, (long) child2->pid);
+@@ -779,7 +781,7 @@ retry:
+ ARRAY_CLEAR(&iol);
+ for (i = 0; i < ARRAY_LENGTH(&children); i++) {
+ child = ARRAY_ITEM(&children, i);
+- if (child->io != NULL)
++ if (child->io != NULL && !child->exit_req)
+ ARRAY_ADD(&iol, child->io);
+ }
+
+@@ -817,6 +819,7 @@ retry:
+ msg.type = MSG_EXIT;
+ if (privsep_send(child->io, &msg, NULL) != 0)
+ fatalx("privsep_send error");
++ child->exit_req = 1;
+ }
+
+ /* Collect any dead children. */
+@@ -830,6 +833,9 @@ retry:
+ child = ARRAY_ITEM(&children, i);
+ if (dead_io != child->io)
+ continue;
++ if (child->exit_req)
++ continue;
++
+ log_debug2("parent: child %ld socket error",
+ (long) child->pid);
+ kill(child->pid, SIGTERM);
Index: patches/patch-fdm_h
===================================================================
RCS file: patches/patch-fdm_h
diff -N patches/patch-fdm_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-fdm_h 28 May 2022 18:37:15 -0000
@@ -0,0 +1,14 @@
+https://github.com/nicm/fdm/issues/94#issuecomment-1059969559
+
+Index: fdm.h
+--- fdm.h.orig
++++ fdm.h
+@@ -459,6 +459,8 @@ struct child {
+
+ void *buf;
+ size_t len;
++
++ int exit_req;
+ };
+
+ /* List of children. */

No comments:

Post a Comment