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

bug in cpan.pm on Windows where environment variables are upper case #7220

Closed
p5pRT opened this issue Apr 8, 2004 · 7 comments
Closed

bug in cpan.pm on Windows where environment variables are upper case #7220

p5pRT opened this issue Apr 8, 2004 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 8, 2004

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

Searchable as RT28381$

@p5pRT
Copy link
Author

p5pRT commented Apr 8, 2004

From Steve.Tolkin@fmr.com

Created by steve.tolkin@fmr.com

There is a bug in cpan.pm because
in Microsoft Windows environment variables are upper case.
This bug exists in the latest version of cpan.pm $VERSION = '1.76_01';

I rated the severity as high because this bug
prevented me from using cpan at all --
it caused a failure using the http protocol (and ftp is blocked by a
firewall).
After debugging the code I realize that I also could have worked around
the bug by using CPAN​::Config -- but that was not clear at the time.
Also, I greatly prefer setting the value of ftp_proxy etc. in an
environment
variable, rather than a configuration file, because it has a different
value
depending on my location (home or work)
and I use the same machine, a laptop, for both.

I conjecture that variants of this bug affect other environment
variables also,
in other modules.

I patched a few lines in cpan.pm and now it works correctly.
Here is the patch, from the attached file diff.txt
(Ignore the first few lines; they are caused by my use of RCS)
I have also attached the file diff-c.txt (a context diff).

5c5
< # $Id​: cpan.pm 1.4 2004/04/08 20​:12​:28 a071046 Exp $
---

# $Id​: cpan.pm 1.5 2004/04/08 20​:23​:51 a071046 Exp $
9c9
< # $Revision = "[".substr(q$Revision​: 1.4 $, 10)."]";
---
# $Revision = "[".substr(q$Revision​: 1.5 $, 10)."]";
2357a2358,2361
# start bug fix -- by Steve Tolkin 2004-04-08
# In Windows all environment variables are upper case.
# Another approach might be to first call
$Ua->env_proxy(),
# and then overlay with values from $CPAN​::Config if
any.
2359c2363,2364
< if $var = $CPAN​::Config->{ftp_proxy} ||
$ENV{ftp_proxy};
---
if $var = $CPAN​::Config->{ftp_proxy} ||
$ENV{ftp_proxy}
|| $ENV{FTP_PROXY};
2361c2366,2367
< if $var = $CPAN​::Config->{http_proxy} ||
$ENV{http_proxy};
---
if $var = $CPAN​::Config->{http_proxy} ||
$ENV{http_proxy}
|| $ENV{HTTP_PROXY};
2377c2383,2385
< if $var = $CPAN​::Config->{no_proxy} ||
$ENV{no_proxy};
---
if $var = $CPAN​::Config->{no_proxy} ||
$ENV{no_proxy}
|| $ENV{NO_PROXY};
# end bug fix

Perl Info

Flags:
    category=library
    severity=high

Site configuration information for perl v5.8.0:

Configured by ActiveState at Tue Feb  4 18:07:44 2003.

Summary of my perl5 (revision 5 version 8 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef 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='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib
netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib
odbc32.lib odbccp32.lib msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib
version.lib odbc32.lib odbccp32.lib msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"C:\Perl\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY


@INC for perl v5.8.0:
    c:/Perl/lib
    c:/Perl/site/lib
    .


Environment for perl v5.8.0:
    HOME=c:\_myhome
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
 
PATH=C:\PROGRA~1\MICROS~3\Common\msdev98\BIN;C:\PROGRA~1\MICROS~3\VC98\B
IN;C:\PROGRA~1\MICROS~3\Common\TOOLS\WINNT;C:\PROGRA~1\MICROS~3\Common\T
OOLS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\Fidelity\Security Configuration;C:\MyApp3;C:\MyApp4;C:\PROGRAM
FILES\THINKPAD\UTILITIES;C:\Program
Files\Hummingbird\Connectivity\7.10\Accessories\;C:\Program Files\ATI
Technologies\ATI Control Panel;C:\Program
Files\Symantec\pcAnywhere\;c:\_myhome\mybin;c:\bin;c:\usr\local\wbin;c:\
perl\bin;c:\emacs\bin;c:\_otherbin;c:\ant\bin;C:\PROGRA~1\IBM\SQLLIB\BIN
;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IBM\SQLLIB\SAMPLES\REPL;C:\
PROGRA~1\NcFTP;c:\j2sdk1.4.1_02\bin;;C:\PROGRA~1\Brio\BRIOQU~1\PROGRAM
    PERL_BADLANG (unset)
    SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Apr 8, 2004

From Steve.Tolkin@fmr.com

5c5
< # $Id​: cpan.pm 1.4 2004/04/08 20​:12​:28 a071046 Exp $


# $Id​: cpan.pm 1.5 2004/04/08 20​:23​:51 a071046 Exp $
9c9
< # $Revision = "[".substr(q$Revision​: 1.4 $, 10)."]";


# $Revision = "[".substr(q$Revision​: 1.5 $, 10)."]";
2357a2358,2361
# start bug fix -- by Steve Tolkin 2004-04-08
# In Windows all environment variables are upper case.
# Another approach might be to first call $Ua->env_proxy(),
# and then overlay with values from $CPAN​::Config if any.
2359c2363,2364
< if $var = $CPAN​::Config->{ftp_proxy} || $ENV{ftp_proxy};


                if $var = $CPAN&#8203;::Config\->\{ftp\_proxy\} || $ENV\{ftp\_proxy\}
                    || $ENV\{FTP\_PROXY\};

2361c2366,2367
< if $var = $CPAN​::Config->{http_proxy} || $ENV{http_proxy};


                if $var = $CPAN&#8203;::Config\->\{http\_proxy\} || $ENV\{http\_proxy\}
                    || $ENV\{HTTP\_PROXY\};

2377c2383,2385
< if $var = $CPAN​::Config->{no_proxy} || $ENV{no_proxy};


                if $var = $CPAN&#8203;::Config\->\{no\_proxy\} || $ENV\{no\_proxy\}
                    || $ENV\{NO\_PROXY\};
            \# end bug fix 

@p5pRT
Copy link
Author

p5pRT commented Apr 8, 2004

From Steve.Tolkin@fmr.com

*** cpan.pm.1_76_01.baq Thu Apr 8 16​:12​:53 2004
--- cpan.pm Thu Apr 8 16​:23​:51 2004
***************
*** 2,12 ****
  package CPAN;
  $VERSION = '1.76_01';
  $VERSION = eval $VERSION;
! # $Id​: cpan.pm 1.4 2004/04/08 20​:12​:28 a071046 Exp $
 
  # only used during development​:
  $Revision = "";
! # $Revision = "[".substr(q$Revision​: 1.4 $, 10)."]";
 
  use Carp ();
  use Config ();
--- 2,12 ----
  package CPAN;
  $VERSION = '1.76_01';
  $VERSION = eval $VERSION;
! # $Id​: cpan.pm 1.5 2004/04/08 20​:23​:51 a071046 Exp $
 
  # only used during development​:
  $Revision = "";
! # $Revision = "[".substr(q$Revision​: 1.5 $, 10)."]";
 
  use Carp ();
  use Config ();
***************
*** 2355,2364 ****
  if $CPAN​::DEBUG;
  } else {
  my($var);
  $Ua->proxy('ftp', $var)
! if $var = $CPAN​::Config->{ftp_proxy} || $ENV{ftp_proxy};
  $Ua->proxy('http', $var)
! if $var = $CPAN​::Config->{http_proxy} || $ENV{http_proxy};
 
 
  # >>>>> On Wed, 13 Dec 2000 09​:21​:34 -0500, "Robison, Jonathon (J.M.)" <jrobiso2@​visteon.com> said​:
--- 2355,2370 ----
  if $CPAN​::DEBUG;
  } else {
  my($var);
+ # start bug fix -- by Steve Tolkin 2004-04-08
+ # In Windows all environment variables are upper case.
+ # Another approach might be to first call $Ua->env_proxy(),
+ # and then overlay with values from $CPAN​::Config if any.
  $Ua->proxy('ftp', $var)
! if $var = $CPAN​::Config->{ftp_proxy} || $ENV{ftp_proxy}
! || $ENV{FTP_PROXY};
  $Ua->proxy('http', $var)
! if $var = $CPAN​::Config->{http_proxy} || $ENV{http_proxy}
! || $ENV{HTTP_PROXY};
 
 
  # >>>>> On Wed, 13 Dec 2000 09​:21​:34 -0500, "Robison, Jonathon (J.M.)" <jrobiso2@​visteon.com> said​:
***************
*** 2374,2380 ****
  #
 
  $Ua->no_proxy($var)
! if $var = $CPAN​::Config->{no_proxy} || $ENV{no_proxy};
  }
  }
  }
--- 2380,2388 ----
  #
 
  $Ua->no_proxy($var)
! if $var = $CPAN​::Config->{no_proxy} || $ENV{no_proxy}
! || $ENV{NO_PROXY};
! # end bug fix
  }
  }
  }

@p5pRT
Copy link
Author

p5pRT commented Oct 25, 2004

From @smpeters

# In Windows all environment variables are upper case.

That doesn't seem to be the case from my experience. Now, different
Windows versions all behave differently, so, I might not have the right
mix of OS, but, on Windows XP, ...

F​:\>set foo=BAR

F​:\>c​:\perl\bin\perl -e"print $ENV{foo} . \"\n\""
BAR

F​:\>c​:\perl\bin\perl -e"print $ENV{FOO} . \"\n\""
BAR

it is very capable of handling lowercase environment variables. I also
tested this from an environment variable set from the System control
panel. The only issue I've seen is that environment variables are
case-insensative on Windows, which I've experienced very painfully on
Windows NT previously.

If you can replicate the problem outside of CPAN, I'd appreciate seeing
an example.

@p5pRT
Copy link
Author

p5pRT commented Oct 25, 2004

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

@p5pRT
Copy link
Author

p5pRT commented Oct 25, 2004

From Steve.Tolkin@fmr.com

Can you please mail me the original bug report.

Thanks,
Steve

-----Original Message-----
From​: Steve Peters via RT [mailto​:perlbug-followup@​perl.org]
Sent​: Monday, October 25, 2004 10​:09 AM
To​: Tolkin, Steve
Subject​: [perl #28381] bug in cpan.pm on Windows where environment
variables are upper case

# In Windows all environment variables are upper case.

That doesn't seem to be the case from my experience. Now, different
Windows versions all behave differently, so, I might not have the right
mix of OS, but, on Windows XP, ...

F​:\>set foo=BAR

F​:\>c​:\perl\bin\perl -e"print $ENV{foo} . \"\n\""
BAR

F​:\>c​:\perl\bin\perl -e"print $ENV{FOO} . \"\n\""
BAR

it is very capable of handling lowercase environment variables. I also
tested this from an environment variable set from the System control
panel. The only issue I've seen is that environment variables are
case-insensative on Windows, which I've experienced very painfully on
Windows NT previously.

If you can replicate the problem outside of CPAN, I'd appreciate seeing
an example.

@p5pRT p5pRT closed this as completed Nov 19, 2004
@p5pRT
Copy link
Author

p5pRT commented Nov 19, 2004

@smpeters - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant