Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

touch() crashes Xorg

by jbryan (Acolyte)
on Sep 29, 2012 at 03:28 UTC ( #996328=perlquestion: print w/ replies, xml ) Need Help??
jbryan has asked for the wisdom of the Perl Monks concerning the following question:

Silly me - I forgot to import File::Touch. So when I added line 85 (as seen here) my script did not exit with an "Undefined subroutine" error (as perl -e 'touch("/tmp/test")' does) - no, it rudely crashes my entire friggin X server!

The question is: why? And what am I really calling when I call touch() if I didn't use File::Touch? (The next rev on that file linked above does use File::Touch - and, wonder of wonders, X doesn't crash.) But the question remains - why in the world does calling touch() without File::Touch being used cause X to crash? (This crash happens on two different machines, both running CentOS, both running NVidia display drivers.)

My program works now that I use File::Touch, the emergency is over - now I'm just mad - mad that something simple like that causes X to crash - with no rhyme or reason, no messages in /var/log/messages, /var/log/Xorg*.log - nothing. Like I said, this is more personal pride at figuring out why than a need to fix it - the program works, now I want to know why it broke to begin with. Any pointers, wise monks?

Comment on touch() crashes Xorg
Download Code
Re: touch() crashes Xorg
by irirgem (Novice) on Sep 29, 2012 at 03:55 UTC
    Interesting question
    I don't have a direct answer, but do have some ideas...

    File::Touch uses the following sub to do the work:
    if (-e $file){ my $sb = stat($file) or croak("Could not stat ($file): $!"); $atime = $sb->atime; $mtime = $sb->mtime; } else { unless ($self->{_no_create}){ sysopen my $fh,$file,$SYSOPEN_MODE or croak("Can't create $fil +e : $!"); close $fh or croak("Can't close $file : $!"); $atime = $time; $mtime = $time; } }
    ExtUtils::Command uses:
    sub touch { my $t = time; expand_wildcards(); foreach my $file (@ARGV) { open(FILE,">>$file") || die "Cannot write $file:$!"; close(FILE); utime($t,$t,$file); } }
    However I can't seem to find what touch() is being used in the case above, but as you can see, the two modules above use a different method to do the work... maybe in that lies the mystery.
      Interesting - thanks for showing that code. However, as far as I know, until I added 'use File::Touch', neither of those modules were in use - and nothing (that I know of) should have exported a symbol called 'touch' into my namespace.

      I guess the question might be - is there some debug/devel tool that I can use to tell me what I would call if I called touch in that context? E.g. perhaps the source file that the symbol originates from?

Re: touch() crashes Xorg
by Anonymous Monk on Sep 29, 2012 at 06:25 UTC

    calling touch() without File::Touch being used cause X to crash?

    Because you have bad RAM? Ancient unsupported perl version? Ancient unsupported OS version? Something else?

    Crash isn't specific enough :)

      You're absolutely right - crash is not specific enough. My apologies. To be specific, I have no logs that show any details of the "crash" as I call it - I can only tell you exactly what I observe.

      1. I run my script (perl tests/propogate.t)
      2. Script starts (output on STDOUT observed)
      3. Entire display goes black
      4. NVIDIA logo appears (using nvidia drivers)
      5. Gnome login manager appears, prompting me to login
      6. I login to Gnome again, open konsole and cd to devel directory again
      7. Go back to 1 - process is 100% repeatable

      A couple of notes:

      • To find out that it was the call to touch() causing the crash, I reverted to previous rev of the file and re-added in lines one-by-one till the "crash" occurred
      • This occurs on a quite-recent version of Perl (5.10.1)
      • This happens not just on this machine, but on two other machines at exactly the same spot. (The only commonality I can find is all three use "name-brand" NVIDIA display drivers. All three run CentOS, but each a slightly different version. All CentOS versions > 5.1)

      If it was just one machine, I might submit to the bad RAM theory - but three machines, all in the same spot? (Two desktops, one laptop.)

        Can you post a small script that reproduces the error? That might help us to see what the issue is, or at least to be able to reproduce it.

        --MidLifeXis

Re: touch() crashes Xorg
by Anonymous Monk on Sep 29, 2012 at 16:02 UTC
    Lacking log, have you run tried getting output via ktrace (in FreeBSD at least), ltrace, strace, trace-cmd, truss, and the like?
      My knowledge and awareness of such commands is limited at best. I shall go forth and Google. Thanks for the arrow toward enlightenment, mate!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://996328]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2014-10-31 18:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (223 votes), past polls