On Tue, Apr 18, 2023 at 11:09:48AM +0100, Richard W.M. Jones wrote:
On Tue, Apr 18, 2023 at 12:00:22PM +0200, Laszlo Ersek wrote:
> On 4/18/23 09:25, Richard W.M. Jones wrote:
> > Commit 6b03ec8ad6 ("common: Move exit-with-parent code from include/
> > to utils/") was supposed to be a largely neutral refactoring of the
> > --exit-with-parent flag. However I made a mistake in one hunk of that
> > patch:
> >
> > -#ifdef HAVE_EXIT_WITH_PARENT
> > - if (exit_with_parent) {
> > - if (set_exit_with_parent () == -1) {
> > - perror ("nbdkit: --exit-with-parent");
> > - exit (EXIT_FAILURE);
> > - }
> > + if (set_exit_with_parent () == -1) {
> > + perror ("nbdkit: --exit-with-parent");
> > + exit (EXIT_FAILURE);
> > }
> > -#endif
> >
> > by removing the test for exit_with_parent. The effect is similar to
> > if we always specified --exit-with-parent when nbdkit is running in
> > the foreground.
> >
> > Somewhat surprisingly this didn't have any noticable effect. That's
> > for a few of reasons: (1) Mostly if you don't fork then you should be
> > using --exit-with-parent (and the bulk of the tests do this). (2) If
> > we do fork into the background then the PR_SET_PDEATHSIG flag is
> > cleared by Linux across the fork. (3) It actually _did_ break Windows
> > because there set_exit_with_parent calls abort, but for unrelated
> > reasons our Windows CI was broken (and never tested running
> > nbdkit.exe).
> >
> > Fix this with the obvious adjustment.
> >
> > This broke nbdkit 1.32 and 1.34.
> >
> > Fixes: commit 6b03ec8ad672e5956b41cbacae9c307e5acd786b
> > ---
> > server/main.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/server/main.c b/server/main.c
> > index c3b9bf384..1df5d69ac 100644
> > --- a/server/main.c
> > +++ b/server/main.c
> > @@ -574,9 +574,11 @@ main (int argc, char *argv[])
> > /* Implement --exit-with-parent early in case plugin initialization
> > * takes a long time and the parent exits during that time.
> > */
> > - if (set_exit_with_parent () == -1) {
> > - perror ("nbdkit: --exit-with-parent");
> > - exit (EXIT_FAILURE);
> > + if (exit_with_parent) {
> > + if (set_exit_with_parent () == -1) {
> > + perror ("nbdkit: --exit-with-parent");
> > + exit (EXIT_FAILURE);
> > + }
> > }
> >
> > /* If the user has mixed up -p/--run/-s/-U/--vsock options, then
>
> Reviewed-by: Laszlo Ersek <lersek(a)redhat.com>
Thanks, pushed as beae44398ddd5386add34b43353ed16e2df0f30e
I have nearly got all the tests passing on Wine (with my out of tree
AF_UNIX patch). And in other news ...
I have just pushed a few patches which fix or skip all the tests when
cross-compiling and using the patched Wine ...
============================================================================
Testsuite summary for nbdkit 1.34.0
============================================================================
# TOTAL: 249
# PASS: 77
# SKIP: 172
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
============================================================================
As you can see I'm still hopeful that we can get AF_UNIX support added
to Wine, especially as there is now another user. The patch needs
some work to get it there.
Here is the patched version of Wine (out of date) which works:
https://github.com/rwmjones/wine/tree/2020-af-unix
Here is my attempt to update the patch which does not work yet:
https://github.com/rwmjones/wine/tree/2023-af-unix
At the moment the tests will certainly fail without patched Wine,
because a large number of them use Unix domain sockets (-U option). I
considered adding some kind of "requires_unix_socket ()" function, but
it would have to be added to almost all the tests, and it is actually
quite hard to write such a function to correctly distinguish between
unpatched Wine / patched Wine / real Windows anyway.
I will do nbdkit 1.32 & 1.34 stable releases today containing the
various fixes, especially the --exit-with-parent fix.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW