Skip to content

BBC: Async-Interrupt-1.25 does not compile anymore since perl 5.31.6 #17392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
eserte opened this issue Dec 26, 2019 · 26 comments
Closed

BBC: Async-Interrupt-1.25 does not compile anymore since perl 5.31.6 #17392

eserte opened this issue Dec 26, 2019 · 26 comments
Assignees
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s)

Comments

@eserte
Copy link
Contributor

eserte commented Dec 26, 2019

The compilation of MLEHMANN/Async-Interrupt-1.25.tar.gz fails with bleadperl with a error message like this:

Interrupt.xs:209:29: error: too many arguments to function call, expected 1, have 3

Overview of test reports: http://matrix.cpantesters.org/?dist=Async-Interrupt+1.25

A sample report with this compilation failure:

@eserte eserte added BBC Blead Breaks CPAN - changes in blead broke a cpan module(s) Needs Triage affects-5.31 labels Dec 26, 2019
@jkeenan
Copy link
Contributor

jkeenan commented Dec 27, 2019

The compilation of MLEHMANN/Async-Interrupt-1.25.tar.gz fails with bleadperl with a error message like this:

Interrupt.xs:209:29: error: too many arguments to function call, expected 1, have 3

Overview of test reports: http://matrix.cpantesters.org/?dist=Async-Interrupt+1.25

A sample report with this compilation failure:

* http://www.cpantesters.org/cpan/report/1fc16e4a-23d4-11ea-ae93-77311f24ea8f (gcc)

* http://www.cpantesters.org/cpan/report/af72acde-2113-11ea-82f8-32321f24ea8f (clang)

Module has build-time failure. Excerpt from cpanm build.log:

Building and testing Async-Interrupt-1.25
cp Interrupt.pm blib/lib/Async/Interrupt.pm
Running Mkbootstrap for Interrupt ()
chmod 644 "Interrupt.bs"
"/home/jkeenan/testing/threaded_blead/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- Interrupt.bs blib/arch/auto/Async/Interrupt/Interrupt.bs 644
"/home/jkeenan/testing/threaded_blead/bin/perl" "/home/jkeenan/testing/threaded_blead/lib/perl5/5.31.7/ExtUtils/xsubpp"  -typemap '/home/jkeenan/testing/threaded_blead/lib/perl5/5.31.7/ExtUtils/typemap' -typemap '/home/jkeenan/.cpanm/work/1577414059.16137/Async-Interrupt-1.25/typemap'  Interrupt.xs > Interrupt.xsc
Warning: Aliases 'fileno_r' and 'fileno' have identical values in Interrupt.xs, line 515
mv Interrupt.xsc Interrupt.c
cc -c   -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2   -DVERSION=\"1.25\" -DXS_VERSION=\"1.25\" -fPIC "-I/home/jkeenan/testing/threaded_blead/lib/perl5/5.31.7/x86_64-linux-thread-multi/CORE"   Interrupt.c
Interrupt.xs: In function ‘async_sighandler’:
Interrupt.xs:209:5: error: too many arguments to function ‘old_sighandler’
     old_sighandler (signum, si, sarg);
     ^~~~~~~~~~~~~~
Interrupt.xs: In function ‘boot_Async__Interrupt’:
Interrupt.xs:264:24: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
         PL_sighandlerp = async_sighandler;
                        ^
In file included from Interrupt.xs:8:0:
schmorp.h: In function ‘s_epipe_signal’:
schmorp.h:450:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
     write (epp->fd [1], &counter, (epp->len = 8));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
schmorp.h: In function ‘s_epipe_drain’:
schmorp.h:463:3: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
   read (epp->fd [0], buf, sizeof (buf));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:331: recipe for target 'Interrupt.o' failed
make: *** [Interrupt.o] Error 1
-> FAIL Installing Async::Interrupt failed.

Bisecting with the following invocation:

perl Porting/bisect.pl \
--start=559a77e6ab \
--end=v5.31.6 \
--module=Async::Interrupt

... points to this commit:

c99d8cd6ea985084aa149f8f2b39217d6fc9068f is the first bad commit
commit c99d8cd6ea985084aa149f8f2b39217d6fc9068f
Author: David Mitchell <[email protected]>
Date:   Tue Nov 12 10:47:30 2019 +0000
Commit:     David Mitchell <[email protected]>
CommitDate: Mon Nov 18 09:34:40 2019 +0000

    declare perl core's sig handler as 1-arg
    
    First some background:
    
    UNIXy OSes support two types of signal handler function:
    
        Signal_t handler1(int sig);
        Signal_t handler3(int sig, siginfo_t *info, void *uap);
    
    The original one-argument handler was set using the signal(2) system
    call. The newer sigaction(2) system call allows either a 1-arg or
    3-arg handler to be specified:
    
        act.sa_handler = handler1;
        sigaction(sig, act, NULL);
    
        act.sa_sigaction = handler3;
        act.sa_sa_flags |= SA_SIGINFO;
        sigaction(sig, act, NULL);
    
    The current behaviour in perl core is that, in the presence of
    HAS_SIGACTION and SA_SIGINFO, the signal handler type and function are
    both declared as 3-arg, but perl still tells the kernel that the
    supplied signal handler function takes one arg. This means that whenever
    the kernel calls the handler, args 2 and 3 are whatever garbage the OS
    and architecture cause them to happen to be.
    
    Note that POSIX.xs *does* allow a 3-arg signal handler to be specified
    by passing the SA_SIGINFO flag, and a couple of tests check for this.
    
    Recently, gcc-8 has (quite reasonably) been warning that we're passing
    around 3-arg function pointers where a 1-arg function pointer is
    expected.
    
    After the groundwork laid down by the previous commits in this branch,
    this commit flips things over so that the perl core now declares its
    handlers and handler type as being 1-arg, thus reflecting the reality
    that the core has actually being using 1-arg handlers.
    
    This makes a whole bunch of compiler noise like this go away:
    
        perl.h:2825:51: warning: cast between incompatible function types
        from ‘__sighandler_t’ {aka ‘void (*)(int)’} to ‘void (*)(int,
        siginfo_t *, void *)’ {aka ‘void (*)(int,  struct <anonymous> *,
        void *)’} [-Wcast-function-type]
    
    In theory this should make no functional difference. It might cause
    3rd-party XS modules to emit compiler warnings now if they are relying
    on things like Sighandler_t to represent a 3-arg function - this commit
    flips it to being 1-arg.

@iabyn, can you take a look?

Thank you very much.
Jim Keenan

@iabyn
Copy link
Contributor

iabyn commented Jan 2, 2020 via email

@jkeenan
Copy link
Contributor

jkeenan commented Jan 2, 2020

On Thu, Dec 26, 2019 at 06:41:36PM -0800, James E Keenan wrote: > The compilation of MLEHMANN/Async-Interrupt-1.25.tar.gz fails with bleadperl with a error message like this: > > ``` > Interrupt.xs:209:29: error: too many arguments to function call, expected 1, have 3
This will almost certainly be a side-effect of my merge commit shown below. It turned a broken mess into a slightly less broken mess, and as a side-effect, affects how many args low-level (i.e. OS) signal handlers need to be declared and/or called with. Async-Interrupt will have to be updated to handle the new reality.

Do you think this patch for the upstream module would suffice?

--- Interrupt.xs.orig	2020-01-02 18:09:14.713390791 -0500
+++ Interrupt.xs	2020-01-02 18:12:18.846461882 -0500
@@ -201,12 +201,12 @@
 }
 
 #if HAS_SA_SIGINFO
-static Signal_t async_sighandler (int signum, siginfo_t *si, void *sarg)
+static Signal_t async_sighandler (int signum)
 {
   if (signum == 9)
     handle_asyncs ();
   else
-    old_sighandler (signum, si, sarg);
+    old_sighandler (signum);
 }
 #else
 static Signal_t async_sighandler (int signum)

It passes all tests -- but the test coverage for that distro is not high. (And it would need guards for Perl versions.)

Thank you very much.
Jim Keenan

@iabyn
Copy link
Contributor

iabyn commented Jan 3, 2020 via email

@Leont
Copy link
Contributor

Leont commented Jan 4, 2020

Do you think this patch for the upstream module would suffice?

It looks to me like it would break on perls before this change. It's probably a better idea to make it use the #else on perls after c99d8cd

@Leont
Copy link
Contributor

Leont commented Jan 5, 2020

But since this is a Marc Lehmann module, I'm not going to devote any
effort to fix it. Even submitting correct fixes to him is likely to be
rewarded with a stream of invective, which I can do without.

I don't think that making comments like these will make that situation any better

@khwilliamson
Copy link
Contributor

khwilliamson commented Jan 5, 2020 via email

@toddr
Copy link
Member

toddr commented Feb 17, 2020

If someone wants to give me the patch, I'll be happy to let him vent at me.

@toddr toddr added this to the 5.32.0 milestone Feb 17, 2020
@iabyn
Copy link
Contributor

iabyn commented Feb 18, 2020 via email

@xsawyerx
Copy link
Member

xsawyerx commented Apr 1, 2020

I cannot ask Dave to write such a patch if he is not interested in it. He experienced enough to step back and not get involved. I understand and support it.

@tonycoz, do you think there's enough information here for you to try and come up with a patch for it? Todd will be handling the communication with the author.

@xsawyerx
Copy link
Member

xsawyerx commented Apr 1, 2020

In any case, we still need to determine if this is a blocker. I think it should stay a blocker and forces us to revert if we cannot resolve it one way or the other. Considering we haven't reached out to the author yet, we need to do that first. (Hopefully with a patch.)

@Leont
Copy link
Contributor

Leont commented Apr 1, 2020

The following patch fixes the issue (tested on 5.24.0 and 5.31.10):

From 2fc0da67fb02cf578081bb0efe8bf76ec5190582 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <[email protected]>
Date: Wed, 1 Apr 2020 23:26:53 +0200
Subject: [PATCH] Fix signal handler chaining on 5.31.6+

This was broken by core commit c99d8cd6ea985084aa149f8f2b39217d6fc9068f
---
 Interrupt.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git Interrupt.xs Interrupt.xs
index a177b2e..d99fd6c 100644
--- Interrupt.xs
+++ Interrupt.xs
@@ -200,7 +200,7 @@ handle_asyncs (void)
     }
 }
 
-#if HAS_SA_SIGINFO
+#if HAS_SA_SIGINFO && !PERL_VERSION_ATLEAST(5, 31, 6)
 static Signal_t async_sighandler (int signum, siginfo_t *si, void *sarg)
 {
   if (signum == 9)
-- 
2.26.0

@jkeenan
Copy link
Contributor

jkeenan commented Apr 1, 2020

The following patch fixes the issue (tested on 5.24.0 and 5.31.10):

From 2fc0da67fb02cf578081bb0efe8bf76ec5190582 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <[email protected]>
Date: Wed, 1 Apr 2020 23:26:53 +0200
Subject: [PATCH] Fix signal handler chaining on 5.31.6+

This was broken by core commit c99d8cd6ea985084aa149f8f2b39217d6fc9068f
---
 Interrupt.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git Interrupt.xs Interrupt.xs
index a177b2e..d99fd6c 100644
--- Interrupt.xs
+++ Interrupt.xs
@@ -200,7 +200,7 @@ handle_asyncs (void)
     }
 }
 
-#if HAS_SA_SIGINFO
+#if HAS_SA_SIGINFO && !PERL_VERSION_ATLEAST(5, 31, 6)
 static Signal_t async_sighandler (int signum, siginfo_t *si, void *sarg)
 {
   if (signum == 9)
-- 
2.26.0

With @Leont's patch, I was able to install Async::Interrupt on unthreaded builds on Linux for the following production versions and also on a post-5.31.10 blead.

  513  perlbrew use perl-5.12.5
  522  perlbrew use perl-5.14.4
  529  perlbrew use perl-5.16.3
  532  perlbrew use perl-5.18.4
  538  perlbrew use perl-5.20.3
  542  perlbrew use perl-5.22.3
  546  perlbrew use perl-5.24.4
  550  perlbrew use perl-5.26.2
  554  perlbrew use perl-5.28.0
  559  perlbrew use perl-5.30.0

With that patch I was also able to install Async::Interrupt against a threaded post-5.31.10 build on FreeBSD-11.

Thank you very much.
Jim Keenan

@jkeenan
Copy link
Contributor

jkeenan commented Apr 1, 2020

The following patch fixes the issue (tested on 5.24.0 and 5.31.10):

From 2fc0da67fb02cf578081bb0efe8bf76ec5190582 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <[email protected]>
Date: Wed, 1 Apr 2020 23:26:53 +0200
Subject: [PATCH] Fix signal handler chaining on 5.31.6+

This was broken by core commit c99d8cd6ea985084aa149f8f2b39217d6fc9068f
---
 Interrupt.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git Interrupt.xs Interrupt.xs
index a177b2e..d99fd6c 100644
--- Interrupt.xs
+++ Interrupt.xs
@@ -200,7 +200,7 @@ handle_asyncs (void)
     }
 }
 
-#if HAS_SA_SIGINFO
+#if HAS_SA_SIGINFO && !PERL_VERSION_ATLEAST(5, 31, 6)
 static Signal_t async_sighandler (int signum, siginfo_t *si, void *sarg)
 {
   if (signum == 9)
-- 
2.26.0

With @Leont's patch, I was able to install Async::Interrupt on unthreaded builds on Linux for the following production versions and also on a post-5.31.10 blead.

  513  perlbrew use perl-5.12.5
  522  perlbrew use perl-5.14.4
  529  perlbrew use perl-5.16.3
  532  perlbrew use perl-5.18.4
  538  perlbrew use perl-5.20.3
  542  perlbrew use perl-5.22.3
  546  perlbrew use perl-5.24.4
  550  perlbrew use perl-5.26.2
  554  perlbrew use perl-5.28.0
  559  perlbrew use perl-5.30.0

With that patch I was also able to install Async::Interrupt against a threaded post-5.31.10 build on FreeBSD-11.

Thank you very much.
Jim Keenan

Also was able to install Async::Interrupt on NetBSD-8.0 and OpenBSD-6.6. Example:

[openbsd66: blead] $ uname -mrs
OpenBSD 6.6 amd64
[openbsd66: blead] $ ./bin/perl -v | head -2 | tail -1 
This is perl 5, version 32, subversion 0 (v5.32.0 (v5.31.10-26-g45f87e6586)) built for OpenBSD.amd64-openbsd-thread-multi
[openbsd66: blead] $ ./bin/perl -MAsync::Interrupt -E 'say q|hello world|;'
hello world

@khwilliamson
Copy link
Contributor

Is there a reason not to apply this?

@jkeenan
Copy link
Contributor

jkeenan commented Apr 2, 2020

Is there a reason not to apply this?

It has to be applied upstream on CPAN. It's not patching blead, nor does Async-Interrupt ship with core.

@toddr
Copy link
Member

toddr commented Apr 2, 2020

The following patch fixes the issue (tested on 5.24.0 and 5.31.10):

From 2fc0da67fb02cf578081bb0efe8bf76ec5190582 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <[email protected]>
Date: Wed, 1 Apr 2020 23:26:53 +0200
Subject: [PATCH] Fix signal handler chaining on 5.31.6+

This was broken by core commit c99d8cd6ea985084aa149f8f2b39217d6fc9068f
---
 Interrupt.xs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git Interrupt.xs Interrupt.xs
index a177b2e..d99fd6c 100644
--- Interrupt.xs
+++ Interrupt.xs
@@ -200,7 +200,7 @@ handle_asyncs (void)
     }
 }
 
-#if HAS_SA_SIGINFO
+#if HAS_SA_SIGINFO && !PERL_VERSION_ATLEAST(5, 31, 6)
 static Signal_t async_sighandler (int signum, siginfo_t *si, void *sarg)
 {
   if (signum == 9)
-- 
2.26.0

Looks simple. Does everything work above 5.31.6? what are we disabling? Was he overriding a core perl function there?

@Leont
Copy link
Contributor

Leont commented Apr 3, 2020

Does everything work above 5.31.6?

It appears so.

what are we disabling?

Two arguments that are only used for unsafe signals, not for safe signals.

Was he overriding a core perl function there?

Yes, the handler for safe signals.

@xsawyerx
Copy link
Member

xsawyerx commented Apr 4, 2020

@toddr Can you submit this to the author?

@toddr
Copy link
Member

toddr commented Apr 5, 2020

yep

@xsawyerx
Copy link
Member

@toddr I cannot find a ticket for this, nor is there a new version of Async-Interrupt. Did you reach out to the author with it?

@toddr toddr self-assigned this Apr 16, 2020
@toddr
Copy link
Member

toddr commented Apr 21, 2020

@toddr I cannot find a ticket for this, nor is there a new version of Async-Interrupt. Did you reach out to the author with it?

Marc doesn't do RT. However It appears to have already been reported to him here in January by Andreas. http://lists.schmorp.de/pipermail/anyevent/2020q1/000893.html

@toddr
Copy link
Member

toddr commented Apr 21, 2020

I have sent him an email. Let's give it a few days for a response.

@xsawyerx
Copy link
Member

And a lovely response in return, finding an opportunity to bash p5p. sigh

I'm keeping this issue open for observation, but it is no longer a blocker for 5.32.0.

@xsawyerx xsawyerx removed this from the 5.32.0 milestone Apr 23, 2020
@toddr
Copy link
Member

toddr commented Apr 27, 2020

Marc has released the patch provided by @Leont. cpantesters already shows it is passing on 5.31.10. I think we're all done here. Closing case.

@toddr toddr closed this as completed Apr 27, 2020
@toddr
Copy link
Member

toddr commented Apr 27, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BBC Blead Breaks CPAN - changes in blead broke a cpan module(s)
Projects
None yet
Development

No branches or pull requests

7 participants