develooper Front page | perl.perl5.porters | Postings from November 2003

Re: $^E bug and perl 5.8.0

Thread Previous | Thread Next
Dan Sugalski
November 19, 2003 08:44
Re: $^E bug and perl 5.8.0
Message ID:
On Wed, 19 Nov 2003, Chris Nandor wrote:

> However, the code above is broken anyway, as Dan might point out, since
> $error_handler COULD contain syscalls, so I am modifying this particular
> code to set $^E right before the return, and use a lexical var for the
> other stuff.  That fixes the immediate problem, and it is more robust in
> case $error_handler does contain a syscall.

I was insufficiently pedantic -- it's not just system calls that can
change errno (just checked). Any C library function can do so. Including,
unfortunately, malloc. Luckily there's right-to-left ordering of
evaluation (more or less) so "$foo = $!;" will be OK. Anything fancier,
though, that could involve a function call (including plain
stringification) may not be. Bring on the Heisenbugs!

I think I'll take steps to make this less likely for Parrot, though I'm
not sure there's truly any good way to get around it anywhere but in the
actual application code.


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai                         have teddy bears and even
                                      teddy bears get drunk

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About