Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Inappropriate ioctl for device using Phi.pm on system call

by To_Bz (Novice)
on May 19, 2014 at 22:19 UTC ( [id://1086722]=perlquestion: print w/replies, xml ) Need Help??

To_Bz has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I'm getting the following error message from a perl module called Phi.pm.

I can not execute the PHI test: Phi: Inappropriate ioctl for device at /biologia-scratch3/mc.martinez297/programs/Unus-master/Unus/Test/Phi.pm line 63

First, I thought it was a problem related with permissions, so I changed them. This module has read and execution permissions.

So, then I looked the line 63, and I have the following:


61 chdir "$aln.phi";
62 system "$phi -f '$aln' &>$aln.phi/Phi.out";
63 LOGDIE "I can not execute the PHI test: $phi:\n$!" unless $?==0;
64 -s "Phi.log" or LOGDIE "PHI test ($phi -f '$aln' &>$aln.phi/Phi.out) returned an empty output, please check '$aln.phi/Phi.out' to inspect the reason s.";

I read the recomendations in http://www.perlmonks.org/?node_id=589324 , and they recommended to erase $! but I don't know what to do with $?==0, since $! and $? are "different types of error conditions"(http://perldoc.perl.org/perlvar.html)

However, I still don't understand what is happening with these variables.

I'm new in Perl, so I'll appreciate the help

  • Comment on Inappropriate ioctl for device using Phi.pm on system call

Replies are listed 'Best First'.
Re: Inappropriate ioctl for device using Phi.pm on system call
by GotToBTru (Prior) on May 19, 2014 at 22:38 UTC

    You need to find out what was in the variable $phi when then system command was run on line 62. That is the program that is generating the error.

    1 Peter 4:10
Fix $? check
by dolmen (Beadle) on May 23, 2014 at 08:55 UTC

    First, never put execution permission on a .pm!

    For the probable cause of your error, have a look at the manual for the "system" function (perldoc -f system):

    If you'd like to manually inspect "system"'s failure, you can check all possible failure modes by inspecting $? like this:
                       if ($? == -1) {
                           print "failed to execute: $!\n";
                       }
                       elsif ($? & 127) {
                           printf "child died with signal %d, %s coredump\n",
                               ($? & 127),  ($? & 128) ? 'with' : 'without';
                       }
                       else {
                           printf "child exited with value %d\n", $? >> 8;
                       }
    
Re: Inappropriate ioctl for device using Phi.pm on system call
by aitap (Curate) on May 25, 2014 at 10:26 UTC

    "Inappropriate ioctl for device" is not the cause of the error since you don't do any ioctl yourself on any device. $! sometimes gets set so a non-zero value even if program works normally (for example, on my machine perl -E'require DBI; say $!' prints No such file or directory).

    What you need to do is to inspect the $aln.phi/Phi.out file (it's where PHI's STDOUT ans STDERR were redirected). You can edit line 63 to print $? and $aln.phi if you need to know their values.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1086722]
Front-paged by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found