[tpm] why wouldn't violating "use warnings" always be fatal?

Brandon McCaig bamccaig at gmail.com
Mon Aug 25 22:29:04 PDT 2014


Fulko:

On Fri, Aug 22, 2014 at 2:32 PM, Fulko Hew <fulko.hew at gmail.com> wrote:
> I just got bitten by different behavior on different platforms,
> and I can't justify it. Perhaps someone out there can?
>
> Platform #1: Perl 5.8.8 on Fedora    (development system)
> Platform #2: Perl 5.8.8 on Debian    (production system)
>
> It turns out my application _did_ have a bug in it, but it wasn't
> detected during my testing when run on the dev sys, but failed
> when the same dataset was encountered on the production system.
>
> a) I have 'use strict' and 'use warnings' in my app.
> b) I had an uninitialized variable used in a print statement.
>
> On the production machine... my app died with the error:
> 'Use of uninitialized value in concatenation'
> just as you would expect.
>
> But on my dev sys, the app doesn't die, or even complain!
>
> Once I found out what was happening, I ran it under the debugger on my dev
> sys,
> and when I stepped through the print statement... It bitches and dies.
> But without the debugger,  all is (apparently) happy.
> (That's why I didn't detect and fix the bug during testing.)
>
> So...
> Why would my dev sys only flag and die under the debugger (and not with a
> normal run)?
> And why does my prod system, work correctly (ie. flag and die) ?

Even if you require 5.8.8 for legacy code or something, at least
perlbrew might help to get a more similar perl on each platform.
Technically, Linux distributions can and do patch software themselves
in ways that upstream might not deem acceptable so v5.8.8 on Debian
may have Debian-specific patches that Fedora doesn't have and
visa-versa. Typically there is a <dash><package-revision> number
added, I think, for each revision of a package (at least in Fedora).
So the version isn't just 5.8.8, but perhaps 5.8.8-3 (which is still
distro-specific) or whatever. If you actually open the system source
packages up you'll likely see notes about patches that are added.
IIRC, Fedora's packaging policy actually requires (with exceptions)
that patches be applied to upstream source during the package building
process to make it easy to understand which patches have been applied
for just such an occasion. Which means if you actually fetch the
source RPM you should find any patches inside of it. Of course, it's
also possible that environment settings are interfering... It might be
worth looking into if you can't overhaul your environments with e.g.,
perlbrew.

AFAIK, the "Use of unintialized value in concatenation" isn't actually
fatal so I'm a little bit confused about how it is killing your app,
but I'm sure there are pragmas, options, or modules that could turn
them fatal (alas I do not write Perl professionally and it has been a
few months since I've been active in the community so my Perl-fu may
be rusty in addition to green)...

> bambams at test-chamber-1:~$ perl -Mstrict -Mwarnings -E '
> >         my $bar;
> >
> >         print "foo $bar";
> >
> >         say " baz";'
> Use of uninitialized value $bar in concatenation (.) or string at -e line 4.
> foo  baz
> bambams at test-chamber-1:~$

Regards,


-- 
Brandon McCaig <bamccaig at gmail.com> <bamccaig at castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'


More information about the toronto-pm mailing list