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

"Version string '1,3' contains invalid data; [...]" warning when locale is set #9761

Closed
p5pRT opened this issue Jun 3, 2009 · 10 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Jun 3, 2009

Migrated from rt.perl.org#66244 (status was 'rejected')

Searchable as RT66244$

@p5pRT
Copy link
Author

p5pRT commented Jun 3, 2009

From @scfc

This is a bug report for perl from tim@​tim-landscheidt.de,
generated with the help of perlbug 1.36 running under perl 5.10.0.


I started out with a warning​:

| Version string '1,3' contains invalid data; ignoring​: ',3' at /usr/lib/perl5/5.10.0/i386-linux-thread-multi/IO/Socket.pm line 12.

when using this script​:

| #!/usr/bin/perl -w

| use strict;
| use utf8;
| use warnings;

| use POSIX qw(locale_h);

| setlocale (LC_CTYPE, 'german');
| setlocale (LC_ALL, 'german');

| use LWP​::UserAgent;

| my $ua = LWP​::UserAgent->new () or die;
| my $res = $ua->get ('http​://www.yahoo.com/') or die;

Line 12 of
/usr/lib/perl5/5.10.0/i386-linux-thread-multi/IO/Socket.pm
reads​:

| use Socket 1.3;

I could narrow the warning down to​:

| #!/usr/bin/perl -w

| use strict;
| use utf8;
| use warnings;

| use POSIX qw(locale_h);

| setlocale (LC_CTYPE, 'german');
| setlocale (LC_ALL, 'german');

| eval "use Socket 1.3;";

which gives​:

| Version string '1,3' contains invalid data; ignoring​: ',3' at (eval 1) line 1.

(The "eval" is important here; without it, there is no warn-
ing.)

  Though only a warning, this obviously may break dependen-
cies on minor versions.



Flags​:
  category=core
  severity=medium


This perlbug was built using Perl 5.10.0 in the Fedora build system.
It is being executed now by Perl 5.10.0 - Tue Apr 14 07​:23​:09 EDT 2009.

Site configuration information for perl 5.10.0​:

Configured by Red Hat, Inc. at Tue Apr 14 07​:23​:09 EDT 2009.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration​:
  Platform​:
  osname=linux, osvers=2.6.18-128.1.6.el5xen, archname=i386-linux-thread-multi
  uname='linux xenbuilder4.fedora.phx.redhat.com 2.6.18-128.1.6.el5xen #1 smp tue mar 24 12​:28​:27 edt 2009 i686 i686 i386 gnulinux '
  config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DPERL_USE_SAFE_PUTENV -Dversion=5.10.0 -Dmyhostname=localhost -Dperladmin=root@​localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dprivlib=/usr/lib/perl5/5.10.0 -Dsitelib=/usr/local/lib/perl5/site_perl/5.10.0 -Dvendorlib=/usr/lib/perl5/vendor_perl/5.10.0 -Darchlib=/usr/lib/perl5/5.10.0/i386-linux-thread-multi -Dsitearch=/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi -Dvendorarch=/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi -Dinc_version_list=none -Darchname=i386-linux-thread-multi -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dotherlibdirs=/usr/lib/perl5/site_perl'
  hint=recommended, useposix=true, d_sigaction=define
  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='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
  optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DPERL_USE_SAFE_PUTENV',
  cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
  ccversion='', gccversion='4.3.2 20081105 (Red Hat 4.3.2-7)', 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=8
  alignbytes=4, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
  perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  libc=/lib/libc-2.9.so, so=so, useshrplib=true, libperl=libperl.so
  gnulibc_version='2.9'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE'
  cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -DPERL_USE_SAFE_PUTENV -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl 5.10.0​:
  /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
  /usr/local/lib/perl5/site_perl/5.10.0
  /usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
  /usr/lib/perl5/vendor_perl/5.10.0
  /usr/lib/perl5/vendor_perl
  /usr/lib/perl5/5.10.0/i386-linux-thread-multi
  /usr/lib/perl5/5.10.0
  /usr/lib/perl5/site_perl
  .


Environment for perl 5.10.0​:
  HOME=/home/tim
  LANG=de_DE.UTF-8
  LANGUAGE=
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/lib/qt-3.3/bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/games​:/usr/local/sbin​:/usr/sbin​:/sbin​:/home/tim/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 3, 2009

From p5p@spam.wizbit.be

On Wed Jun 03 02​:46​:44 2009, scfc wrote​:

I started out with a warning​:

| Version string '1,3' contains invalid data; ignoring​: ',3' at
/usr/lib/perl5/5.10.0/i386-linux-thread-multi/IO/Socket.pm line 12.

[snip]

(The "eval" is important here; without it, there is no warn-
ing.)

Though only a warning, this obviously may break dependen-
cies on minor versions.

It comes down to​:

#!/usr/bin/perl -l

use strict;
use warnings;

use POSIX qw(locale_h);

setlocale (LC_CTYPE, 'german');
setlocale (LC_ALL, 'german');
print 1.3;

__END__

This will print 1,3 because the decimal point in Geman is a comma.
If you add​: eval "use Socket 1.3"; it really tries to do eval "use
Socket 1,3"; because of the German locale.

Currently the only 'solution' I can think of is to use eval "use
Socket '1.3';" but there might be a better solution...

If eval "use Socket v1.3"; is used then the warning becomes​:
Version string '1,003' contains invalid data; ignoring​: ',003' at (eval
2) line 1.

Best regards,

Bram

@p5pRT
Copy link
Author

p5pRT commented Jun 3, 2009

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

@p5pRT
Copy link
Author

p5pRT commented Jun 4, 2009

From @JohnPeacock

Bram via RT wrote​:

Currently the only 'solution' I can think of is to use eval "use
Socket '1.3';" but there might be a better solution...

Yeah, that won't work; the magic that decides whether the value after the
package name in a use line is a version limitation or a parameter to import()
relies on something that "looks like a number". So if you quote it, it won't
get used to compare against $Socket​::VERSION, and instead will just get passed
to Socket​::import().

John

@p5pRT
Copy link
Author

p5pRT commented Jun 4, 2009

From @JohnPeacock

Tim Landscheidt (via RT) wrote​:

I started out with a warning​:

| Version string '1,3' contains invalid data; ignoring​: ',3' at /usr/lib/perl5/5.10.0/i386-linux-thread-multi/IO/Socket.pm line 12.

when using this script​:

| #!/usr/bin/perl -w

| use strict;
| use utf8;
| use warnings;

| use POSIX qw(locale_h);

| setlocale (LC_CTYPE, 'german');
| setlocale (LC_ALL, 'german');

| use LWP​::UserAgent;

| my $ua = LWP​::UserAgent->new () or die;
| my $res = $ua->get ('http​://www.yahoo.com/') or die;

Until I can figure out why eval isn't respecting the locale(), you can work
around this by adding

  use Socket 1.3;

at any point in your original script. The version-aware code in the core
(equivalent to the CPAN version.pm distro) /does/ respect locales, but something
is interfering and there are too many layers of misdirection for me to work out
where it is going wrong so early in the morning...

HTH

John

@p5pRT
Copy link
Author

p5pRT commented Jun 4, 2009

From p5p@perl.wizbit.be

Citeren John Peacock <john.peacock@​havurah-software.org>​:

Bram via RT wrote​:

Currently the only 'solution' I can think of is to use eval "use
Socket '1.3';" but there might be a better solution...

Yeah, that won't work;

But it does work.

the magic that decides whether the value after the
package name in a use line is a version limitation or a parameter to import()
relies on something that "looks like a number".

'1.3' looks like a number..

So if you quote it, it won't
get used to compare against $Socket​::VERSION, and instead will just
get passed
to Socket​::import().

$ perl-5.10.0 -MSocket -wle 'print $Socket​::VERSION;'
1.80

#!/usr/bin/perl -l

use strict;
use warnings;
use locale;

use POSIX qw(locale_h);

setlocale (LC_CTYPE, 'german');
setlocale (LC_ALL, 'german');
eval "use Socket '1.82';";
print $@​ if $@​;
__END__

$ perl-5.10.0 rt-66244.pl
Socket version 1.82 required--this is only version 1.80 at
/opt/perl/5.10.0/lib/5.10.0/Exporter/Heavy.pm line 122.
BEGIN failed--compilation aborted at (eval 1) line 1.

Best regards,

Bram

@p5pRT
Copy link
Author

p5pRT commented Jun 4, 2009

From rob@themayfamily.me.uk

2009/6/4 Bram <p5p@​perl.wizbit.be>​:

Citeren John Peacock <john.peacock@​havurah-software.org>​:

Bram via RT wrote​:

Currently the only 'solution' I can think of is to use  eval "use
Socket '1.3';"  but there might be a better solution...

Yeah, that won't work;

But it does work.

But isn't that because it's being handled by Exporter​:
Exporter​::Heavy​::heavy_export has this snippet​:

  if ($sym =~ m/^\d/) {
  $pkg->VERSION($sym); # inherit from UNIVERSAL

Rob.

@p5pRT
Copy link
Author

p5pRT commented Jun 4, 2009

From @gbarr

On Jun 4, 2009, at 6​:31 AM, Bram wrote​:

Citeren John Peacock <john.peacock@​havurah-software.org>​:

Bram via RT wrote​:

Currently the only 'solution' I can think of is to use eval "use
Socket '1.3';" but there might be a better solution...

Yeah, that won't work;

But it does work.

the magic that decides whether the value after the
package name in a use line is a version limitation or a parameter
to import()
relies on something that "looks like a number".

'1.3' looks like a number..

No, its not. That looks like a string to the parser. It is only a
number after it has been eval'd

So if you quote it, it won't
get used to compare against $Socket​::VERSION, and instead will
just get passed
to Socket​::import().

$ perl-5.10.0 -MSocket -wle 'print $Socket​::VERSION;'
1.80

#!/usr/bin/perl -l

use strict;
use warnings;
use locale;

use POSIX qw(locale_h);

setlocale (LC_CTYPE, 'german');
setlocale (LC_ALL, 'german');
eval "use Socket '1.82';";
print $@​ if $@​;
__END__

$ perl-5.10.0 rt-66244.pl
Socket version 1.82 required--this is only version 1.80 at /opt/perl/
5.10.0/lib/5.10.0/Exporter/Heavy.pm line 122.
BEGIN failed--compilation aborted at (eval 1) line 1.

But look where the error message comes from, Exporter

compare these

$ perl -e "use Socket 2.0"
Socket version 2 required--this is only version 1.81 at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

$ perl -e "use Socket '2.0'"
Socket version 2.0 required--this is only version 1.81 at /opt/local/
lib/perl5/5.8.9/Exporter/Heavy.pm line 123.
BEGIN failed--compilation aborted at -e line 1.

notice the difference.

In the first case the parser notices the number and will call Socket-

VERSION(2.0) but
in the second case it will call Socket->import('2.0')

Using Exporter to check version was the original way to check it. But
that was limited
to only modules that used Exporter. Which was why ->VERSION was added,
so that non-exporting
modules can check the version too.

The parser uses looks_like_number to determine what todo with the
first token after the package name.
See Scalar​::Util. If it is a number and not followed by a comma then -

VERSION is called, otherwise
it is passed to ->import

  # calls
use Socket 1.3; # ->VERSION(1.3) ->import()
use Socket '1.3'; # ->import('1.3')
use Socket (); #
use Socket 1.3 (); # ->VERSION(1.3)
use Socket 1.3 'foo'; # ->VERSION(1.2) ->import('foo')
use Socket 1.3,'foo'; # ->import(1.3,'foo')

Graham.

@p5pRT
Copy link
Author

p5pRT commented Jun 13, 2009

From @JohnPeacock

Transferring this to the version.pm queue for resolution​:
https://rt.cpan.org/Ticket/Display.html?id=46921

@p5pRT
Copy link
Author

p5pRT commented Mar 14, 2010

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

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