bin/99896: lpr -r flag has no effect

George Mitchell george at
Fri Jul 7 23:50:17 UTC 2006

>Number:         99896
>Category:       bin
>Synopsis:       lpr -r flag has no effect
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 07 23:50:16 GMT 2006
>Originator:     George Mitchell
>Release:        FreeBSD 5.3-RELEASE i386
Mitchell Voting Products, Inc.
All versions of FreeBSD, 4.0 through 6.1
System: FreeBSD 5.3-RELEASE FreeBSD 5.3-RELEASE #2: Fri Jul 15 22:25:47 PDT 2005 george at i386

The -r flag (remove file after printing) of lpr has no effect.
	cp <existing text file> foo.txt
	lpr foo.txt
	After file prints, observe that foo.txt still exists.
	Apply the following patch:

--- usr.sbin/lpr/lpd/printjob.c.orig	Wed Aug 20 20:43:48 2003
+++ usr.sbin/lpr/lpd/printjob.c	Fri Jul  7 16:31:47 2006
@@ -583,8 +583,11 @@
 		case 'U':
+#if 0
 			if (strchr(line+1, '/'))
+/* This code negates the -r flag! */
 			(void) unlink(line+1);

More information about the freebsd-bugs mailing list