1751924 Members
4746 Online
108783 Solutions
New Discussion юеВ

Re: PATH obfuscation

 
Ralph Grothe
Honored Contributor

PATH obfuscation

Hi,

I'm getting a bit confused.
Although this is happening on a Solaris box I think the solution must be *nix independant.

I've just compiled Perl 5.8.4 from the latest stable.tar.gz with the SUN Forte compiler.
I had to build my own Perl because I intend to use embedded Perl in the Net-SNMP environment.
In their README.solaris I read that one has to compile a Perl with *no* largefile support, because Net-SNMP is only 32Bit.

In order not to interfere with the standard Perl (which is a hardlink in /usr/bin/perl) I chose /usr/local/net-snmp as installation target, and set hard links (/ and /usr is one filesystem) to more convinient Paths.
So my Perl has the inode 222384, while the Solaris Perl has inode 427256.
(you can easily recognize it by the file size)

# ls -il /usr/*bin/perl /usr/local/bin/perl /usr/perl5/bin/perl /usr/local/net-snmp/bin/perl
427256 -r-xr-xr-x 3 root bin 14312 Jan 9 2000 /usr/5bin/perl
427256 -r-xr-xr-x 3 root bin 14312 Jan 9 2000 /usr/bin/perl
222384 -rwxr-xr-x 4 root other 1370708 Jul 30 14:57 /usr/local/bin/perl
222384 -rwxr-xr-x 4 root other 1370708 Jul 30 14:57 /usr/local/net-snmp/bin/perl
427256 -r-xr-xr-x 3 root bin 14312 Jan 9 2000 /usr/perl5/bin/perl
222384 -rwxr-xr-x 4 root other 1370708 Jul 30 14:57 /usr/sbin/perl


In root's PATH /usr/sbin is before /usr/bin
so I expect my Perl to be found first.

# echo $PATH|cut -d: -f1-2
/usr/sbin:/usr/bin

# which perl
/usr/sbin/perl

There is no alias, nor funcdef for Perl in my shell (which is Bash).

# alias perl
bash: alias: `perl' not found
# typeset -f perl

But when I query the Perl version without full path the Solaris Perl is reporting instead of mine.

# perl -v|head -3

This is perl, version 5.005_03 built for sun4-solaris


# /usr/sbin/perl -v|head -3

This is perl, v5.8.4 built for sun4-solaris-64int


Can you tell me where my misconception lies?

Happy Sysadmin Day
Ralph
Madness, thy name is system administration
3 REPLIES 3
Dave Olker
HPE Pro

Re: PATH obfuscation

Hi Ralph,

Just a wild guess...can you look at the rest of your environment variables to see if there is some other environment variable associated with Perl that would wreak havoc with which version gets started?

I'd check the output of both the "env" and the "set" commands to see if anything obvious popped up there.

Good luck,

Dave
I work for HPE

[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
Accept or Kudo
H.Merijn Brand (procura
Honored Contributor

Re: PATH obfuscation

1. The latest stable is not 5.8.4 but 5.8.5 :)
2. Did you compile with -Dinc_version_list=none ? That would prevent cross use of modules between different bperl versions and installation PATH's
3. Did you check $PERL5LIB?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Ralph Grothe
Honored Contributor

Re: PATH obfuscation

I have no Perl related variables I know of set.
This is root's environment:

# env|sort
BASH_ENV=/root/.bashrc
HISTFILE=/root/.bash_history
HISTSIZE=1024
HOME=/root
HOSTNAME=zecke
HOSTTYPE=sparc
HZ=
LESSOPEN=|/usr/local/sbin/lesspipe.sh %s
LOGNAME=root
MACHTYPE=sparc-sun-solaris
MANPATH=/usr/local/man:/opt/SUNWspro/man:/opt/sfw/man:/usr/share/man:/usr/share/man/Xprint_ma
n:/opt/SMAWPlus/man
OSTYPE=solaris
PAGER=/usr/bin/less
PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/SUNWspro/bin:/opt/SUNWspro/WS6U2/
bin:/usr/ccs/bin:/usr/sbin/lpfc:/opt/FJSVana/sbin:/opt/FJSVapcs/sbin:/opt/FJSVcpupd/sbin:/opt
/FJSVdef/sbin:/opt/FJSVhwr/sbin:/opt/FJSVmadm/sbin:/opt/FJSVssf/sbin:/opt/FJSVwarn/sbin:/opt/
FJSVana/bin:/opt/FJSVbse/bin:/opt/FJSVdmp/bin:/opt/FJSVracm/bin:/opt/FJSVragt/bin:/opt/FJSVrl
ib/bin:/opt/FJSVrmaos/bin:/opt/FJSVsirms/bin:/opt/FJSVsnap/bin:/opt/FJSVwvcnf/bin
PS1=[\u@\h:\w]\n\$
PWD=/root
SHELL=/sbin/sh
SHLVL=1
TERM=aixterm-m
TZ=MET
_=/usr/bin/env


These are all Shell variables, including shell funcdefs:

BASH=/usr/bin/bash
BASH_ENV=/root/.bashrc
BASH_VERSINFO=([0]="2" [1]="03" [2]="0" [3]="1" [4]="release" [5]="sparc-sun-solaris")
BASH_VERSION='2.03.0(1)-release'
COLUMNS=93
DIRSTACK=()
EUID=0
GROUPS=()
HISTFILE=/root/.bash_history
HISTFILESIZE=1024
HISTSIZE=1024
HOME=/root
HOSTNAME=zecke
HOSTTYPE=sparc
HZ=
IFS='
'
LESSOPEN='|/usr/local/sbin/lesspipe.sh %s'
LINES=40
LOGNAME=root
MACHTYPE=sparc-sun-solaris
MAILCHECK=60
MANPATH=/usr/local/man:/opt/SUNWspro/man:/opt/sfw/man:/usr/share/man:/usr/share/man/Xprint_ma
n:/opt/SMAWPlus/man
OPTERR=1
OPTIND=1
OSTYPE=solaris
PAGER=/usr/bin/less
PATH=/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/opt/SUNWspro/bin:/opt/SUNWspro/WS6U2/
bin:/usr/ccs/bin:/usr/sbin/lpfc:/opt/FJSVana/sbin:/opt/FJSVapcs/sbin:/opt/FJSVcpupd/sbin:/opt
/FJSVdef/sbin:/opt/FJSVhwr/sbin:/opt/FJSVmadm/sbin:/opt/FJSVssf/sbin:/opt/FJSVwarn/sbin:/opt/
FJSVana/bin:/opt/FJSVbse/bin:/opt/FJSVdmp/bin:/opt/FJSVracm/bin:/opt/FJSVragt/bin:/opt/FJSVrl
ib/bin:/opt/FJSVrmaos/bin:/opt/FJSVsirms/bin:/opt/FJSVsnap/bin:/opt/FJSVwvcnf/bin
PIPESTATUS=([0]="0" [1]="0")
PPID=29437
PS1='[\u@\h:\w]\n\$ '
PS2='> '
PS4='+ '
PWD=/root
SHELL=/sbin/sh
SHELLOPTS=braceexpand:hashall:histexpand:monitor:interactive-comments:vi
SHLVL=1
TERM=aixterm-m
TZ=MET
UID=0
_=
nddparms=()
{
nic=/dev/$(basename ${1:-hme0});
instance=$(echo $nic|tr -dc '[0-9]');
driver=${nic%[0-9]};
parms=$(/usr/sbin/ndd -get $driver \?|awk '$1~/^[a-z1]/&&$1!="instance"{print$1}');
echo -e "driver:\n$driver";
for p in instance $parms;
do
/usr/sbin/ndd -set $driver instance $instance;
echo $p:;
/usr/sbin/ndd -get $driver $p;
done
}


I think there must have been some strange shell settings when I bothered you with my posting (maybe owe to a su too many?).

When I logged in now, all's as it should be:

# perl -v|head -2

This is perl, v5.8.4 built for sun4-solaris-64int


# perl -V |grep cc
cc='/opt/SUNWspro/bin/cc', ccflags ='-I/usr/local/include',
ccversion='Sun WorkShop 6 update 2 C 5.3 2001/05/15', gccversion='', gccosandvers=''
ld='/opt/SUNWspro/bin/cc', ldflags =' -L/usr/lib -L/usr/ccs/lib -L/opt/SUNWspro/WS6U2/lib
-L/usr/local/lib'
libpth=/usr/lib /usr/ccs/lib /opt/SUNWspro/WS6U2/lib /usr/local/lib
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-KPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib -L/opt/SUNWspro/WS6U2/lib -L/
usr/local/lib'



Madness, thy name is system administration