develooper Front page | perl.perl5.porters | Postings from January 2003

[perl #20339] Possible sprintf problem in perl5.8.0

Thread Previous | Thread Next
From:
Jason Lee
Date:
January 16, 2003 07:48
Subject:
[perl #20339] Possible sprintf problem in perl5.8.0
Message ID:
rt-20339-48703.19.1744486520015@bugs6.perl.org
# New Ticket Created by  Jason Lee 
# Please include the string:  [perl #20339]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=20339 >


Hi

After compiling and installing perl 5.8.0 without any problems I have
encountered some weird behaviour with sprintf.

This was highlighted by a failing "make test" of Text-Autoformt-1.04 module
and later by some simple sprintf examples which can all be found as detailed
below.

============================
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris
    uname='sunos damien 5.7 generic_106541-20 sun4u sparc
sunw,ultra-enterprise '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='/opt/SUNWspro/bin/cc', ccflags =' -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
    optimize='-O',
    cppflags=''
    ccversion='Sun WorkShop 6 update 1 C 5.2 2000/09/11', gccversion='',
gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/opt/SUNWspro/bin/cc', ldflags =' -L/opt/SUNWspro/WS6U1/lib '
    libpth=/opt/SUNWspro/WS6U1/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc
    perllibs=-lsocket -lnsl -ldl -lm -lc
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-KPIC', lddlflags='-G -L/opt/SUNWspro/WS6U1/lib'


Characteristics of this binary (from libperl): 
  Compile-time options: USE_LARGE_FILES
  Built under solaris
  Compiled at Jan  9 2003 10:57:19
  @INC:
    /perl/lib/5.8.0/sun4-solaris
    /perl/lib/5.8.0
    /perl/lib/site_perl/5.8.0/sun4-solaris
    /perl/lib/site_perl/5.8.0
    /perl/lib/site_perl
    .

====================================================================

Text-Autoformat-1.04
#> make test
PERL_DL_NONLAZY=1 /perl/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
1..64
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
expected [{  1.0 }
{ 10.0 }
{100.0 }
{###.##}
{###.##}
]
but got  [{%6.2lf}
{%6.2lf}
{%6.2lf}
{%6.2lf}
{%6.2lf}
]
not ok 11
ok 12
ok 13
ok 14
ok 15
ok 16
ok 17
ok 18
ok 19
ok 20
ok 21
ok 22
ok 23
ok 24
ok 25
ok 26
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
expected [***????.????***
***   1.0   ***
***   1.1   ***
***   1.0000***
***   1.0001***
***   1.2345***
***   1.2346***
***1111.0   ***
***####.####***
***????.????***
***????.????***
***   0.0   ***
]
but got  [***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***????.????***
***????.????***
***%9.4lf***
]
not ok 27
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
Invalid conversion in sprintf: "%f" at blib/lib/Text/Autoformat.pm line 150.
expected [***   1.0000***
***   1.1000***
***   1.0000***
***   1.0001***
***   1.2345***
***   1.2346***
***1111.0000***
***####.####***
***   0.0000***
]
but got  [***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
***%9.4lf***
]
not ok 28
ok 29
ok 30
ok 31
ok 32
ok 33
ok 34
ok 35
ok 36
ok 37
ok 38
ok 39
ok 40
ok 41
ok 42
ok 43
ok 44
ok 45
ok 46
ok 47
ok 48
ok 49
ok 50
ok 51
ok 52
ok 53
ok 54
ok 55
ok 56
ok 57
ok 58
ok 59
ok 60
ok 61
ok 62
ok 63
ok 64
===============================================
Simple example

# perl -e 'print sprintf "%6.2lf\n", 1;'
%6.2lf
# perl -e 'print sprintf "%6.2f\n", 1;'
  1.00


=============================
Thanks
Jason
________________________________________________
Jason Lee
S.D.E Manager
Boeing Australia  * 363 Adelaide St. * Brisbane * QLD * 4000
Email: jason.d.lee@boeing.com * Phone: +61 7 3306 3347 



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About