rrthomas / pdfjam

The pdfjam package for manipulating PDF files
GNU General Public License v2.0
378 stars 28 forks source link

pdfjam uses `locale -k` which is not portable. #29

Open vext01 opened 4 years ago

vext01 commented 4 years ago

Hi,

pdfjam uses locale -k to try to guess the default paper size, however locale -k isn't portable.

On my OpenBSD system:

$ locale -k
locale: unknown option -- k
usage: locale [-a | -m | charmap]

If we drop -k then we get some locale-related stuff, but nothing to do with paper:

$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE=en_US.UTF-8
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=

A quick fix is to skip guessing the paper size on OpenBSD, but I wonder if there's a better way?

Thanks

DavidFirth commented 4 years ago

Many thanks for reporting this. I suppose the best fix might be one that is more general, i.e., to test first whether locale -k gives a suitable reply, and use it if so (but not otherwise).

This papersize guessing could alternatively be removed completely. (It is a relatively recent addition to pdfjam, suggested by a user; but certainly I do not ever need my computer to guess the papersize that I want when I use pdfjam, and maybe nobody else really does, either?

vext01 commented 4 years ago

Another option:

Auto-detecting paper is hard, but you could allow unified manual selection with libpaper? There's a tool called 'paperconf' that you could use.

On Sun, 4 Oct 2020, 10:30 David Firth, notifications@github.com wrote:

Many thanks for reporting this. I suppose the best fix might be one that is more general, i.e., to test first whether locale -k gives a suitable reply, and use it if so (but not otherwise).

This papersize guessing could alternatively be removed completely. (It is a relatively recent addition to pdfjam, suggested by a user; but certainly I do not ever need my computer to guess the papersize that I want when I use pdfjam, and maybe nobody else really does, either?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DavidFirth/pdfjam/issues/29#issuecomment-703228412, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAETWG4556A47YIP5RTRCVDSJA6B3ANCNFSM4R3WVW3A .