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)
Oct 10 2024, 11:32 PM
Unknown Object (File)
Oct 9 2024, 5:51 PM
Unknown Object (File)
Oct 7 2024, 3:40 AM
Unknown Object (File)
Oct 6 2024, 10:35 AM
Unknown Object (File)
Oct 3 2024, 5:05 AM
Unknown Object (File)
Oct 2 2024, 11:45 PM
Unknown Object (File)
Sep 22 2024, 8:59 AM
Unknown Object (File)
Sep 6 2024, 1:01 AM
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.)