Skip Menu |

This queue is for tickets about the Hash-Merge CPAN distribution.

Report information
The Basics
Id: 6185
Status: resolved
Priority: 0/
Queue: Hash-Merge

People
Owner: Nobody in particular
Requestors: tshinnic [...] io.com
Cc:
AdminCc:

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



Subject: Failure due to use of Clone - no apparent reason
(This is an entirely inadequate bug report and I _expect_ it to be closed as non-reproducible, but it should serve as a warning, suggestion, and thanks for the clone behavior workaround) I've spent hours and hours trying to refine the problem scenario and must give up. I finally tried using the set_clone_behavior() to turn off the use of Clone and that appears to avoid the problem. This in spite of apparently using the latest versions of Clone and Hash::Merge. I'm developing a CGI that uses Template Toolkit. Hash::Merge is exactly what I needed to merge a fairly static hash describing one web page with a dynamic hash populated with form values, notes and error messages. While running as a 'normal' CGI under Apache on Redhat Linux 7.2 everything worked wonderfully. But when I was forced to use setuid suidperl the CGI would occasionally and mysteriously quit with Apache saying "Premature end of script headers: /var/www/cgi-bin/easyftp/easyftp.pl" Much pain and agony ensued but I was able to track down the failure point to the Hash::Merge::merge call. I could not reproduce with unaltered code when not setuid, nor standalone with 'same' data structures. When I finally gave up and used set_clone_behavior(0) the problem disappeared and I got the desired data results away. I had simplified the code and data down to this: if(0){ my $updates = { form => { adduser => { ftpuserid => { value => 'arf' } } } }; }else{ my $updates; foreach my $field_name ( @names ) { foreach my $field_name ( qw( ftpuserid ) ) { my $formvalue = $rhSES->{adduser}{$field_name}; next unless defined $formvalue; $updates->{form}{adduser}{$field_name}{value} = $formvalue; } } [ subroutine calls that eventually end up with ... ] Hash::Merge::set_behavior('RIGHT_PRECEDENT'); Hash::Merge::set_clone_behavior(0); printf " (I see tt_vars %s)<BR>\n", QVoU($tt_vars); printf " (I see updates %s)<BR>\n", QVoU($updates); printf "<PRE>\n"; print ''.Data::Dumper->Dump( [ $tt_vars ], [ qw( *tt_vars ) ] ); print ''.Data::Dumper->Dump( [ $updates ], [ qw( *updates ) ] ); printf "</PRE>\n"; $tt_vars = Hash::Merge::merge( $tt_vars, $updates ); printf "<PRE>\n"; print ''.Data::Dumper->Dump( [ $tt_vars ], [ qw( *tt_vars ) ] ); printf "</PRE>\n"; (I see tt_vars 'HASH(0x8416184)') (I see updates 'HASH(0x8416028)') %tt_vars = ( 'form' => { 'adduser' => { 'ftpuserid' => { 'value' => 'the_default' } } } ); %updates = ( 'form' => { 'adduser' => { 'ftpuserid' => { 'value' => 'XT2KMR' } } } ); Would fail at this point with unhelpful Apache message. When working dumped result was: %tt_vars = ( 'form' => { 'adduser' => { 'ftpuserid' => { 'value' => 'XT2KMR' } } } ); To give the proper "Twilight Zone" feel to it all, if I commented out the loop line $updates->{form}{adduser}{$field_name}{value} = $formvalue; the problem would not surface (although of course the data was then wrong). Even when I manually constructed the 'same' data structure in $updates beforehand with my $updates = { form => { adduser => { ftpuserid => ..... Anyway, I had to give up and use set_clone_behavior(0). This was okay for me as the data structure 'leaves' contain only scalar values. For the curious, version information below. perl -M"Hash::Merge 99" Hash::Merge version 99 required--this is only version 0.07. perl -M"Clone 99" Clone version 99 required--this is only version 0.15. cat /etc/redhat-release Red Hat Linux release 7.2 (Enigma) uname -a Linux xxxxxx.budgie.com 2.4.9-31smp #1 SMP Tue Feb 26 06:55:00 EST 2002 i686 unknown [root@wacs06 easyftp]# perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.4.17-0.13smp, archname=i386-linux uname='linux daffy.perf.redhat.com 2.4.17-0.13smp #1 smp fri feb 1 10:30:48 est 2002 i686 unknown ' config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dcccdlflags=-fPIC -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Uusethreads -Uuseithreads -Uuselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Di_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Dlocincpth=' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include', optimize='-O2 -march=i386 -mcpu=i686', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.96 20000731 (Red Hat Linux 7.1 2.96-98)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: Built under linux Compiled at Feb 20 2002 15:01:16 @INC: /usr/lib/perl5/5.6.1/i386-linux /usr/lib/perl5/5.6.1 /usr/lib/perl5/site_perl/5.6.1/i386-linux /usr/lib/perl5/site_perl/5.6.1 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl .
[guest - Sat May 1 16:57:33 2004]: Please note the first foreach is supposed to be shown as commented out. Typo was not in code.
From: Stephen Howard <stephen [...] enterity.com>
I wanted to note that this is still an issue, as I discovered the workaround (setting clone to 0) made the error dissapear in exactly the manner the previous poster described. Likewise, there was no error output to the apache error logs when I ran into this problem, similar to the other poster.
When Clone is used this problem should boil down to the call to Clone's function. It may help simply call the clone method on said data as notmal and then setuid and see if you can reproduce it. I might note to that the 0.09 does not even load Clone until its needed so if it s weird SYSTEM/XS/Setuid obscurity that shoudl help. It'd be great if you could come up with a short script that can reproduce it: my %data_a = ... my %data_b = ... merge( ... # clone on = dies, no error # clone off = works fine That way I could stace it and see whats happening if there truly is no error besides apache's deneric output before headers error If so please reopen with pertinate info (apache/lighthttpd etc, CGI, mod_perl, etc, perl -le 'print $[;' uname -a etc Thanks!
When Clone is used this problem should boil down to the call to Clone's function. It may help simply call the clone method on said data as notmal and then setuid and see if you can reproduce it. I might note to that the 0.09 does not even load Clone until its needed so if it s weird SYSTEM/XS/Setuid obscurity that shoudl help. It'd be great if you could come up with a short script that can reproduce it: my %data_a = ... my %data_b = ... merge( ... # clone on = dies, no error # clone off = works fine That way I could stace it and see whats happening if there truly is no error besides apache's deneric output before headers error If so please reopen with pertinate info (apache/lighthttpd etc, CGI, mod_perl, etc, perl -le 'print $[;' uname -a etc Thanks!
This may have been due to the Clone bug that was referenced at http://rt.cpan.org/Ticket/Display.html?id=2252 If there is no feedback soon on how to repoduce it or if they can even still reproduce it I'd say its safe to assume its been resolved via Clone
On Mon Apr 09 00:29:07 2007, DMUEY wrote: Show quoted text
> This may have been due to the Clone bug that was referenced at > http://rt.cpan.org/Ticket/Display.html?id=2252 > > If there is no feedback soon on how to repoduce it or if they can even > still reproduce it I'd say > its safe to assume its been resolved via Clone
Closing since it was likley resolved when Clone was fixed, thanks :)