Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Inappropriate ioctl for device error on system call

by traveler (Parson)
on Dec 12, 2006 at 16:45 UTC ( [id://589324]=note: print w/replies, xml ) Need Help??


in reply to Inappropriate ioctl for device error on system call

It is possible that your $fullfilename does not exist. You are trying to open ./dpi.2006-12-12+/iip8061211. If that does not exist, enscript will try to processess stdin which may not be a tty on your process. Also ensure that your output file can be created.

Replies are listed 'Best First'.
Re^2: Inappropriate ioctl for device error on system call
by neilwatson (Priest) on Dec 12, 2006 at 18:57 UTC
    The $fullfilename exists. There are some commands that run earlier that work fine:
    # Unzip file here system("gunzip $fullfilename") == 0 or die "Cannot gunzip $fullfilename $!"; open FH, "file $fullfilename | " or die "Cannot open fullfilename: $fullfilename $!"; my $filetype = <FH>; close FH; if ($filetype =~ /ASCII/ || $filetype =~ /ISO-8859/) { latex_template("$dirname/print.files.txt", $filename, $data[2]); system("latex banner.$$.tex") == 0 or die "Cannot latex banner.$$.tex $!"; system("dvips banner.$$.dvi -o banner.$$.ps") == 0 or die "Cannot dvips banner.$$.dvi $!"; if ( -e $fullfilename ){ print "File to be enscripted ($fullfilename) exists"; } system("$ENSCRIPT $fullfilename -o $TEMPDIR/$dirname.$filename.ps") + == 0 or die "Cannot $ENSCRIPT $fullfilename -o $TEMPDIR/$dirname.$fil +ename.ps: $!"; system("lp -d $PRINTER_NAME banner.$$.ps 2>$TEMPDIR/error.txt") == +0 or die "Cannot lp -d banner.$$.ps $!"; system("lp -d $PRINTER_NAME -n $num_copies -q $job_priority $page_l +ist $TEMPDIR/$dirname.$filename.ps 2>$TEMPDIR/error.txt") == 0 or die "Cannot lp -d $TEMPDIR/$dirname.$filename.ps $!";
    I also tried replace the output file ($TEMPDIR/$dirname.$filename.ps) with a known good location. The enscript command actually does create the postscript file. This makes the existence of the error that much more confusing.

    Neil Watson
    watson-wilson.ca

      Some more troubleshooting hints:

      Does it run from the command line? If so, perl is probably not giving expected access to some filehandle.

      Try tracing it with strace. You can do it from the command line if the command version fails, or from perl by adding it to the system call. It can generate a lot of output but may show what file descriptor is causing the problem.

        The enscript command does work from the command line and in the perl script. For some reason it seems that the  == 0 or die section evaluates to the die. I do not know why considering that the other system calls work without dying. Also, I checked the $! variable after earlier system calls and the contents was already "Inappropriate ioctl for device" so it seems that this message may not be related.

        Neil Watson
        watson-wilson.ca

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://589324]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found