Page MenuHomeFreeBSD

lpr: remove a.out binary detection
ClosedPublic

Authored by brooks on Apr 13 2022, 4:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 21, 3:25 PM
Unknown Object (File)
Jan 17 2024, 8:25 AM
Unknown Object (File)
Jan 14 2024, 8:37 AM
Unknown Object (File)
Jan 4 2024, 6:31 AM
Unknown Object (File)
Jan 4 2024, 6:19 AM
Unknown Object (File)
Jan 1 2024, 8:09 PM
Unknown Object (File)
Dec 25 2023, 1:41 PM
Unknown Object (File)
Dec 19 2023, 3:41 PM
Subscribers
None

Details

Summary

Since the first unattributed commit in 1981, lpr has attempted to
prevent users from printing executables (and in earlier versions
archives). Archive detection was lost in 1992 when lpr gained a
dependency on a.out.h. No corresponding support was added for ELF files
with the full transiation to ELF in 1998, but a.out support has been
dragged forward to and contaminated platforms that never supported
a.out.

While this feature isn't unuseful, preventing the printing of
a single file format we stopped producing ~20 years ago isn't worth
the costs (however minimal).

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

brooks created this revision.
imp accepted this revision.EditedApr 13 2022, 5:02 PM

I'd prefer this grew support for ELF, but honestly the main reason for it has passed so maybe not...
It was originally to save university departments from losing boxes of paper when the random stuff was printed...
These days, that doesn't happen much at all because ascii printing is basically dead... it's all PS, PDF or some proprietary binary format.
As such, it's likely better to just remove it like you've done...
While one can make a case for a.out support (or not), even granting a.out support is a good thing, this isn't needed for that and it isn't useful anymore...

This revision is now accepted and ready to land.Apr 13 2022, 5:02 PM

While this idea seems generally sensible disallowing specifically and only a.out isn't.

The basic goal of refusing to print files which will be a problem on the printer is still a valuable one, but this specific and ancient check is serving no purpose. It's fine with me to remove it.

I'll also note that checks like this would be best done in the printjob processing in lpd, because formats which work perfectly fine for one model of printer will generate hundreds of pages of utterly useless output on a different model of printer. So the lpr command can't really say whether a given file will be a problem for a given print queue.

And just as a historical note, this *used* to be very helpful, because we'd have students working on some c-based homework assignment, and they'd cd into the directory holding all the source code and then type lpr * to print the source code .... and the executables produced by that source code.

This revision was automatically updated to reflect the committed changes.