linuxmint / linuxmint/mintlocale

PAPERSIZE is hardcoded to a4 and overrides the paper size of the chosen region

Open
#104 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
19
Forks
20
Avg merge
18d 5h
Merged PRs (30d)
2

Description

mintlocale writes PAPERSIZE=a4 into ~/.pam_environment and ~/.xsessionrc (the two templates/*_pam_environment.template files, plus mintlocale.py:777 and mintlocale.py:823 when the variable is not there yet). The value is hardcoded and never follows the region, which the same files set through LC_PAPER=$region.

Since PAPERSIZE in the environment takes precedence over everything else libpaper looks at, that hardcoded a4 wins over the paper size the region implies. Someone in the US or Canada who picks their own region in mintlocale ends up with LC_PAPER saying Letter and PAPERSIZE saying A4, and A4 is what programs get.

What I checked

LC_PAPER does carry the right size, per glibc (Debian unstable chroot):

$ LC_PAPER=en_US.UTF-8 locale -k LC_PAPER
height=279 width=216 paper-codeset="UTF-8"        # Letter
$ LC_PAPER=it_IT.UTF-8 locale -k LC_PAPER
height=297 width=210 paper-codeset="UTF-8"        # A4

Debian unstable and trixie (libpaper 2.2.5). paper(1) documents the order as PAPERSIZE$XDG_CONFIG_HOME/papersize → the current locale's paper size → /etc/papersize, so the locale is consulted, but only if PAPERSIZE is unset:

$ LC_PAPER=en_US.UTF-8 paper
Letter: 8.5x11 in
$ LC_PAPER=en_US.UTF-8 PAPERSIZE=a4 paper
A4: 210x297 mm

Ubuntu 26.04 LTS, so the base of Mint 23, carries libpaper 2.2.5 as well (2.2.5-0.3maysync1, whose only difference from Debian's 2.2.5-0.3 is a build fix), so it behaves the same way. libpaper 1 stops at Ubuntu 24.04.

Linux Mint 22.x and Ubuntu 24.04 (libpaper 1.1.29). This version ignores the locale altogether, but PAPERSIZE still overrides the system default in /etc/papersize:

$ cat /etc/papersize
letter
$ paperconf
letter
$ PAPERSIZE=a4 paperconf
a4

So on Debian and on Mint 23 the hardcoded value overrides the region, and on Mint 22.x it overrides whatever the system was configured with.

Possible fixes

Dropping PAPERSIZE from both files looks like the right thing wherever libpaper 2 is in use, which now means Debian and Mint 23 alike: LC_PAPER is already set from the region and libpaper picks it up on its own. On Mint 22.x it would mean falling back to /etc/papersize, which is a change in behaviour, so it is your call whether that is acceptable there.

Otherwise the value can be derived instead of hardcoded: read LC_PAPER for the chosen region and write letter when its height is 279 mm, a4 otherwise.

Either way I am happy to send a PR once you have said which of the two you prefer.


EDIT:

Prior report

#79 is the same defect seen from the user side, on Mint 21.1: LC_PAPER=en_CA.UTF-8 together with PAPERSIZE=a4 while /etc/papersize said letter, and "every piece of software I am running defaults to A4 paper size before I set it right". It got no answer and the stale bot closed it in April 2026.

Ubuntu already derives it

The second option above is what Ubuntu settled on for the same problem in 2013, in LP #1130690 ("Default papersize should be in sync with regional formats"). Their accountsservice ships /usr/share/language-tools/locale2papersize, which is the whole of the logic:

export LC_PAPER=$1
height=$( locale height )
width=$( locale width )
if [ "$height" = 279 -a "$width" = 216 ]; then
    size=letter
else
    size=a4
fi

save-to-pam-env writes PAPERSIZE from its output, and language-selector updates /etc/papersize when the formats are applied system wide. On Mint 22.3 the helper is present (accountsservice 23.13.9-2ubuntu6.1) and answers letter for en_CA and en_US, a4 for en_GB and it_IT.

It is an Ubuntu delta, though: Debian's accountsservice (23.13.9-8+b2 in unstable) does not ship it, so mintlocale cannot call it and would have to carry those few lines itself. locale -k LC_PAPER gives the same two numbers on either distribution.

That precedent also suggests a system-wide counterpart, if you want the parity: Apply System-Wide could write /etc/papersize too, which is the file libpaper 1 reads on Mint 22.x and libpaper 2 falls back to.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the two templates/*_pam_environment.template files and mintlocale.py around lines 777 and 823, then reproduce the PAPERSIZE and LC_PAPER precedence with the locale and paper commands shown. Confirm the preferred behavior with maintainers, implement the agreed handling for regional paper sizes, and verify that selected regions no longer produce conflicting values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.