Page MenuHomeFreeBSD

Update Handbook printing smart filter example to use file(1)
AcceptedPublic

Authored by madpilot on Sep 30 2018, 4:02 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 10:28 PM
Unknown Object (File)
Oct 31 2023, 11:18 AM
Unknown Object (File)
Aug 4 2023, 7:40 AM
Unknown Object (File)
Jul 14 2023, 6:48 AM
Unknown Object (File)
May 20 2023, 4:08 AM
Unknown Object (File)
May 19 2023, 11:59 PM
Unknown Object (File)
Apr 20 2023, 5:10 PM
Unknown Object (File)
Apr 8 2023, 10:00 PM
Subscribers

Details

Reviewers
cy
bcr
bjk
Summary

A discusion on the svn-ports-all mailing list [1] prompted me to propose an update to the sample script with some changes I've been using for years.

Instead of using shell expressions to detect postscript files, I'm leveraging file(1) to get a MIME type and take action based on that.

The updated example uses only parts included in the base install.

I think this makes up for a better example and a better actual script since it is cleaner and much more versatile. Extending it for a new format can be done by simply adding a new elif with the correct mime type.

For example the actual script I'm using also has a line to convert PDF files to postscript using ghostscript. That's because while my printer claims to be able to print from postscript directly, it actually crashes with most PDF files.

Hope this change can be accepted in the handbook.

[1] https://lists.freebsd.org/pipermail/svn-ports-all/2018-September/195057.html

Test Plan

Tested rendering the Handbook with these changes.

Diff Detail

Repository
rD FreeBSD doc repository - subversion
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 20514
Build 19942: arc lint + arc unit

Event Timeline

cy added a subscriber: cy.

lgtm

This revision is now accepted and ready to land.Oct 1 2018, 6:05 AM
en_US.ISO8859-1/books/handbook/printing/chapter.xml
779

I think we would more often use the &man.file.1; entity than raw XML like this.

The security professional in me is reluctant to recommend the usage of file(1) on potentially untrusted input while running in a privileged environment, but from a documentation point of view that tool is a more correct/abstraction-preserving interface to the needed information, so I will let it be.

795

The 'x' hack has not been needed for a long time.

madpilot added inline comments.
en_US.ISO8859-1/books/handbook/printing/chapter.xml
779

I think we would more often use the &man.file.1; entity than raw XML like this.

I'll modify the reference.

  • Use entity in place of raw XML
  • Remove unneeded 'x' hack from shell conditionals
This revision is now accepted and ready to land.Jan 9 2019, 7:41 PM

Regarding this review, do I have permission to commit to the doc tree?

Or do I need some special guidance/authorization?

Added two doc committers as reviewers. They can approve. (I have only src and ports commit bits.)