Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re^2: Inappropriate ioctl for device error on system call

by neilwatson (Priest)
on Dec 12, 2006 at 18:57 UTC ( #589357=note: print w/replies, xml ) Need Help??

in reply to Re: Inappropriate ioctl for device error on system call
in thread Inappropriate ioctl for device error on system call

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.$") + == 0 or die "Cannot $ENSCRIPT $fullfilename -o $TEMPDIR/$dirname.$fil $!"; 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.$ 2>$TEMPDIR/error.txt") == 0 or die "Cannot lp -d $TEMPDIR/$dirname.$ $!";
I also tried replace the output file ($TEMPDIR/$dirname.$ 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

Replies are listed 'Best First'.
Re^3: Inappropriate ioctl for device error on system call
by traveler (Parson) on Dec 12, 2006 at 19:39 UTC
    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

        In that case note that enscript may have had a non-fatal termination:
        Enscript returns value 1 to the shell if any errors were encountere +d. On successful termination, the return code is constructed from +the fol- lowing flags: 0 no errors or warnings 2 some lines were truncated or wrapped 4 some characters were missing from the used fonts 8 some characters were unprintable
        Note the On successful termination: Maybe some lines were truncated or some characters unprintable.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://589357]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-04-27 22:05 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (514 votes). Check out past polls.