Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Sep 2009 23:31:30 +0200
From:      Jilles Tjoelker <jilles@stack.nl>
To:        Steve Kargl <sgk@troutmask.apl.washington.edu>
Cc:        gavin@freebsd.org, freebsd-current@freebsd.org, brian@freebsd.org
Subject:   Re: Revision 196634 of sh(1) breaks lp(1)
Message-ID:  <20090926213130.GA88702@stack.nl>
In-Reply-To: <20090926185128.GA53658@troutmask.apl.washington.edu>
References:  <20090926185128.GA53658@troutmask.apl.washington.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Sep 26, 2009 at 11:51:28AM -0700, Steve Kargl wrote:
> troutmask:sgk[208] cat .cshrc | lp -d pug
> /usr/bin/lpr: cannot access 

> troutmask:sgk[209] uname -a
> FreeBSD troutmask.apl.washington.edu 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r197195M:
> Mon Sep 14 11:11:46 PDT 2009
> kargl@troutmask.apl.washington.edu:/usr/obj/usr/src/sys/SPEW  amd64

The problem seems not because of r196634 of sh(1), but because of
r194171 of lp(1) (see also PR standards/129554). As of that revision,
lp passes an empty filename to lpr if the new -t option is not used.
lpr cannot access that file and prints the error message.

The attached patch should fix the issue, and should also avoid invalid
arguments to lpr if an empty title is given.

I use CUPS and not FreeBSD lpr so I just checked that the lpr command
looks right in sh -x.

-- 
Jilles Tjoelker

--+QahgC5+KEYLbs62
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="lp-notitle.patch"

Index: usr.sbin/lpr/lp/lp.sh
===================================================================
--- usr.sbin/lpr/lp/lp.sh	(revision 197481)
+++ usr.sbin/lpr/lp/lp.sh	(working copy)
@@ -70,7 +70,7 @@
 	s)			# (silent option)
 		: ;;
 	t)			# title for banner page
-		title="-J${OPTARG}";;
+		title="${OPTARG}";;
 	*)			# (error msg printed by getopts)
 		exit 2;;
 	esac
@@ -78,4 +78,4 @@
 
 shift $(($OPTIND - 1))
 
-exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} "${title}" "$@"
+exec /usr/bin/lpr "-P${dest}" ${symlink} ${ncopies} ${mailafter} ${title:+-J"${title}"} "$@"

--+QahgC5+KEYLbs62--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090926213130.GA88702>