Closed p5pRT closed 12 years ago
08:05 \< dngor> Here's an example of Perl\, pointer arithmetic\, and segfaulting: perl -wle 'print unpack("P4"\,pack("L"\,~0));' 08:08 \<%cj> $ perl -wle 'print unpack("P4"\,pack("L"\,~0));' && echo $? 08:08 \<%cj> 0 08:08 \<%cj> but on solaris: 08:09 \<%cj> $ perl -wle 'print unpack("P4"\,pack("L"\,~0));' && echo $? 08:09 \<%cj> Segmentation Fault 08:11 \< dnm> $ uname -srm ; perl -wle 'print $];print unpack("P4"\,pack("L"\,~0));' 08:11 \< dnm> Linux 2.6.29.3 i686 08:11 \< dnm> 5.010000 08:11 \< dnm> Segmentation fault 08:22 \<%cj> dnm: ah\, i686
(turns out the one which worked [the system details below] is 'Linux 2.6.28-11-generic x86_64' and the solaris is 'SunOS 5.9 sun4u')
On Wed\, May 20\, 2009 at 08:57:26AM -0700\, C.J. Adams-Collier (via RT) wrote:
08:09 \<%cj> $ perl -wle 'print unpack("P4"\,pack("L"\,~0));' && echo $? 08:09 \<%cj> Segmentation Fault
So\, you are creating a pointer whose value is 0xffffffff (or longer for 64-bit)\, then trying to access a 4-character string at that address\, which gives a SEGV. What behaviour were you expecting?
-- "Emacs isn't a bad OS once you get used to it. It just lacks a decent editor."
The RT System itself - Status changed from 'new' to 'open'
a handoff to die() or some other friendly-like\, non-broken failure
On Fri\, May 22\, 2009 at 8:33 AM\, Dave Mitchell \davem@​iabyn\.com wrote:
On Wed\, May 20\, 2009 at 08:57:26AM -0700\, C.J. Adams-Collier (via RT) wrote:
08:09 \<%cj> $ perl -wle 'print unpack("P4"\,pack("L"\,~0));' && echo $? 08:09 \<%cj> Segmentation Fault
So\, you are creating a pointer whose value is 0xffffffff (or longer for 64-bit)\, then trying to access a 4-character string at that address\, which gives a SEGV. What behaviour were you expecting?
-- "Emacs isn't a bad OS once you get used to it. It just lacks a decent editor."
On Fri\, May 22\, 2009 at 10:07:10AM -0400\, C.J. Adams-Collier wrote:
a handoff to die() or some other friendly-like\, non-broken failure
Which is essentially impossible to do portably.
On Fri\, May 22\, 2009 at 8:33 AM\, Dave Mitchell \davem@​iabyn\.com wrote:
On Wed\, May 20\, 2009 at 08:57:26AM -0700\, C.J. Adams-Collier (via RT) wrote:
08:09 \<%cj> $ perl -wle 'print unpack("P4"\,pack("L"\,~0));' && echo $? 08:09 \<%cj> Segmentation Fault
So\, you are creating a pointer whose value is 0xffffffff (or longer for 64-bit)\, then trying to access a 4-character string at that address\, which gives a SEGV. What behaviour were you expecting?
-- "Emacs isn't a bad OS once you get used to it. It just lacks a decent editor."
-- This is a great day for France! -- Nixon at Charles De Gaulle's funeral
@cpansprout - Status changed from 'open' to 'rejected'
Migrated from rt.perl.org#65862 (status was 'rejected')
Searchable as RT65862$