locale and libpaper

View: New views
1 Messages — Rating Filter:   Alert me  

locale and libpaper

by Ralph Giles :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Marcos,

I tracked down what was going on with the default paper sizes. If
configure detects that libpaper is available it will use it to
implement .defaultpapersize, and this is used to override the device
default (generally 'letter'). Now, on my system, when I installed
libpaper, the package didn't set a system-wide default in
/etc/papersize, and neither did I. In this case, libpaper obtains the
paper size from the locale machinery.

And this is where we go wrong. My locale (and the one the regression
is running under) is set to en_US.UTF-8, which would give a paper size
of 'letter'. However, the locale system is something one has to opt
into by calling setlocale() and ghostscript does not do this. By
default, applications are started in the "C" locale to avoid
unexpected side-effects and, on my system, that gives a default paper
size of 'a4'. That's how the default was different. Locale-aware
applications all gave the expected paper size because they read my
locale from the environment and used that. For example:

  $ paperconf
  letter
  $ LC_PAPER=C paperconf
  a4
  $ LC_PAPER=en_US paperconf
  letter
  $ LC_PAPER=en_UK paperconf
  a4

I was surprised that the "C" locale has a4 as the default. But even if
that's not correct, the libpaper machinery is behaving properly, and
this is something we need to control for in testing. Therefore I
suggest for regression runs that you both:

* pass --without-libpaper to configure when building for the cluster;

this will test a different path from normal use as well as prevent the
.defaultpapersize override. And

* pass -sPAPERSIZE=letter (or a4) to gs when running the actual
regression tests;

this will be clear about what we're checking and foster consistency
with manual runs.

There are actually two ps options we can use: -sPAPERSIZE and
-sDEFAULTPAPERSIZE. The later accepts only 'letter' and 'a4' as
possible values. If not set on the command line or in gs_init.ps,
DEFAULTPAPERSIZE will be set to the output of .defaultpapersize, if
that command returns a value and the value is a known page type. So
libpaper is only invoked to set the default if it is otherwise unset,
and on systems with libpaper, the default is always set. The PAPERSIZE
option overrides whatever that default is, and both are overridden by
any page size the document itself sets. I think therefore the two
options are equivalent for regression purposes, and so it's better to
use -sPAPERSIZE because it's the more user-level option and shorter.

Hopefully this will get the diff churn under control in the local
cluster regression runs.

Cheers,
 -r
_______________________________________________
gs-devel mailing list
gs-devel@...
http://www.ghostscript.com/mailman/listinfo/gs-devel