Skip to content

creating a global variable with "our" writes to an environment variable with the same name #23877

@gbowlbyMarvell

Description

@gbowlbyMarvell

Module:

Description - creating a global variable with "our" corrupts an environment variable with the same name

Steps to Reproduce

  • set an environment variable e.g. "ENV_NAME" to <value> prior to running a Perl script.
  • csh example:
    setenv ENV_NAME XYZ
  • create a global variable with "our ENV_NAME = <value2>;" in the Perl program. Example:
    our ENV_NAME = "ABC";
  • Then step through the Perl program with the Perl debugger.
  • in my case the environment variable was changed from <value> to <value2> after the "our" was executed.

Expected behavior

  • Expect to see the environment variables to be unchanged after an "our" is executed.

Perl configuration

# perl -V output goes here
Summary of my perl5 (revision 5 version 14 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=3.10.0-514.26.2.el7.x86_64, archname=x86_64-linux
    uname='linux 5fac436005bb 3.10.0-514.26.2.el7.x86_64 #1 smp fri jun 30 05:26:04 utc 2017 x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dprefix=/proj/fcglbl0a/project/perl/5.14.1'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.4.7 20120313 (Red Hat 4.4.7-18)', 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 =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.12'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl): 
  Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
                        PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT
                        USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
  Built under linux
  Compiled at Oct 15 2019 20:12:15
  %ENV:
    PERL5LIB="/proj/fcglbl0a/project/global/bin/../package"
  @INC:
    /proj/fcglbl0a/project/global/bin/../package
    /proj/fcglbl0a/project/perl/5.14.1/lib/site_perl/5.14.1/x86_64-linux
    /proj/fcglbl0a/project/perl/5.14.1/lib/site_perl/5.14.1
    /proj/fcglbl0a/project/perl/5.14.1/lib/5.14.1/x86_64-linux
    /proj/fcglbl0a/project/perl/5.14.1/lib/5.14.1

[perl_debug_session.txt](https://github.com/user-attachments/files/23143801/perl_debug_session.txt)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions