develooper Front page | perl.perl5.porters | Postings from November 2014

[perl #123319] make HTML output reproducable with

November 30, 2014 21:01
[perl #123319] make HTML output reproducable with
Message ID:
# New Ticket Created by   
# Please include the string:  [perl #123319]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from,
generated with the help of perlbug 1.40 running under perl 5.20.1.


I am using to create HTML output. Due to hashes now being
randomized the "keys %hash" returns the keys in a random order.

Due to this of this perl version creates HTML that changes on
every invocation.

I have added some sorts to keys so it creates constant HTML output.

It probably does not cover all cases, just the ones in my usecase.

Ciao, Marcus

---	2014-11-24 17:36:51.281993992 +0100
+++	2014-11-24 17:36:52.873993231 +0100
@@ -1705,7 +1705,7 @@
     if ($meta && ref($meta) && (ref($meta) eq 'HASH')) {
-	for (keys %$meta) { push(@result,$XHTML ? qq(<meta name="$_" content="$meta->{$_}" />) 
+	for (sort keys %$meta) { push(@result,$XHTML ? qq(<meta name="$_" content="$meta->{$_}" />) 
 			: qq(<meta name="$_" content="$meta->{$_}">)); }
--- CGI/	2014-11-24 17:47:02.016544717 +0100
+++ CGI/	2014-11-24 17:47:05.583541202 +0100
@@ -154,7 +154,7 @@
     my $value = $escape ? simple_escape($attr->{$_}) : $attr->{$_};
     push(@att,defined($attr->{$_}) ? qq/$key=$quote$value$quote/ : qq/$key/);
-    return @att;
+    return sort @att;
 sub simple_escape {

[Please do not change anything below this line]
This perlbug was built using Perl 5.20.1 - Mon Oct  6 09:13:55 UTC 2014
It is being executed now by  Perl 5.20.1 - Mon Oct  6 09:11:27 UTC 2014.

Site configuration information for perl 5.20.1:

Configured by abuild at Mon Oct  6 09:11:27 UTC 2014.

Summary of my perl5 (revision 5 version 20 subversion 1) configuration:
    osname=linux, osvers=3.16.3-1.gd2bbe7f-default, archname=x86_64-linux-thread-multi
    uname='linux cloud115 3.16.3-1.gd2bbe7f-default #1 smp thu sep 18 06:32:16 utc 2014 (d2bbe7f) x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl -Dinc_version_list=5.20.0/x86_64-linux-thread-multi 5.20.0'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fwrapv -fno-strict-aliasing -pipe -fstack-protector'
    ccversion='', gccversion='4.8.3 20140627 [gcc-4_8-branch revision 212064]', 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 =' -L/usr/local/lib64 -fstack-protector'
    libpth=/usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/4.8/include-fixed /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lm -ldl -lcrypt -lpthread
    perllibs=-lm -ldl -lcrypt -lpthread
    libc=/lib64/, so=so, useshrplib=true,
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.20.1/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector'

@INC for perl 5.20.1:

Environment for perl 5.20.1:
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)
    PERL_MB_OPT=--install_base /suse/meissner/perl5
    SHELL=/bin/bash Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About