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

A little bug in lib/Getopt/Long.pm (in Perl 5.004_04) #731

Closed
p5pRT opened this issue Oct 18, 1999 · 2 comments
Closed

A little bug in lib/Getopt/Long.pm (in Perl 5.004_04) #731

p5pRT opened this issue Oct 18, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 18, 1999

Migrated from rt.perl.org#1643 (status was 'resolved')

Searchable as RT1643$

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 1999

From Felix-Kogan@deshaw.com

$ ~/bin/eval.pl
printf "%g\n", 13500000000
1.35e+10

It actually breaks some of production scripts (or makes people to do annoing
workarounds), so, we considered this a bug. I've made the following changes
in order to fix it locally​:

# diff Long.pm /usr/local/lib/perl5/Getopt/Long.pm
...
1151,1152c1151
...
< if ( $arg !~ /^[+-]?[0-9]+$/ ) {


  if \( $arg \!~ /^\-?\[0\-9\]\+$/ \) \{

1176,1177c1175
...
< if ( $arg !~ /^[+-]?[0-9.]+([eE][+-]?[0-9]+)?$/ ) {


  if \( $arg \!~ /^\-?\[0\-9\.\]\+\(\[eE\]\-?\[0\-9\]\+\)?$/ \) \{

The latest stable Perl distribution doesn't have this bug fixed either.

Hope it's helpful.


Felix Kogan, CompSys
D.E.SHAW & Co, NYC
(212) 478-0594, (212) 403-8594

@p5pRT
Copy link
Author

p5pRT commented Oct 18, 1999

From @sciurius

"Kogan, Felix" <Felix-Kogan@​deshaw.com> writes​:

It actually breaks some of production scripts (or makes people to do annoing
workarounds), so, we considered this a bug. I've made the following changes
in order to fix it locally​:

You apply several changes, where only 1 would be sufficient, why?

Could you please download the most recent version of Getopt​::Long from
http​://search.cpan.org/search?dist=Getopt-Long

and apply the following patch​:

***************
*** 725,736 ****
  # and at least one digit following the point and 'e'.
  # [-]NN[.NN][eNN]
  if ( $bundling && defined $rest &&
! $rest =~ /^(-?[0-9]+(\.[0-9]+)?([eE]-?[0-9]+)?)(.*)$/s ) {
  $arg = $1;
  $rest = $+;
  unshift (@​ARGV, $starter.$rest) if defined $rest && $rest ne '';
  }
! elsif ( $arg !~ /^-?[0-9.]+(\.[0-9]+)?([eE]-?[0-9]+)?$/ ) {
  if ( defined $optarg || $mand eq "=" ) {
  if ( $passthrough ) {
  unshift (@​ARGV, defined $rest ? $starter.$rest : $arg)
--- 725,736 ----
  # and at least one digit following the point and 'e'.
  # [-]NN[.NN][eNN]
  if ( $bundling && defined $rest &&
! $rest =~ /^(-?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?)(.*)$/s ) {
  $arg = $1;
  $rest = $+;
  unshift (@​ARGV, $starter.$rest) if defined $rest && $rest ne '';
  }
! elsif ( $arg !~ /^-?[0-9.]+(\.[0-9]+)?([eE][-+]?[0-9]+)?$/ ) {
  if ( defined $optarg || $mand eq "=" ) {
  if ( $passthrough ) {
  unshift (@​ARGV, defined $rest ? $starter.$rest : $arg)

Does this fix all your problems?

-- Johan

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