tty error

Marshall Dudley mdudley@execonn.com
Mon Apr 2 23:00:01 2001


I have gpg installed and working from the command line.  I am attempting
to invoke it from a perl script using Gunther Birznieks's pgp-lib.pl
library.

I had to make a couple of modifications to make gpg happy with the
script, and have fixed all reported errors, except for this one:

gpg: cannot open /dev/tty: Device not configured

I am not quite sure what to make of this message, having never
encountered one like it before.  I have checked with the FAQ and other
resources on the gpg site, but can find no references to this error.

This is what the system says about the /dev/tty

# ls -l /dev/tty
crw-rw-rw-  1 root  wheel    1,   0 Apr  2 12:29 /dev/tty

I believe the problem may be associated with the redirection that this
library routine does, but I can find nothing wrong with the script.

$output file is set to /tmp/[userpid].pgp prior to this code, and the
above error is getting written into this file, which is even more
curious, since if it could not output, how is it writing the file. So it
may be complaining about the input instead.

Here is the applicable code:
---------------------------------------------------
local($old_path) = $ENV{"PATH"};
$ENV{"PATH"} = "";
print "output file = $output_file<p>";
open (SAVEERR, ">&STDERR") || die ("Could not capture STDERR");
open (SAVEOUT, ">&STDOUT") || die ("Could not capture STDOUT");
open (STDOUT, ">$output_file");
open (STDERR, ">&STDOUT");

$pid = open (PGPCOMMAND, "|$pgp_command") or die print "$! opening pipe
to $pgp_commnad<p>";

$ENV{"PATH"} = $old_path;

# The text you want to encrypt is sent to
# the command.

print PGPCOMMAND $output_text;

close (PGPCOMMAND);

close (STDOUT) || die ("Error closing STDOUT");
close (STDERR) || die ("Error closing STDERR");
open(STDERR,">&SAVEERR") || die ("Could not reset STDERR");
open(STDOUT,">&SAVEOUT") || die ("Could not reset STDOUT");
close (SAVEERR) || die ("Error closing SAVEERR");
close (SAVEOUT) || die ("Error closing SAVEOUT");

# The resulting output file is opened,
# read into $pgp_output and closed.

open(PGPOUTPUT, $output_file) or die print "<p>$! opening $output_file
from pgp<p>";
-------------------------
Anyone have any ideas?

Thanks,

Marshall