![]() |
ambiguous results from pack
I'm trying to do development on a Linux laptop to port to Solaris.
However, I've run into a pack command that's returning incorrect results on my laptop. I'm using Perl 5.8.0 on all platforms. I've included the output of perl -V also below because the problem seems to be so low level. Here's the command... perl -e 'print pack("I", 149);'|od -x The correct response, which I get on most platforms, is this... 00000000 0095 0000 00000004 However, on my laptop, where it really matters, I'm getting this... 00000000 95C2 0000 00000004 I'd write this off as some weird endian problem, except that I'm getting the incorrect results on an i386 based machine, and getting correct results on 2 other i386 based machines, one Linux and one Cygwin. Anyway, below is the output of perl -V. The first listing is the one that's returning incorrect results, the rest are correct. I've changed the hostname portion of the uname section, but otherwise these are verbatim. Any help at all would be appreciated. If necessary I'll recompile Perl on the laptop with the config parameters that'll correct the problem (if I can find out what those are). Thanks for your time. Ralph ================================================== ===================== Laptop Linux returning incorrect results. ================================================== ===================== Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.20-6, archname=i686-linux uname='linux laptop.somedomain.com 2.4.20-6 #1 thu feb 27 10:06:59 est 2003 i686 i686 i386 gnulinux ' config_args='-Uinstallusrbinperl -Dprefix=/data/gatekeeper/util -des -Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O3', cppflags='-fno-strict-aliasing -I/usr/include/gdbm' ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', 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=-lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Nov 20 2003 15:24:36 %ENV: PERL5LIB="/data/gatekeeper/prod/cur_ver/lib/perl:" @INC: /data/gatekeeper/prod/cur_ver/lib/perl /data/gatekeeper/util/lib/perl5/5.8.0/i686-linux /data/gatekeeper/util/lib/perl5/5.8.0 /data/gatekeeper/util/lib/perl5/site_perl/5.8.0/i686-linux /data/gatekeeper/util/lib/perl5/site_perl/5.8.0 /data/gatekeeper/util/lib/perl5/site_perl ================================================== ===================== Desktop Linux configuration returning correct results. ================================================== ===================== Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.19-4gb, archname=i686-linux uname='linux linux-host 2.4.19-4gb #1 fri sep 13 13:14:56 utc 2002 i686 unknown ' config_args='-Uinstallusrbinperl -Dprefix=/data/gatekeeper/util -des -Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing' ccversion='', gccversion='3.2', 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=-lnsl -ldl -lm -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Jul 17 2003 20:17:04 %ENV: PERL5LIB=":/data/gatekeeper/prod/cur_ver/lib/perl" @INC: /data/gatekeeper/prod/cur_ver/lib/perl /data/gatekeeper/util/lib/perl5/5.8.0/i686-linux /data/gatekeeper/util/lib/perl5/5.8.0 /data/gatekeeper/util/lib/perl5/site_perl/5.8.0/i686-linux /data/gatekeeper/util/lib/perl5/site_perl/5.8.0 /data/gatekeeper/util/lib/perl5/site_perl ================================================== ===================== Solaris configuration returning correct results. ================================================== ===================== Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos solaris 5.8 generic_108528-11 sun4u sparc sunw,ultra-5_10 ' config_args='-Dcc=gcc -B/usr/ccs/bin/' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc -B/usr/ccs/bin/', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O', cppflags='-fno-strict-aliasing' ccversion='', gccversion='3.1', gccosandvers='solaris2.8' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib ' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -lgdbm -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under solaris Compiled at Jul 22 2002 02:55:19 %ENV: PERL5LIB=":/oss/current/rc4498/work/projects/util/usr/local/lib/perl5/site_perl/5.8.0" @INC: /oss/current/rc4498/work/projects/util/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris /oss/current/rc4498/work/projects/util/usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/5.8.0/sun4-solaris /usr/local/lib/perl5/5.8.0 /usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl ================================================== ===================== Cygwin on Windows Configuration returning correct results ================================================== ===================== Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=cygwin, osvers=1.3.22(0.7832), archname=cygwin-multi-64int uname='cygwin_nt-5.0 ismene 1.3.22(0.7832) 2003-03-18 09:20 i586 unknown unknown cygwin ' config_args='-de -Dmksymlinks -Dusemultiplicity -Duse64bitint -Doptimize=-O3 -Dman3ext=3pm' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing', optimize='-O3', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing' ccversion='', gccversion='3.2 20020927 (prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -ldb -lcrypt -lutil -lgdbm_compat perllibs=-lcrypt -lutil -lgdbm_compat libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s' cccdlflags=' ', lddlflags=' -s -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_64_BIT_INT USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under cygwin Compiled at Aug 29 2003 12:06:59 %ENV: CYGWIN="ntsec tty" @INC: /usr/lib/perl5/5.8.0/cygwin-multi-64int /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl |
Re: ambiguous results from pack
"Ralph Crawford" <stryder22204_deletethis@yahoo.com> wrote in message
news:3FFD7155.20508@yahoo.com... > I'm trying to do development on a Linux laptop to port to Solaris. > However, I've run into a pack command that's returning incorrect results > on my laptop. > > I'm using Perl 5.8.0 on all platforms. I've included the output of perl > -V also below because the problem seems to be so low level. > > Here's the command... > > perl -e 'print pack("I", 149);'|od -x > and what does this do?: perl -e 'print pack("I", 149);'|od -t x1 gnari |
Re: ambiguous results from pack
One more observation on this - I physically copied all the perl
libraries and perl binary from the working Linux (Suse) system to the laptop where the incorrect results where happening, and in spite of working correctly on the other machine, they returned the incorrect results on the laptop. That means it has nothing to do with Perl per se - it's actually a problem at the system level. Hmmm. I'd sure like to get to the bottom of this. Anyway thanks for reading this. Ralph |
Re: ambiguous results from pack
One more thing - I did an ldd on the Perl binaries on the good and bad
systems, and got this... Good System ================================================== ===== libnsl.so.1 => /lib/libnsl.so.1 (0x40023000) libdl.so.2 => /lib/libdl.so.2 (0x40038000) libm.so.6 => /lib/libm.so.6 (0x4003b000) libpthread.so.0 => /lib/libpthread.so.0 (0x4005e000) libc.so.6 => /lib/libc.so.6 (0x40073000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x40191000) libutil.so.1 => /lib/libutil.so.1 (0x401c3000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) Bad System ================================================== ===== libperl.so => /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so (0x40017000) libnsl.so.1 => /lib/libnsl.so.1 (0x40152000) libdl.so.2 => /lib/libdl.so.2 (0x40167000) libm.so.6 => /lib/tls/libm.so.6 (0x4016a000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x4018c000) libc.so.6 => /lib/tls/libc.so.6 (0x42000000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x4019a000) libutil.so.1 => /lib/libutil.so.1 (0x401c7000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000) A major difference is the bad system is using libperl.so, but I think I eliminated that when I copied the good Perl to the bad (laptop) system and the problem persisted. The only other difference I can see is that the bad (laptop) system is using math, thread and C libraries under a "tls" directory. I know TLS as the next version of SSL. Is this what this means? I tls a set of redhat specific libraries? Or? One good thing about something like this - it forces me to poke around and I inevitably learn something. Still I'd like to solve the problem. Thanks again. Sorry for all the follow-up posts. Ralph |
Re: ambiguous results from pack
"gnari" <gnari@simnet.is> wrote in message news:<btk631$mj5$1@news.simnet.is>...
> "Ralph Crawford" <stryder22204_deletethis@yahoo.com> wrote in message > news:3FFD7155.20508@yahoo.com... > > I'm trying to do development on a Linux laptop to port to Solaris. > > However, I've run into a pack command that's returning incorrect results > > on my laptop. > > > > I'm using Perl 5.8.0 on all platforms. I've included the output of perl > > -V also below because the problem seems to be so low level. > > > > Here's the command... > > > > perl -e 'print pack("I", 149);'|od -x > > > > and what does this do?: > perl -e 'print pack("I", 149);'|od -t x1 > > > gnari Actually it's perl -e 'print pack("I", 149)' | od -x Try these... perldoc -f pack man od In a nutshell pack creates a binary in-memory representation of the decimal number 149 and prints it out to the screen. Since it's binary, it's not meant to be interpretted by human eyes. So I pipe it through od (octal dump) with a -x switch so it prints it out to the screen as hexidecimal data so I can see what's actually there. Ralph |
| All times are GMT. The time now is 09:39 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.