Skip to content
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

Bleadperl v5.19.3-16-gce0d59f breaks the CPAN #13193

Closed
p5pRT opened this issue Aug 22, 2013 · 57 comments
Closed

Bleadperl v5.19.3-16-gce0d59f breaks the CPAN #13193

p5pRT opened this issue Aug 22, 2013 · 57 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 22, 2013

Migrated from rt.perl.org#119433 (status was 'resolved')

Searchable as RT119433$

@p5pRT
Copy link
Author

p5pRT commented Aug 22, 2013

From @andk

git bisect


ce0d59f is the first bad commit
commit ce0d59f
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Tue Jul 2 13​:07​:45 2013 -0700

  [perl #7508] Use NULL for nonexistent array elems

affected


This is only a first impression. Dependencies of all of these are not yet
tested, so the list will grow once we have the first modules fixed.

MIYAGAWA/CGI-Compile-0.16.tar.gz
ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
EZDB/Data-Table-1.68.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
XAOC/Gtk2-1.247.tar.gz
JMM/Heap-0.80.tar.gz
ADAMK/List-MoreUtils-0.33.tar.gz
GFUJI/Mouse-1.11.tar.gz
SULLR/Net-SIP-0.682.tar.gz
XAOC/Pango-1.224.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

perl -V


Summary of my perl5 (revision 5 version 19 subversion 4) configuration​:
  Commit id​: ce0d59f
  Platform​:
  osname=linux, osvers=3.9-1-amd64, archname=x86_64-linux
  uname='linux k83 3.9-1-amd64 #1 smp debian 3.9.8-1 x86_64 gnulinux '
  config_args='-Dprefix=/home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-16-gce0d59f/165a -Dmyhostname=k83 -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Uuseithreads -Uuselongdouble -DDEBUGGING=-g'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2 -g',
  cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  ccversion='', gccversion='4.8.1', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  libpth=/usr/local/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /usr/lib
  libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
  perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.17'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'

Characteristics of this binary (from libperl)​:
  Compile-time options​: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
  PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
  PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
  PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT
  USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
  USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO
  USE_PERL_ATOF
  Built under linux
  Compiled at Aug 22 2013 20​:53​:40
  @​INC​:
  /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-16-gce0d59f/165a/lib/site_perl/5.19.4/x86_64-linux
  /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-16-gce0d59f/165a/lib/site_perl/5.19.4
  /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-16-gce0d59f/165a/lib/5.19.4/x86_64-linux
  /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-16-gce0d59f/165a/lib/5.19.4
  .

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Aug 23, 2013

From @andk

Also affected​:

MDOOTSON/Wx-0.9922.tar.gz
ROCKY/Devel-Trepan-0.50.tar.gz # tests go now into endless loop

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Aug 23, 2013

From @bingos

On Thu, Aug 22, 2013 at 02​:29​:10PM -0700, Andreas J. Koenig via RT wrote​:

# New Ticket Created by (Andreas J. Koenig)
# Please include the string​: [perl #119433]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=119433 >

git bisect
----------
ce0d59f is the first bad commit
commit ce0d59f
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Tue Jul 2 13​:07​:45 2013 -0700

\[perl \#7508\] Use NULL for nonexistent array elems

affected
--------
This is only a first impression. Dependencies of all of these are not yet
tested, so the list will grow once we have the first modules fixed.

MIYAGAWA/CGI-Compile-0.16.tar.gz
ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
EZDB/Data-Table-1.68.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
XAOC/Gtk2-1.247.tar.gz
JMM/Heap-0.80.tar.gz
ADAMK/List-MoreUtils-0.33.tar.gz
GFUJI/Mouse-1.11.tar.gz
SULLR/Net-SIP-0.682.tar.gz
XAOC/Pango-1.224.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

Regarding BINGOS/POE-Component-Client-Ident-1.16.tar.gz, I built a bleadperl and tested this.

A SEGV was being thrown during the tests.

The fault happens here​:
https://metacpan.org/source/BINGOS/POE-Component-Client-Ident-1.16/lib/POE/Component/Client/Ident/Agent.pm#L23

During the test the fifth element returned is an undef.

Adding $returns[5] = 0 unless defined $returns[5]; to _parse_arguments() eliminates the SEGV.

--
Chris Williams
aka BinGOs
PGP ID 0x4658671F
http​://www.gumbynet.org.uk

@p5pRT
Copy link
Author

p5pRT commented Aug 23, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 2013

From @cpansprout

On Thu Aug 22 14​:29​:10 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

MIYAGAWA/CGI-Compile-0.16.tar.gz
ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
EZDB/Data-Table-1.68.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
XAOC/Gtk2-1.247.tar.gz
JMM/Heap-0.80.tar.gz
ADAMK/List-MoreUtils-0.33.tar.gz
GFUJI/Mouse-1.11.tar.gz
SULLR/Net-SIP-0.682.tar.gz
XAOC/Pango-1.224.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

Commit 428ccf1 probably fixes many of these.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 2013

From @cpansprout

On Sun Aug 25 12​:16​:09 2013, sprout wrote​:

Commit 428ccf1 probably fixes many of these.

Fixed by 428ccf1​:

ADAMK/List-MoreUtils-0.33.tar.gz
MIYAGAWA/CGI-Compile-0.16.tar.gz
EZDB/Data-Table-1.68.tar.gz
JMM/Heap-0.80.tar.gz
SULLR/Net-SIP-0.682.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

Still broken​:

ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
GFUJI/Mouse-1.11.tar.gz

I cannot test these​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 2013

From @bulk88

On Sun Aug 25 12​:57​:03 2013, sprout wrote​:

On Sun Aug 25 12​:16​:09 2013, sprout wrote​:

Commit 428ccf1 probably fixes many of these.

Fixed by 428ccf1​:

ADAMK/List-MoreUtils-0.33.tar.gz
MIYAGAWA/CGI-Compile-0.16.tar.gz
EZDB/Data-Table-1.68.tar.gz
JMM/Heap-0.80.tar.gz
SULLR/Net-SIP-0.682.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

Still broken​:

ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
GFUJI/Mouse-1.11.tar.gz

I cannot test these​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz

About commit 428ccf1

I'm not very awake right now so this might be a stupid question, what is
wrong with NULL SV *s on Perl stack? They have been used for a couple
years now to implement overloading I believe.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Aug 25, 2013

From @cpansprout

On Sun Aug 25 13​:33​:58 2013, bulk88 wrote​:

On Sun Aug 25 12​:57​:03 2013, sprout wrote​:

On Sun Aug 25 12​:16​:09 2013, sprout wrote​:

Commit 428ccf1 probably fixes many of these.

Fixed by 428ccf1​:

ADAMK/List-MoreUtils-0.33.tar.gz
MIYAGAWA/CGI-Compile-0.16.tar.gz
EZDB/Data-Table-1.68.tar.gz
JMM/Heap-0.80.tar.gz
SULLR/Net-SIP-0.682.tar.gz
BINGOS/POE-Component-Client-Ident-1.16.tar.gz
ABIGAIL/Regexp-Common-2013031301.tar.gz
ETHER/Safe-Isa-1.000003.tar.gz

Still broken​:

ZEFRAM/Data-Alias-1.17.tar.gz
GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
ANDYA/Data-Structure-Util-0.15.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
JHI/Graph-0.96.tar.gz
GFUJI/Mouse-1.11.tar.gz

I cannot test these​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz

About commit 428ccf1

I'm not very awake right now so this might be a stupid question, what is
wrong with NULL SV *s on Perl stack?

Most pp functions actually don’t know how to handle them and have always
crashed.

They have been used for a couple
years now to implement overloading I believe.

Actually subs in the CORE​:: namespace use them to indicate missing
optional arguments. But they are *only* put on the stack by
pp_coreargs. In each case, the following op knows how to handle them.
They are not used in general.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 2013

From @bulk88

On Sun Aug 25 14​:56​:00 2013, sprout wrote​:

On Sun Aug 25 13​:33​:58 2013, bulk88 wrote​:

About commit 428ccf1

I'm not very awake right now so this might be a stupid question, what is
wrong with NULL SV *s on Perl stack?

Most pp functions actually don’t know how to handle them and have always
crashed.

Any point of teaching them how to handle NULL SV *s? For exaple "#define
ST(i) (PL_stack_base[ax + (i)]?PL_stack_base[ax + (i)]​:&PL_sv_undef)"
and for optimized cases (picked by hand) "#define STNN(i)
(PL_stack_base[ax + (i)])"?

They have been used for a couple
years now to implement overloading I believe.

Actually subs in the CORE​:: namespace use them to indicate missing
optional arguments. But they are *only* put on the stack by
pp_coreargs. In each case, the following op knows how to handle them.
They are not used in general.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 2013

From @cpansprout

On Sun Aug 25 19​:29​:25 2013, bulk88 wrote​:

On Sun Aug 25 14​:56​:00 2013, sprout wrote​:

On Sun Aug 25 13​:33​:58 2013, bulk88 wrote​:

About commit 428ccf1

I'm not very awake right now so this might be a stupid question,
what is
wrong with NULL SV *s on Perl stack?

Most pp functions actually don’t know how to handle them and have always
crashed.

Any point of teaching them how to handle NULL SV *s? For exaple "#define
ST(i) (PL_stack_base[ax + (i)]?PL_stack_base[ax + (i)]​:&PL_sv_undef)"
and for optimized cases (picked by hand) "#define STNN(i)
(PL_stack_base[ax + (i)])"?

I don’t think it would be worth it.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 26, 2013

From @andk

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

I cannot test these​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz

On a closer look I have to add another one​:

XAOC/Glib-1.301.tar.gz

All three still broken here. Glib sample fail​:

http​://www.cpantesters.org/cpan/report/66f63634-0aa3-11e3-b8e0-d7a45735fcd0

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Aug 28, 2013

From @andk

Also affected and still broken​:

MSTROUT/YAML-0.84.tar.gz
GGOEBEL/Class-Contract-1.14 # sometimes passes tests
BDARRAH/Proc-ParallelLoop-0.5.tgz # hangs
CPANEL/IPC-Pipeline-0.8.tar.gz # hangs

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Aug 29, 2013

From @cpansprout

ZEFRAM/Data-Alias-1.17.tar.gz - patch at rt.cpan.org #88176

a600f7e fixes​:

GAAS/Data-Dump-1.22.tar.gz
SHARYANTO/Data-Dump-PHP-0.07.tar.gz
JHI/Graph-0.96.tar.gz
MSTROUT/YAML-0.84.tar.gz

Still broken​:

ANDYA/Data-Structure-Util-0.15.tar.gz
GFUJI/Data-Util-0.62.tar.gz
TIMB/Devel-NYTProf-5.05.tar.gz
GFUJI/Mouse-1.11.tar.gz
GGOEBEL/Class-Contract-1.14.tar.gz
BDARRAH/Proc-ParallelLoop-0.5.tgz
CPANEL/IPC-Pipeline-0.8.tar.gz

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 30, 2013

From @andk

Also affected and still broken but only with threaded perls​:

DOY/Try-0.03.tar.gz

Failing with​:

  % /home/src/perl/.../bin/perl Makefile.PL
  Checking if your kit is complete...
  Looks good
  Warning​: prerequisite perl 5.014 not found.
  zsh​: segmentation fault ...

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Sep 2, 2013

From @cpansprout

Patched​:

ZEFRAM/Data-Alias-1.17.tar.gz - rt.cpan.org #88176
ANDYA/Data-Structure-Util-0.15.tar.gz - rt.cpan.org #88257
GFUJI/Data-Util-0.62.tar.gz - rt.cpan.org #88278
TIMB/Devel-NYTProf-5.05.tar.gz - rt.cpan.org #88288
GFUJI/Mouse-1.11.tar.gz - rt.cpan.org #88295

Fixed​:

GGOEBEL/Class-Contract-1.14.tar.gz by perl commit 3df5c4b
CPANEL/IPC-Pipeline-0.8.tar.gz probably by the same commit

GGOEBEL/Class-Contract-1.14.tar.gz’s tests pass, but still emit warnings
that were not there in 5.18.1, so something is not completely fixed.

Broken​:

BDARRAH/Proc-ParallelLoop-0.5.tgz
DOY/Try-0.03.tar.gz

Presumably broken still​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz
XAOC/Glib-1.301.tar.gz

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 2, 2013

From @cpansprout

On Fri Aug 30 01​:26​:28 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

Also affected and still broken but only with threaded perls​:

DOY/Try-0.03.tar.gz

Failing with​:

% /home/src/perl/.../bin/perl Makefile.PL
Checking if your kit is complete...
Looks good
Warning​: prerequisite perl 5.014 not found.
zsh​: segmentation fault ...

Fixed in 7601007, though it is still subtly broken in 5.18. See
rt.cpan.org #88341.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 2, 2013

From @cpansprout

On Sun Sep 01 18​:35​:05 2013, sprout wrote​:

GGOEBEL/Class-Contract-1.14.tar.gz’s tests pass, but still emit warnings
that were not there in 5.18.1, so something is not completely fixed.

Unrelated. It seems different versions of ExtUtils​::Command​::MM may or
may not provide the -w flag.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 2, 2013

From @cpansprout

On Sun Sep 01 18​:35​:05 2013, sprout wrote​:

Patched​:

ZEFRAM/Data-Alias-1.17.tar.gz - rt.cpan.org #88176
ANDYA/Data-Structure-Util-0.15.tar.gz - rt.cpan.org #88257
GFUJI/Data-Util-0.62.tar.gz - rt.cpan.org #88278
TIMB/Devel-NYTProf-5.05.tar.gz - rt.cpan.org #88288
GFUJI/Mouse-1.11.tar.gz - rt.cpan.org #88295

Fixed​:

GGOEBEL/Class-Contract-1.14.tar.gz by perl commit 3df5c4b
CPANEL/IPC-Pipeline-0.8.tar.gz probably by the same commit

Correction​: IPC​::Pipeline passed its tests for me, since .cpan/build
still had my patched version. I submitted a patch to rt.cpan.org #88229.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 5, 2013

From @cpansprout

On Wed Aug 28 02​:42​:57 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

BDARRAH/Proc-ParallelLoop-0.5.tgz # hangs

Fixed in 4981938. *That* was a hard one to track down!

Only the three distributions by XAOC remain.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @cpansprout

On Mon Aug 26 03​:23​:27 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

I cannot test these​:

XAOC/Gtk2-1.247.tar.gz
XAOC/Pango-1.224.tar.gz

On a closer look I have to add another one​:

XAOC/Glib-1.301.tar.gz

All three still broken here.

I have committed various fixes to blead. Could you test them again?

Glib sample fail​:

http​://www.cpantesters.org/cpan/report/66f63634-0aa3-11e3-b8e0-d7a45735fcd0

Every time I try to use cpantesters, the site is down.

Could you give me some sample failure output?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @andk

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

Could you give me some sample failure output?

Both Gtk2 and Pango depend on Glib. Glib compilation and test run attached.

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @andk

glib-with-5.19.3-375.out

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @cpansprout

On Sun Sep 08 00​:27​:36 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

Could you give me some sample failure output?

Both Gtk2 and Pango depend on Glib. Glib compilation and test run
attached.

Thank you. And what is the output with the attached patch?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @cpansprout

Inline Patch
diff -rup Glib-1.301-gy1yG6/GType.xs Glib-1.301-8jML2z/GType.xs
--- Glib-1.301-gy1yG6/GType.xs	2013-06-23 09:55:30.000000000 -0700
+++ Glib-1.301-8jML2z/GType.xs	2013-09-08 11:20:19.000000000 -0700
@@ -1106,6 +1106,7 @@ gperl_real_signal_accumulator (GSignalIn
 		      "### this is really uncool, and for now i'm not even going to\n"
 		      "### try to recover.\n"
 		      "###    aborting");
+		warn("### The error is %"SVf, ERRSV);
 		abort ();
 	}
 

@p5pRT
Copy link
Author

p5pRT commented Sep 8, 2013

From @andk

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

Thank you. And what is the output with the attached patch?

PERL_DL_NONLAZY=1 /home/sand/src/perl/repoperls/installed-perls/perl/v5.19.3-374-ga8162dc/9980/bin/perl "-MExtUtils​::Command​::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/7.t
t/7.t .. 1/36 ### WOAH! unhandled exception in a signal accumulator!
### this is really uncool, and for now i'm not even going to
### try to recover.
### aborting at t/7.t line 121.
### The error is Modification of a read-only value attempted at t/7.t line 97.
t/7.t .. Failed 8/36 subtests

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Sep 9, 2013

From @cpansprout

On Sun Sep 08 13​:45​:54 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

Thank you. And what is the output with the attached patch?

PERL_DL_NONLAZY=1 /home/sand/src/perl/repoperls/installed-
perls/perl/v5.19.3-374-ga8162dc/9980/bin/perl "-
MExtUtils​::Command​::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/7.t
t/7.t .. 1/36 ### WOAH! unhandled exception in a signal accumulator!
### this is really uncool, and for now i'm not even going to
### try to recover.
### aborting at t/7.t line 121.
### The error is Modification of a read-only value attempted at t/7.t
line 97.
t/7.t .. Failed 8/36 subtests

What about with the attached?

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 9, 2013

From @cpansprout

Inline Patch
diff -rup Glib-1.301-gy1yG6/GType.xs Glib-1.301-8jML2z/GType.xs
--- Glib-1.301-gy1yG6/GType.xs	2013-06-23 09:55:30.000000000 -0700
+++ Glib-1.301-8jML2z/GType.xs	2013-09-08 16:25:48.000000000 -0700
@@ -1091,7 +1091,10 @@ gperl_real_signal_accumulator (GSignalIn
 	PUSHMARK (SP);
 
 	PUSHs (sv_2mortal (newSVGSignalInvocationHint (ihint)));
-	SAVED_STACK_PUSHs (sv_2mortal (gperl_sv_from_value (return_accu)));
+	sv = gperl_sv_from_value (return_accu);
+	if (sv == &PL_sv_undef)
+	    sv = newSV (0);
+	SAVED_STACK_PUSHs (sv_2mortal (sv));
 	SAVED_STACK_PUSHs (sv_2mortal (gperl_sv_from_value (handler_return)));
 
 	if (callback->data)

@p5pRT
Copy link
Author

p5pRT commented Sep 9, 2013

From @andk

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

What about with the attached?

Excellent, all tests pass, also for Pango and Gtk2.

--
andreas

@p5pRT
Copy link
Author

p5pRT commented Sep 9, 2013

From @cpansprout

On Sun Sep 08 22​:21​:12 2013, andreas.koenig.7os6VVqR@​franz.ak.mind.de wrote​:

"Father Chrysostomos via RT" <perlbug-followup@​perl.org> writes​:

What about with the attached?

Excellent, all tests pass, also for Pango and Gtk2.

Thank you for being so patient!

I have submitted the patch to rt.cpan.org #88533.

I have listed the patched modules in perl5200delta, so I can close this
now. Finally!

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Sep 9, 2013

@cpansprout - Status changed from 'open' to 'resolved'

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

From @rjbs

Re-opened.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

@rjbs - Status changed from 'resolved' to 'open'

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

From @iabyn

On Sat, May 10, 2014 at 10​:27​:22AM +0200, Andreas Koenig wrote​:

I fear this needs a reopen for one or more of

MLEHMANN/Coro-6.37.tar.gz
MLEHMANN/EV-4.17.tar.gz
MLEHMANN/AnyEvent-7.07.tar.gz

They are connected such that you need all three to see the bug. The test
is in Coro, AnyEvent is a prerequisite, and without EV the relevant
tests are skipped.

Coro directly accesses the AvARRAY of an object. Since
v5.19.3-16-gce0d59f, empty slots in an array are stored as NULL rather
than &PL_sv_undef, so code like

  slf_init_rw (pTHX_ struct CoroSLF *frame, SV *arg, int wr)
  AV *handle = (AV *)SvRV (arg);
  SV *data_sv = AvARRAY (handle)[5];
  ...
  if (!SvOK (data_sv)) {
  ...

now SEGVs.

Presumably Marc either needs to use the official API, i.e. av_fetch(),
or check for NULL values.

--
Never work with children, animals, or actors.

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

From schmorp@schmorp.de

On Mon, May 12, 2014 at 03​:55​:53PM +0100, Dave Mitchell <davem@​iabyn.com> wrote​:

On Sat, May 10, 2014 at 10​:27​:22AM +0200, Andreas Koenig wrote​:

Thanks for the info and the analysis, to both of you (I didn't have time
to react to Andreas' earlier heads-up).

Presumably Marc either needs to use the official API, i.e. av_fetch(),
or check for NULL values.

Since the array in question is internal to Coro, it'll probably just need
a proper initialisation, but I'll see to that as soon as I can test it
myself, and should be easy to fix overall, since the cause is so obvious.

A minor nitpick though​: there really isn't such a thing as an official API
for perl - even perlapi makes it clear that the API is version-specific
(so you don't really gain anything from sticking to anything that is
documented, and in fact, public API changes have bitten me about only
slightly less often then using undocumented APIs) and coupled with the
fact that backwards compatibility is obviously no longer a goal for perl
development, the only way to follow perl releases is to patch up after
every release anyway.

--
  The choice of a Deliantra, the free code+content MORPG
  -----==- _GNU_ http​://www.deliantra.net
  ----==-- _ generation
  ---==---(_)__ __ ____ __ Marc Lehmann
  --==---/ / _ \/ // /\ \/ / schmorp@​schmorp.de
  -=====/_/_//_/\_,_/ /_/\_\

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

From @demerphq

On 12 May 2014 16​:55, Dave Mitchell <davem@​iabyn.com> wrote​:

On Sat, May 10, 2014 at 10​:27​:22AM +0200, Andreas Koenig wrote​:

I fear this needs a reopen for one or more of

MLEHMANN/Coro-6.37.tar.gz
MLEHMANN/EV-4.17.tar.gz
MLEHMANN/AnyEvent-7.07.tar.gz

They are connected such that you need all three to see the bug. The test
is in Coro, AnyEvent is a prerequisite, and without EV the relevant
tests are skipped.

Coro directly accesses the AvARRAY of an object. Since
v5.19.3-16-gce0d59f, empty slots in an array are stored as NULL rather
than &PL_sv_undef, so code like

slf\_init\_rw \(pTHX\_ struct CoroSLF \*frame\, SV \*arg\, int wr\)
  AV \*handle = \(AV \*\)SvRV \(arg\);
  SV \*data\_sv = AvARRAY \(handle\)\[5\];
  \.\.\.
  if \(\!SvOK \(data\_sv\)\) \{
    \.\.\.

now SEGVs.

Presumably Marc either needs to use the official API, i.e. av_fetch(),
or check for NULL values.

Is there a reason for this change? Ironically yesterday I encountered this
mismatch between blead and older perls, and it is a cause of some concern.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented May 12, 2014

From @Leont

On Mon, May 12, 2014 at 5​:27 PM, Marc Lehmann <schmorp@​schmorp.de> wrote​:

A minor nitpick though​: there really isn't such a thing as an official API
for perl - even perlapi makes it clear that the API is version-specific
(so you don't really gain anything from sticking to anything that is
documented, and in fact, public API changes have bitten me about only
slightly less often then using undocumented APIs) and coupled with the
fact that backwards compatibility is obviously no longer a goal for perl
development, the only way to follow perl releases is to patch up after
every release anyway.

AvARRAY is not documented in perlapi. The only things that are documented
about AvARRAY are in perlguts​: «AvARRAY points to the first element in the
array that is visible from Perl» and «a shift operation can be carried out
by increasing AvARRAY by one and decreasing AvFILL and AvMAX». It doesn't
guarantee anything about the contents of the C level array.

On the other hand, perlguts does document that «AVs use &PL_sv_undef as a
marker for indicating that an array element has not yet been initialized»,
even in bleed. This is incorrect, but IMO this is a change that makes the
API more permissive (by now allowing you to put &PL_sv_undef in there), so
I don't think this is necessarily a major issue.

The real issue is very different. Almost any non-trivial XS module is
depending on undocumented behavior of some kind (or sometimes things that
have been marked as experimental for 10+ years). This is an issue that can
sometimes be addressed, but that is lacking volunteers. This situation will
not improve until volunteers step up to do something about it.

Leon

@p5pRT
Copy link
Author

p5pRT commented May 13, 2014

From @demerphq

On 12 May 2014 22​:37, Leon Timmermans <fawaka@​gmail.com> wrote​:

On Mon, May 12, 2014 at 5​:27 PM, Marc Lehmann <schmorp@​schmorp.de> wrote​:

A minor nitpick though​: there really isn't such a thing as an official API
for perl - even perlapi makes it clear that the API is version-specific
(so you don't really gain anything from sticking to anything that is
documented, and in fact, public API changes have bitten me about only
slightly less often then using undocumented APIs) and coupled with the
fact that backwards compatibility is obviously no longer a goal for perl
development, the only way to follow perl releases is to patch up after
every release anyway.

AvARRAY is not documented in perlapi.

Its mentioned there under the sort method.

The only things that are documented about AvARRAY are in perlguts​:
«AvARRAY points to the first element in the array that is visible from
Perl» and «a shift operation can be carried out by increasing AvARRAY by
one and decreasing AvFILL and AvMAX». It doesn't guarantee anything about
the contents of the C level array.

No we dont tend to guarantee stuff like this.

On the other hand, perlguts does document that «AVs use &PL_sv_undef as a
marker for indicating that an array element has not yet been initialized»,
even in bleed. This is incorrect,

What do you mean "this is incorrect"? The regression I am pointing out here
is that blead was changed to make this incorrect.

And actually I guess I answer my own question about why​:

commit ce0d59f
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Tue Jul 2 13​:07​:45 2013 -0700

  [perl #7508] Use NULL for nonexistent array elems

  This commit fixes bug #7508 and provides the groundwork for fixing
  several other bugs.

  Elements of @​_ are aliased to the arguments, so that \$_[0] within
  sub foo will reference the same scalar as \$x if the sub is called
  as foo($x).

  &PL_sv_undef (the global read-only undef scalar returned by the
  ‘undef’ operator itself) was being used to represent nonexistent
  array elements. So the pattern would be broken for foo(undef), where
  \$_[0] would vivify a new $_[0] element, treating it as having been
  nonexistent.

  This also causes other problems with constants under ithreads
  (#105906) and causes a pending fix for another bug (#118691) to trig-
  ger this bug.

  This commit changes the internals to use a null pointer to represent a
  nonexistent element.

  This requires that Storable be changed to account for it. Also,
  IPC​::Open3 was relying on the bug. So this commit patches
  both modules.

But I consider this an XS regression. I dont much care, I will just work
around it, but these kind of things are kind of annoying and I can see why
Marc accuses us of not caring about back-compat. And at the very least it
should be in the perldelta. (I have not checked if it is or not)

but IMO this is a change that makes the API more permissive (by now
allowing you to put &PL_sv_undef in there), so I don't think this is
necessarily a major issue.

Im now confused what "this" is in the above sentence.

The real issue is very different. Almost any non-trivial XS module is
depending on undocumented behavior of some kind (or sometimes things that
have been marked as experimental for 10+ years). This is an issue that can
sometimes be addressed, but that is lacking volunteers. This situation will
not improve until volunteers step up to do something about it.

I agree that we should harden some of these apis.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented May 13, 2014

From @Leont

On Tue, May 13, 2014 at 3​:28 AM, demerphq <demerphq@​gmail.com> wrote​:

Its mentioned there under the sort method.

Mentioned != documented

On the other hand, perlguts does document that «AVs use &PL_sv_undef as a

marker for indicating that an array element has not yet been initialized»,
even in bleed. This is incorrect,

What do you mean "this is incorrect"? The regression I am pointing out
here is that blead was changed to make this incorrect.

I meant "the documentation no longer matches reality".

commit ce0d59f
Author​: Father Chrysostomos <sprout@​cpan.org>
Date​: Tue Jul 2 13​:07​:45 2013 -0700

\[perl \#7508\] Use NULL for nonexistent array elems

This commit fixes bug \#7508 and provides the groundwork for fixing
several other bugs\.

Elements of @&#8203;\_ are aliased to the arguments\, so that \\$\_\[0\] within
sub foo will reference the same scalar as \\$x if the sub is called
as foo\($x\)\.

&PL\_sv\_undef \(the global read\-only undef scalar returned by the
‘undef’ operator itself\) was being used to represent nonexistent
array elements\.  So the pattern would be broken for foo\(undef\)\, where
\\$\_\[0\] would vivify a new $\_\[0\] element\, treating it as having been
nonexistent\.

This also causes other problems with constants under ithreads
\(\#105906\) and causes a pending fix for another bug \(\#118691\) to trig\-
ger this bug\.

This commit changes the internals to use a null pointer to represent a
nonexistent element\.

This requires that Storable be changed to account for it\.  Also\,
IPC&#8203;::Open3 was relying on the bug\.  So this commit patches
both modules\.

But I consider this an XS regression. I dont much care, I will just work
around it, but these kind of things are kind of annoying and I can see why
Marc accuses us of not caring about back-compat. And at the very least it
should be in the perldelta. (I have not checked if it is or not)

I think that's reasonable.

but IMO this is a change that makes the API more permissive (by now

allowing you to put &PL_sv_undef in there), so I don't think this is
necessarily a major issue.

Im now confused what "this" is in the above sentence.

this = ce0d59f

Leon

@p5pRT
Copy link
Author

p5pRT commented May 15, 2014

From schmorp@schmorp.de

On Mon, May 12, 2014 at 10​:37​:58PM +0200, Leon Timmermans <fawaka@​gmail.com> wrote​:

AvARRAY is not documented in perlapi. The only things that are documented
about AvARRAY are in perlguts​: «AvARRAY points to the first element in the

And neither mentions anything "official". Since it's not a defined term
in perl itself, it simply means the API that comes with the respective
release of Perl, i.e. it is version dependent. That shouldn't be
surprising, I was just pointing it out.

The real issue is very different. Almost any non-trivial XS module is
depending on undocumented behavior of some kind (or sometimes things that
have been marked as experimental for 10+ years). This is an issue that can
sometimes be addressed, but that is lacking volunteers. This situation will
not improve until volunteers step up to do something about it.

I don't understand why there are volunteers who gratituiously break
backwards compatibiliy (even on the perl level, see the recent bugreport
about warn) and then feel not responsible to fix it at all.

Yes, I am sure those are easier to find than the other variety, but in my
opinion, such people have no business maintaining perl.

I don't agree with your assessment that volunteers are needed. In my
opinion, there are too many unresponsible volunteers.

Also, the atmosphere on p5p makes it very hard to volunteer. The very few
times I tried to push bugfixes into perl I had to fight through weeks of
bullshit discussions with people who were apperently influential, but
admitted themselves they had never used the feature in question and had
little clue on how it works. That's why I gave up trying to fix things -
too much concern trolling going on.

Some fixes are trivial, but impossible to apply - I lobbied for years to
fix the typing bug of char * in the default typemap, which broke a large
part of cpan. There are a lot of obvious and trivial one-line fixes that
never made it into perl because of artificial concerns (and now the real
concern that new modules depend on the broken behaviour).

So, to me, the problem is (some - I am absolutely convinced that there
are very competent people on p5p!) of the existing volunteers, not the
lack of ones. Perl did quite fine without the misdesigns of given/when,
smartmatches, security fixes that aren't and the constant drizzle of
cpan-breaking (and what not) changes. It's really hard to see any good
come out of p5p in recent years that isn't "fixing what we broke earlier".

I am certainly not the only one who is concerned with the dichotomy of
documentation (perlpolicy in this case) and the harsh reality of a p5p
that keeps breaking perl and refuses to clean up. I might be the last one
to bother though (Tom Christiansen voiced similar concerns privately, but
gave up on p5p because he had the feeling it had no effect).

--
  The choice of a Deliantra, the free code+content MORPG
  -----==- _GNU_ http​://www.deliantra.net
  ----==-- _ generation
  ---==---(_)__ __ ____ __ Marc Lehmann
  --==---/ / _ \/ // /\ \/ / schmorp@​schmorp.de
  -=====/_/_//_/\_,_/ /_/\_\

@p5pRT
Copy link
Author

p5pRT commented May 15, 2014

From @demerphq

On 15 May 2014 13​:19, Marc Lehmann <schmorp@​schmorp.de> wrote​:

On Mon, May 12, 2014 at 10​:37​:58PM +0200, Leon Timmermans <
fawaka@​gmail.com> wrote​:

AvARRAY is not documented in perlapi. The only things that are documented
about AvARRAY are in perlguts​: 隹vARRAY points to the first element in the

And neither mentions anything "official". Since it's not a defined term
in perl itself, it simply means the API that comes with the respective
release of Perl, i.e. it is version dependent. That shouldn't be
surprising, I was just pointing it out.

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that position
to justify backwards-incompatible changes is inappropriate. I think its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

So for instance with regard to AvARRAY() IMO it was wrong to change the
default initialization from PL_sv_undef() to NULL without providing a
define to use to check it first, and arranging for the porting layer to
ensure that define is properly initialized for older perls.

I think we *have* to get better about this subject. And I think you have
legitimate grounds to complain about this.

The real issue is very different. Almost any non-trivial XS module is
depending on undocumented behavior of some kind (or sometimes things that
have been marked as experimental for 10+ years). This is an issue that
can
sometimes be addressed, but that is lacking volunteers. This situation
will
not improve until volunteers step up to do something about it.

I don't understand why there are volunteers who gratituiously break
backwards compatibiliy (even on the perl level, see the recent bugreport
about warn) and then feel not responsible to fix it at all.

I think *most* of our developers do not *gratuitously* break back-compat.
And I think most of our devs do feel a personal responsibility to fix
things. I think sometimes some of us have let the urge to make things
consistent, or the urge to fix weird edge case bugs take priority over
sensibility and back-compat. And that is something we need to do better at.

Yes, I am sure those are easier to find than the other variety, but in my
opinion, such people have no business maintaining perl.

I don't agree with your assessment that volunteers are needed. In my
opinion, there are too many unresponsible volunteers.

This I definitely dont agree with. We do not have enough good devs willing
to help out.

Also, the atmosphere on p5p makes it very hard to volunteer. The very few
times I tried to push bugfixes into perl I had to fight through weeks of
bullshit discussions with people who were apperently influential, but
admitted themselves they had never used the feature in question and had
little clue on how it works. That's why I gave up trying to fix things -
too much concern trolling going on.

I agree with you here. There are certain people on p5p who have never ever
patched core who make life almost unbearable for the people who have put
the time in to improve things. I think it is one of the biggest problems we
have and why I stopped trying to improve certain parts of perl. Too many
people who rant and rant and rant, and basically wear down the deciders so
they end up making bad decisions which the rest of then have to abide by. I
would be very happy if we were much less tolerant of these people and
adopted a position closer to "if you have not patched perl then your
opinion is less relevant than someone who has", if not an outright "thanks
for you opinion, but since you write no patches, and know nothing of the
implementation challenges or details your opinion is irrelevant and
unwelcome". Because IMO they hold back Perl a lot. I call this lot the
bike-shed mob, and they have done more damage to perl than almost any
constituency there is.

Some fixes are trivial, but impossible to apply - I lobbied for years to
fix the typing bug of char * in the default typemap, which broke a large
part of cpan. There are a lot of obvious and trivial one-line fixes that
never made it into perl because of artificial concerns (and now the real
concern that new modules depend on the broken behaviour).

So, to me, the problem is (some - I am absolutely convinced that there
are very competent people on p5p!) of the existing volunteers, not the
lack of ones. Perl did quite fine without the misdesigns of given/when,
smartmatches, security fixes that aren't and the constant drizzle of
cpan-breaking (and what not) changes. It's really hard to see any good
come out of p5p in recent years that isn't "fixing what we broke earlier".

I agree with most of that, although not all since your reference to
"security fixes that aren't" is probably referring to the hash security
changes which I did, which definitely were real fixes. If you have some
Perl web servers running old Perls which are putting get parameters into
hashes then I can arrange to take them all down for you as a demonstration.
OTOH I personally think it would be a bit silly to have to break your web
servers for you to understand that this was a real issue. Especially given
that you have the C chops to read the security patches we did and reverse
engineer the attack that we were preventing!

Also, when you got all hysterical about the hash changes you really didn't
show your best side. You neither showed why they were a problem and you
ignored patches that were provided to fix your test code. Which was broken
anyway, as it tested that Perl supplied a specific hash order, and that
every hash would use the same order, neither of which we have never
promised.

So lets keep a sense of proportion here. Yes as far as language design we
have not done as well as we might like, IMO because the pumpking allowed
themselves to be influenced by factors they should not have been influenced
by​: the bike shed mob, and P6. Neither of which are good sources for
language design in P5.

On the other hand, you have a tendency towards hyperbole and hysteria in
your communications with p5p which have not made it easier to address your
concerns. Communication is a two way street. If you start off attacking
people then they are going to turn off and not listen to you. Which given
your obvious intellect and skills is a shame.

I am certainly not the only one who is concerned with the dichotomy of
documentation (perlpolicy in this case) and the harsh reality of a p5p
that keeps breaking perl and refuses to clean up. I might be the last one
to bother though (Tom Christiansen voiced similar concerns privately, but
gave up on p5p because he had the feeling it had no effect).

If you had a list of things you see as issues I would like to read it. I am
unfamiliar with the typemap issue for instance.

I wanted to say one last thing, this mail has been one of the more
productive I have seen you write. If you wrote more mails like this I think
you would find yourself listened to a lot more.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented May 15, 2014

From @bulk88

On Thu May 15 05​:45​:36 2014, demerphq wrote​:

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that
position
to justify backwards-incompatible changes is inappropriate. I think
its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

I think AvARRAY should NOT be public api. It limits what can be done in the future, like linked lists, or unifying hashes and arrays.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @demerphq

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

On Thu May 15 05​:45​:36 2014, demerphq wrote​:

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that
position
to justify backwards-incompatible changes is inappropriate. I think
its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

I think AvARRAY should NOT be public api. It limits what can be done in
the future, like linked lists, or unifying hashes and arrays.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is no
point in using XS to speed stuff up.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @tsee

On 05/16/2014 07​:58 AM, demerphq wrote​:

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org
<mailto​:perlbug-followup@​perl.org>> wrote​:

On Thu May 15 05&#8203;:45&#8203;:36 2014\, demerphq wrote&#8203;:
 > FWIW\, I think taking the position that AvARRAY\(\) is not documented or
 > official to use to be pretty silly\. And I think hiding behind that
 > position
 > to justify backwards\-incompatible changes is inappropriate\.  I think
 > its
 > fine to make changes to how some of this works\, but only by providing
 > primitives that make a porter life easier\.

I think AvARRAY should NOT be public api\. It limits what can be done
in the future\, like linked lists\, or unifying hashes and arrays\.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is
no point in using XS to speed stuff up.

IMO it would be a fine example of the kind of API that we acknowledge
people want to use but we reserve the right to break its usage if there
are major benefits (with some sane early notice and a clear migration
path). If people want safety over performance, they can always use
av_fetch and friends which are guaranteed[1] to remain fully backwards
compatible.

--Steffen

[1] In theory, I'm sure somebody can point out a case where that failed.

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @Leont

On Fri, May 16, 2014 at 7​:58 AM, demerphq <demerphq@​gmail.com> wrote​:

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

I think AvARRAY should NOT be public api. It limits what can be done in
the future, like linked lists, or unifying hashes and arrays.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is no
point in using XS to speed stuff up.

If we want to be able to have array/hash vtables, not exposing
implementation details would be terribly helpful.

Leon

@p5pRT
Copy link
Author

p5pRT commented May 16, 2014

From @demerphq

On 16 May 2014 12​:45, Leon Timmermans <fawaka@​gmail.com> wrote​:

On Fri, May 16, 2014 at 7​:58 AM, demerphq <demerphq@​gmail.com> wrote​:

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

I think AvARRAY should NOT be public api. It limits what can be done in
the future, like linked lists, or unifying hashes and arrays.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is no
point in using XS to speed stuff up.

If we want to be able to have array/hash vtables, not exposing
implementation details would be terribly helpful.

Shrug, I dont care. Ill make Sereal do whatever. But until then the Array
implementations that actually expose a way to iterate over an array of
pointers are going to get faster behaviour.

I really think this is one of those cases where by trying to keep our
options for hypotheticals like people actually doing vtables for this stuff
we are just making everyones life harder for no reason. There are real
practical reasons why someone might want to be able to fast array access
against the C pointer representation of an array. I dont think we should
forbid that for some hypothetical future array type that might not have
such a thing. (I guess maybe spare arrays might have a LL of C arrays, but
even that seems far fetched in practice.) The internals make heavy use of
this stuff, and people are going to use them absent a well defined way to
do fast operations. Have you seen how many lines of code are in av_store()
and av_fetch()? When I know the array is "normal" and I want fast
operations I dont want to deal with that crap.

So how do we address these things?

Maybe introduce some primitives that are currently no-ops, but later on
will tell people they really must use the provided interfaces? (Much like
happens with tied objects.)

Maybe something like​:

SvVTABLE(sv)

which would return 0 for now but when we get a vtable implementation will
return true?

Or how about just documenting that AvARRAY() may return false in some
cases, in which case it is required to use av_store() or av_fetch()?

My point is there are lots of ways to make this stuff work without making
every optimisation impossible for hypothetical future cases.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented May 17, 2014

From @iabyn

On Fri, May 16, 2014 at 07​:58​:14AM +0200, demerphq wrote​:

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

On Thu May 15 05​:45​:36 2014, demerphq wrote​:

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that
position
to justify backwards-incompatible changes is inappropriate. I think
its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

I think AvARRAY should NOT be public api. It limits what can be done in
the future, like linked lists, or unifying hashes and arrays.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is no
point in using XS to speed stuff up.

Any XS code which directly accesses AvARRAY() is already broken with respect
to tied arrays.

How many people on this list could confidently say (without checking the
src code; its certainly not in the docs), under what circumnstances an
element of AvARRAY() might be

  * NULL
  * &PL_sv_undef
  * &PL_sv_placeholder

(I can imagine a lot of XS code happily trying to write to PL_sv_placeholder).

I think this is strictly an implementation detail which we should feel
free to change if it suits us.

--
Standards (n). Battle insignia or tribal totems.

@p5pRT
Copy link
Author

p5pRT commented May 17, 2014

From @bulk88

On Thu May 15 16​:22​:07 2014, bulk88 wrote​:

On Thu May 15 05​:45​:36 2014, demerphq wrote​:

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that
position
to justify backwards-incompatible changes is inappropriate. I think
its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

I think AvARRAY should NOT be public api. It limits what can be done
in the future, like linked lists, or unifying hashes and arrays.

Another provision is, what if AvARRAY isn't a SV**, but an AE *. It means that an AE * is 2 pointer sizes. What the other half is used for IDK, but someone could find a compelling reason. Someone could also say that AvARRAY points to an array of tagged SV* psuedo-pointers. Even though SVs are 16 or 24 bytes long, perl doesn't use the lowest 3 or 4 bits for anything, even though they will always be zero. Maybe someone will think of a use for the lowest 3 or 4 bits in relation to AVs. Maybe for doing random deletes on a each() pass through an AV or HV through some kind of "soft delete" flag or "already visited" flag.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 18, 2014

From @demerphq

On 17 May 2014 16​:16, Dave Mitchell <davem@​iabyn.com> wrote​:

On Fri, May 16, 2014 at 07​:58​:14AM +0200, demerphq wrote​:

On 16 May 2014 01​:22, bulk88 via RT <perlbug-followup@​perl.org> wrote​:

On Thu May 15 05​:45​:36 2014, demerphq wrote​:

FWIW, I think taking the position that AvARRAY() is not documented or
official to use to be pretty silly. And I think hiding behind that
position
to justify backwards-incompatible changes is inappropriate. I think
its
fine to make changes to how some of this works, but only by providing
primitives that make a porter life easier.

I think AvARRAY should NOT be public api. It limits what can be done in
the future, like linked lists, or unifying hashes and arrays.

I dont see us doing anything like that ever (you want to sort linked
lists?). And right now people need to access array internals or there is
no
point in using XS to speed stuff up.

Any XS code which directly accesses AvARRAY() is already broken with
respect
to tied arrays.

That is somewhat of a simplification. Any code that uses AvARRAY() without
checking the array is tied first is going to have problems.

But this is well known. The exposed perl guts api's all make it clear that
you have to be on your guard for ties and treat tied things with kid-gloves.

How many people on this list could confidently say (without checking the
src code; its certainly not in the docs), under what circumnstances an
element of AvARRAY() might be

\* NULL
\* &PL\_sv\_undef
\* &PL\_sv\_placeholder

(I can imagine a lot of XS code happily trying to write to
PL_sv_placeholder).

But this is my point. Why should we? Why shouldnt we have a clear macro
that does this for us?

I think this is strictly an implementation detail which we should feel
free to change if it suits us.

I never said we shouldn't. I said that when we do we should provide ways
for XS authors to get it right.

The reality is people use XS for performance. To get performance the
reality is that you need to do things like work directly with Perls
internal data structures.

IMO failing to recognize and accommodate this just makes everyone unhappy.
We as perl porters get unhappy when people do these things anyway, XS
authors get unhappy when we change things and we dont provide easy ways to
deal with it, and users get unhappy when the code they want to run fails
because of an XS dependency that has been broken.

The alternative is recognize people want to do these things, and that it
really isn't that unreasonable that they want to do them, and provide well
defined ways that they can do so safely.

And the reality is that people do this stuff all the time. Sereal does it,
Data​::Dumper does it (for sorting), Storable does it.

Check this out​:

$ git grep -l AvARRAY dist ext cpan
cpan/Scalar-List-Utils/multicall.h
dist/Data-Dumper/Dumper.xs
dist/Storable/Storable.xs
dist/threads-shared/shared.xs
dist/threads/threads.xs
ext/B/B.xs
ext/Devel-Peek/Changes
ext/Devel-Peek/Peek.xs
ext/File-Glob/Glob.xs
ext/mro/mro.xs

We even mention AvARRAY() in both perlapi and perlguts​:

perldoc perlapi​:

  sortsv Sort an array. Here is an example​:

  sortsv(AvARRAY(av), av_len(av)+1, Perl_sv_cmp_locale);

  Currently this always uses mergesort. See sortsv_flags for a
  more flexible routine.

  void sortsv(SV** array, size_t num_elts,
SVCOMPARE_t cmp)

We mention AvARRAY in perlguts​:

  Something similar to the offset hack is performed on AVs to enable
efficient shifting and splicing off the beginning of the
  array; while "AvARRAY" points to the first element in the array that
is visible from Perl, "AvALLOC" points to the real
  start of the C array. These are usually the same, but a "shift"
operation can be carried out by increasing "AvARRAY" by one
  and decreasing "AvFILL" and "AvMAX". Again, the location of the
real start of the C array only comes into play when
  freeing the array. See "av_shift" in av.c.

If AvARRAY() is completely opaque to the user why do we have interfaces
like this? Why do we have a sortsv() that takes an SV** as an argument? How
do we expect people to sort an array with this interface if they aren't
supposed to use AvARRAY()? It seems to me that if people aren't supposed to
use AvARRAY() then there should be an avsort(AV* av, ...) function instead.

I hold that if you want to do interesting or useful things with Perl in XS
you are going to at some point want to work with AvARRAY() and similar
structures. And that we as porters would make everyones lives easier if we
admitted it and made it easier to do safely and properly in a way that
allows the porters maximum flexibility in changing perl going forward while
at the same time providing clean ways for XS authors to do things right.

Ultimately I think at some point I think it is important to recognize that
a policy is failing to achieve its objectives, and change the policy so
that those objectives are met. And I think right now our current policy is
a complete failure. It does not prevent people from using these things, it
does not prevent us from getting stuck with people using them, it does not
prevent us from breaking XS modules, it does not prevent end users from
seeing broken code because dependencies were unavailable. In other words as
far as I can see the current policy only does one thing, makes us all
unhappy.

So lets change it.

Yves

@p5pRT
Copy link
Author

p5pRT commented May 19, 2014

From @bulk88

On Sun May 18 04​:48​:51 2014, demerphq wrote​:

On 17 May 2014 16​:16, Dave Mitchell <davem@​iabyn.com> wrote​:

Any XS code which directly accesses AvARRAY() is already broken with
respect
to tied arrays.

That is somewhat of a simplification. Any code that uses AvARRAY()
without
checking the array is tied first is going to have problems.

But this is well known. The exposed perl guts api's all make it clear
that
you have to be on your guard for ties and treat tied things with kid-
gloves.

We don't document amagic or how to run overload methods. Tied is barely documented other than the SV * returned from the HV/AV is magical, remember to call setmagic on it the appropriate number of times.

How many people on this list could confidently say (without checking
the
src code; its certainly not in the docs), under what circumnstances
an
element of AvARRAY() might be

* NULL
* &PL_sv_undef
* &PL_sv_placeholder

(I can imagine a lot of XS code happily trying to write to
PL_sv_placeholder).

But this is my point. Why should we? Why shouldnt we have a clear
macro
that does this for us?

What would the meaning of that macro be? what if more states need to be added than what those 3 represent (IDK what they represent).

I hold that if you want to do interesting or useful things with Perl
in XS
you are going to at some point want to work with AvARRAY() and similar
structures. And that we as porters would make everyones lives easier
if we
admitted it and made it easier to do safely and properly in a way that
allows the porters maximum flexibility in changing perl going forward
while
at the same time providing clean ways for XS authors to do things
right.

Those 2 prepositions conflict. Using undocumented/abstracted means you take the risk if it breaks and it will break and dont expect a decade of source code compatible compiling then.

The other choice is do a massive rewrite of the perl headers so PERL_CORE headers are different from XS. Or use a preprocessor at perl build time to delete PERL_CORE defed code. But that would lead to people copy pasting structs. The next choice is to XOR all pointers with a static secret key and SvLEN and SvCUR are function calls (we did something like this http​://perl5.git.perl.org/perl.git/commitdiff/87b9e16005b9e39b8a24388159e899fe54b95979 , its crazy inefficient, and I dont want it back).

Or Metacpan could put a red triangle with ! in it for .xs and .c code that makes a regex of perintern pod match.

Ultimately I think at some point I think it is important to recognize
that
a policy is failing to achieve its objectives, and change the policy
so
that those objectives are met. And I think right now our current
policy is
a complete failure. It does not prevent people from using these
things, it
does not prevent us from getting stuck with people using them, it does
not
prevent us from breaking XS modules, it does not prevent end users
from
seeing broken code because dependencies were unavailable. In other
words as
far as I can see the current policy only does one thing, makes us all
unhappy.

So lets change it.

Yves

To what?

AFAIK from reading p5p history, the concept of "public api" was an afterthought, since originally there was no CPAN and all XS code was included in the Core by Larry.

https://groups.google.com/d/msg/perl.perl5.porters/ZpZK8X1D8Ms/LHP06JdA6DkJ
https://groups.google.com/d/msg/perl.perl5.porters/a6CxaxlVJbM/9mTNZj66bewJ
http​://perl5.git.perl.org/perl.git/commit/954c1994944eafa74aaac1bab94e820b6e447da9

We have 3 pools that macros/funcs fall into right now. Always safe. Murky. Unstable. Function calls are usually safe. Macros are murky. struct access is usually unstable. I think MG is the only struct where we have documented access to its members. All the other structs are macroed.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 20, 2014

From @iabyn

On Sat, May 17, 2014 at 11​:47​:38AM -0700, bulk88 via RT wrote​:

Another provision is, what if AvARRAY isn't a SV**, but an AE *

What, in this context, is an AE?

--
The optimist believes that he lives in the best of all possible worlds.
As does the pessimist.

@p5pRT
Copy link
Author

p5pRT commented May 20, 2014

From @Leont

On Tue, May 20, 2014 at 3​:35 PM, Dave Mitchell <davem@​iabyn.com> wrote​:

On Sat, May 17, 2014 at 11​:47​:38AM -0700, bulk88 via RT wrote​:

Another provision is, what if AvARRAY isn't a SV**, but an AE *

What, in this context, is an AE?

I presume it's the array equivalent of an HE*. I don't really see the point
of it though.

Leon

@p5pRT
Copy link
Author

p5pRT commented May 20, 2014

From @bulk88

On Tue May 20 10​:47​:17 2014, LeonT wrote​:

On Tue, May 20, 2014 at 3​:35 PM, Dave Mitchell <davem@​iabyn.com> wrote​:

On Sat, May 17, 2014 at 11​:47​:38AM -0700, bulk88 via RT wrote​:

Another provision is, what if AvARRAY isn't a SV**, but an AE *

What, in this context, is an AE?

I presume it's the array equivalent of an HE*. I don't really see the point
of it though.

Leon

Yes, AE="array entry", named after HE.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2014

From m.nooning@comcast.net

If it helps, I used "cpan install AnyEvent" on my Windows XP, with Strawberry Perl 5.20 and with 5.20.1, and got the same results with both Perls, as reported in the now closed ticket 121727. The ticket was closed because it was judged that this current ticket is the real problem.
Thanks

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @iabyn

Karl, I note that you've added this old ticket (about AnyEvent/EV/Coro)
to the 5.22 blockers.

If I'm reading it right, this ticket referred to a failing test in Coro
caused by a change in the internal representation of AVs (unused elements
stored as NULL rather than &PL_sv_undef), which was fixed in Coro-6.39.

So, far from being a 5.22 blocker, this ticket could be closed?

--
Fire extinguisher (n) a device for holding open fire doors.

@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

From @khwilliamson

On 03/26/2015 08​:43 AM, Dave Mitchell wrote​:

Karl, I note that you've added this old ticket (about AnyEvent/EV/Coro)
to the 5.22 blockers.

If I'm reading it right, this ticket referred to a failing test in Coro
caused by a change in the internal representation of AVs (unused elements
stored as NULL rather than &PL_sv_undef), which was fixed in Coro-6.39.

So, far from being a 5.22 blocker, this ticket could be closed?

As I told rjbs on irc, at the time I did this, I went through an
essentially mechanical process to move almost all open tickets that had
subject lines containing "blead" and "cpan" to the blockers list. I
didn't move a very few because of it being totally obvious that they
didn't belong there, but I expected some that did get moved to turn out
to not be blockers.

@p5pRT p5pRT closed this as completed Mar 26, 2015
@p5pRT
Copy link
Author

p5pRT commented Mar 26, 2015

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant