Bug 99896

Summary: [patch] lpr(1): lpr -r flag has no effect
Product: Base System Reporter: George Mitchell <george>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Open ---    
Severity: Affects Only Me Keywords: patch
Priority: Normal    
Version: 5.3-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description George Mitchell 2006-07-08 00:50:16 UTC
The -r flag (remove file after printing) of lpr has no effect.

Fix: Apply the following patch:

How-To-Repeat: 	cp <existing text file> foo.txt
	lpr foo.txt
	After file prints, observe that foo.txt still exists.
Comment 1 George Mitchell 2006-07-11 20:54:40 UTC
In the example given of how to reproduce, I made a typo.  The example
should read as follows:

	cp <existing text file> foo.txt
	lpr -r foo.txt
	After file prints, observe that foo.txt still exists.

-- George Mitchell
Comment 2 George Mitchell 2006-08-01 22:08:50 UTC
To complete this fix, lprm also needs a patch as follows:

--- usr.sbin/lpr/common_source/rmjob.c.orig     Thu Dec 30 16:36:28 2004
+++ usr.sbin/lpr/common_source/rmjob.c  Sun Jul 30 18:14:01 2006
@@ -206,7 +206,7 @@
         while (getline(cfp)) {
                 switch (line[0]) {
                 case 'U':  /* unlink associated files */
-                       if (strchr(line+1, '/') || strncmp(line+1, "df", 2))
+                       if (strncmp(line+1, "df", 2))
                                 break;
                         do_unlink(line+1);
                 }
Comment 3 Brooks Davis freebsd_committer freebsd_triage 2006-08-14 23:02:34 UTC
Responsible Changed
From-To: freebsd-bugs->gad

gad requests review of lpr changes so pass to him.
Comment 4 Garance A Drosehn freebsd_committer freebsd_triage 2006-08-14 23:36:38 UTC
I will need to review the original code, and make sure
this is the right fix.  '-r' did used to work, but it
was disabled for security reasons.  See revision 1.5 at

http://cvsweb.freebsd.org/src/usr.sbin/lpr/common_source/rmjob.c

(it fixed a CERT advisory at the time, back in 1997).
I *think* I made some other changes which should make
this safer to do now, but I have to be sure about that.

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:55 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 6 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:35:40 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>
Comment 7 George Mitchell 2022-10-17 17:40:24 UTC
Perhaps this bug should be closed due to lack of interest?