Page MenuHomeFreeBSD

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

Authored by madpilot on Sep 30 2018, 4:02 PM.

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
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20514
Build 19942: arc lint + arc unit

Event Timeline

madpilot created this revision.Sep 30 2018, 4:02 PM
cy accepted this revision.Oct 1 2018, 6:04 AM
cy added a subscriber: cy.

lgtm

This revision is now accepted and ready to land.Oct 1 2018, 6:05 AM
cy added a subscriber: bjk.Oct 25 2018, 12:13 AM
bjk added inline comments.Oct 27 2018, 9:27 PM
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 planned changes to this revision.Oct 30 2018, 3:13 PM
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.

madpilot updated this revision to Diff 49798.Oct 30 2018, 3:22 PM
  • Use entity in place of raw XML
  • Remove unneeded 'x' hack from shell conditionals
madpilot marked 3 inline comments as done.Oct 30 2018, 3:22 PM
cy accepted this revision.Jan 9 2019, 7:41 PM
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?

cy added reviewers: bcr, bjk.Sep 3 2019, 7:29 PM

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