lp and lpr "stdin is empty"

lyamimlgnqfa at spammotel.com lyamimlgnqfa at spammotel.com
Fri Oct 29 16:36:16 UTC 2004


I just upgraded to Fedora core 2 from core 1, and now lp and lpr
cannot read from standard input.

[allan at mybox bin]$ /usr/bin/lp < /etc/hosts
lp: stdin is empty, so no job has been sent.
[allan at mybox bin]$ /usr/bin/lp /etc/hosts
request id is laserjet-977 (1 file(s))

Printing a file works, but as you see printing from a pipe was busted,
and so any programs that relied on pipes were SOL.  I did notice a
nonexistent printer in the /etc/cups/lpoptions file, and I fixed that.

Strange though that only printing a file works.

I wrote a workaround perl script, and noticing that /usr/local/bin was
in the path before /usr/bin, I put it there as a wrapper for the real
lp and lpr programs.  At least I can print now. Any thoughts?

Here is my workaround, I named it lp, and symlinked it to lpr:

> #!/usr/bin/perl
> # -*- cperl -*-
>
> # quick wrapper around lp for stdin bug
> # pedaa_at_rockefeller.edu
> # Time-stamp: <2004-10-29 12:15:44 allan>
> use strict;
> use Carp;
> use File::Temp qw( tempfile );
> use File::Basename qw(basename );
> my $LPEXE = "/usr/bin/".basename( $0 );
>
> # if given stdin, buffer to file, else call prog directly
> unless( defined($ARGV[$#ARGV]) and (-f $ARGV[$#ARGV]) ){
>     my $fbuff = new File::Temp( TEMPLATE => 'lpXXXXX',
> 				DIR => '/tmp',
> 				SUFFIX => '.cups' );
>
>     print $fbuff <STDIN>;
>     system( $LPEXE, @ARGV, $fbuff );
> } else {
>     exec( $LPEXE, @ARGV );
> }







More information about the fedora-list mailing list