Control: tag -1 patch

On Fri, Jan 08, 2016 at 11:19:03AM +0000, Dominic Hargreaves wrote:
> On Fri, Jan 08, 2016 at 12:50:37PM +0200, Niko Tyni wrote:
> > Package: perl-debug
> > Version: 5.22.1-3
> > Severity: important
> > 
> > Since 5.22, the 'debugperl' binary in perl-debug (built with
> > -DDEBUGGING=both) has become remarkably less useful.
> > 
> >   % debugperl -e 'use Cwd'
> >   Cwd.c: loadable library and perl binaries are mismatched (got handshake 
> > key 0xdb00080, needed 0xdc80080)
> > 
> > I suspect this is not easily fixable. Possibly we should
> > rather drop it altogether than give false expectations.
> 
> bulk88's comment at [1] ("A wild guess is you have -DDEBUGGING on the
> cmd line to the CC in your module. DEBUGGING can only be set at perl
> interp build time, not randomly, per module, afterwards.") sounds like
> there is an expectation that turning on debugging shouldn't break
> the handshaking? If so, perhaps there is a bug here that could be
> addressed upstream - which would obviously be good news for any
> binary distribution.
> 
> [1] <https://rt.perl.org/Public/Bug/Display.html?id=125236>

Yes, the key question is if -DDEBUGGING really affects ABI compatibility
or if this is just a paranoid handshake failure. This:

 
http://perl5.git.perl.org/perl.git/commit/f2b88940d815760ad254d35a0ee1eb2ed8ce7762

  /* name of the scopes we've ENTERed. Only used with -DDEBUGGING, but needs to 
be
     present always, as -DDEBUGGING must be binary compatible with non.  */

implies any -DDEBUGGING incompatibilities are not intentional.

The handshake failure is a result of differing interpreter sizes between
perl and debugperl.

  % for p in perl debugperl; do gdb --batch --silent /usr/bin/$p -ex 'print 
sizeof(struct interpreter)'; done
  $1 = 3504
  $1 = 3528

FWIW, the sizes differ on jessie (5.20) too. On both 5.20 and 5.22, the
difference is due to a 'memory_debug_header' member that gets inserted
at almost the end, moving (only!) 'sv_consts' and 'random_state' 24
bytes forward on amd64.

The 'memory_debug_header' member is conditional on PERL_TRACK_MEMPOOL,
which comes with -DDEBUGGING. Judging by 'git annotate', this isn't new
in any way.

Conclusions:

1) if upstream is aiming for ABI compatibility with -DDEBUGGING, there
   seems to be a long standing bug with that
2) the resulting incompatibility is apparently minor enough that things
   have been working until now, but started to fail with the strict
   handshake checking in 5.22
3) we can work around this by unsetting PERL_TRACK_MEMPOOL
   for debugperl, which would be an acceptable tradeoff IMO;
   a lightly tested patch attached.

I'll bring 1) up upstream.
-- 
Niko Tyni   [email protected]
>From 00e67f379ae0d3bea7b721d030aab35e5a90cc11 Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Fri, 8 Jan 2016 14:27:36 +0200
Subject: Disable PERL_TRACK_MEMPOOL for debugging builds

This is a workaround for an ABI incompatibility between
-DDEBUGGING and normal builds.

Bug-Debian: https://bugs.debian.org/810326
---
 perl.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/perl.h b/perl.h
index e840450..3fb765c 100644
--- a/perl.h
+++ b/perl.h
@@ -187,7 +187,9 @@
 #  define pTHX_8	9
 #  define pTHX_9	10
 #  define pTHX_12	13
-#  if defined(DEBUGGING) && !defined(PERL_TRACK_MEMPOOL)
+/* PERL_TRACK_MEMPOOL temporarily disabled for DEBUGGING */
+/* see https://bugs.debian.org/810326 */
+#  if 0 && defined(DEBUGGING) && !defined(PERL_TRACK_MEMPOOL)
 #    define PERL_TRACK_MEMPOOL
 #  endif
 #else

Reply via email to