Skip Menu |

This queue is for tickets about the Algorithm-Permute CPAN distribution.

Report information
The Basics
Id: 2596
Status: resolved
Priority: 0/
Queue: Algorithm-Permute

People
Owner: Nobody in particular
Requestors: slaven [...] rezic.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Can't die out of a permute loop
It is not possible to jump out of a permute loop with die and eval. The process exits altogether. use Algorithm::Permute; @x = (1..2); $i = 0; eval { Algorithm::Permute::permute { die if (++$i > 1) } @x; }; warn "Never reached!?";
Slaven, the attached patch does the following things: 1. it enables eval-ing outside permute block 2. it disables setting readonly array on the passed array 3. it fixes a memory leak in permute() Since I'm not sure about no. 2, I have asked ROBIN (the orig author of the callback style) about for what purpose it is set as readonly. rgds, Edwin.
Download patch-0.05
application/octet-stream 2.8k

Message body not shown because it is not plain text.

[slaven@rezic.de - Fri May 23 06:28:56 2003]: Show quoted text
> Thanks. The patch works for the small example, but unfortunately I > have still problems with permute() embedded in a large Perl/Tk > application (with Tk->update called in the permute subroutine). I > will look if I can narrow the problem to another test case. >
yep, that patch sucks. DON'T use it. The only good thing it does is plumbing the memory leak. The eval problem needs more involved work to fix. Probably a safer way is to create a local array copy inside the pseudo block and play with it, instead of changing the array in-place. Possible workaround at this moment is to put eval inside the pseudo block. Here's a small patch which fix only the leak. We'll go back later on the eval things. rgds, Edwin.
Download patch-0.05.1
application/octet-stream 376b

Message body not shown because it is not plain text.

[EDPRATOMO - Sun May 25 02:32:14 2003]: Show quoted text
> [slaven@rezic.de - Fri May 23 06:28:56 2003]: >
> > Thanks. The patch works for the small example, but unfortunately I > > have still problems with permute() embedded in a large Perl/Tk > > application (with Tk->update called in the permute subroutine). I > > will look if I can narrow the problem to another test case. > >
ok here we go again. please try the attached patch. This one does perl context stack manipulation in a safer way. it still change the array in-place. rgds, Edwin.
Download patch-0.05.2
application/octet-stream 2.6k

Message body not shown because it is not plain text.

From: ROBIN
I'm sorry that I wasn't aware of this correspondence. Edwin's fix is still broken, because something like eval { permute { die } @a } will cause a memory leak. I sent him a correct fix a few weeks ago, as a patch against 0.05, but have had no response. I shall prepare a patch against 0.06 that reverses the broken changes and incorporates a correct fix. .robin.
From: ROBIN
Okay, try the attached patch against 0.06. I think it fixes all known problems. .robin.
Download permute-patch-06
application/octet-stream 4.6k

Message body not shown because it is not plain text.

From: muenalan [...] cpan.org
[ROBIN - Tue Jul 1 15:09:05 2003]: Show quoted text
> Okay, try the attached patch against 0.06. > I think it fixes all known problems. > > .robin.
perl 5.8.0 / Win32 crashes after test 22. Then i thought i can fix it with this patch, but then more trouble (appended) Greetings, murat Installing perl extension Checking if your kit is complete... Looks good Writing Makefile for Algorithm::Permute Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cp Permute.pm blib\lib\Algorithm\Permute.pm AutoSplitting blib\lib\Algorithm\Permute.pm (blib\lib\auto\Algorithm\Permute) C:\Programme\Perl\bin\perl.exe C:\Programme\Perl\lib\ExtUtils/xsubpp -typemap C:\Programme\Perl\lib\ExtUtils\typemap -typemap typemap Permute.xs > Permute.xsc && C:\Program me\Perl\bin\perl.exe -MExtUtils::Command -e mv Permute.xsc Permute.c cl -c -nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE - DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT - DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -MD -DNDEBUG -O1 -DVERSION=\"0.06\" -DXS_VERSION=\"0.06\" "- IC:\Programme\Perl\lib\CORE" -DPERL_EXT Permute.c Permute.c Permute.xs(93) : warning C4018: '<' : signed/unsigned mismatch Permute.xs(151) : warning C4101: 'j' : unreferenced local variable Permute.xs(200) : warning C4018: '<' : signed/unsigned mismatch Permute.xs(189) : warning C4101: 'tmp' : unreferenced local variable Permute.xs(324) : warning C4013: 'PerlProc_setjmp' undefined; assuming extern returning int Permute.xs(351) : warning C4013: 'PerlProc_longjmp' undefined; assuming extern returning int Running Mkbootstrap for Algorithm::Permute () C:\Programme\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 Permute.bs C:\Programme\Perl\bin\perl.exe -MExtUtils::Mksymlists - e "Mksymlists('NAME'=>\"Algorithm::Permute\", 'DLBASE' => 'Permute', 'DL_FUNCS' => { }, 'FUNCLIST' => [], 'IMPORTS' = Show quoted text
> { }, 'DL_VARS' => []);"
link -out:blib\arch\auto\Algorithm\Permute\Permute.dll -dll - nologo -nodefaultlib -libpath:"C:\Programme\Perl\lib\CORE" - machine:x86 Permute.obj C:\Programme\Perl\lib\CO RE\perl58.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib win mm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:Permute.def Creating library blib\arch\auto\Algorithm\Permute\Permute.lib and object blib\arch\auto\Algorithm\Permute\Permute.exp Permute.obj : error LNK2019: unresolved external symbol _PerlProc_longjmp referenced in function _XS_Algorithm__Permute_permute Permute.obj : error LNK2019: unresolved external symbol _PerlProc_setjmp referenced in function _XS_Algorithm__Permute_permute blib\arch\auto\Algorithm\Permute\Permute.dll : fatal error LNK1120: 2 unresolved externals NMAKE : fatal error U1077: 'link' : return code '0x460' Stop. ---- Summary of my perl5 (revision 5 version 8 subversion 0) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 - D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT - DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READF IX', optimize='-MD -DNDEBUG -O1', cppflags='-DWIN32' ccversion='', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib - libpath:"C:\Programme\Perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm. lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib wi nmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='undef' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib - libpath:"C:\Programme\Perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS Locally applied patches: ActivePerl Build 806 Built under MSWin32 Compiled at Apr 24 2003 20:37:33 @INC: C:/Programme/Perl/lib C:/Programme/Perl/site/lib .
Fixed in 0.08. The memory leak test for die-inside-permute-block is not yet included in 0.08. For win32 build, I haven't tried that, but it seems like the same problem as srezic reported in freebsd-6.2 (which is fixed in 0.08).