Bug 1286270 - paperconf doen't take LC_PAPER into account
paperconf doen't take LC_PAPER into account
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: libpaper (Show other bugs)
25
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tom "spot" Callaway
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-27 12:07 EST by Grégoire
Modified: 2017-12-12 06:10 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-12-12 06:10:11 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Grégoire 2015-11-27 12:07:26 EST
Description of problem: according to the manual, paperconf should look at LC_PAPER to determine the paper size, but it doesn't work as expected.


Version-Release number of selected component (if applicable):


How reproducible: reproducible


Steps to Reproduce:
1. export LC_LOCALE=en_GB.UTF-8
2. paperconf

Actual results:
letter

Expected results:
a4

Additional info:
I checked the content of /etc/papersize:
$ cat /etc/papersize
# Simply write the paper name. See papersize(5) for possible values

And the values of PAPERSIZE and PAPERCONF (both unset)
Comment 1 Tom "spot" Callaway 2015-12-01 13:55:16 EST
LC_LOCALE isn't valid. You want LANG=.

[spot@localhost libpaper]$ paperconf
letter
[spot@localhost libpaper]$ LANG=en_GB.UTF-8 paperconf
a4
[spot@localhost libpaper]$ LANG=en_US.UTF-8 paperconf
letter

See: https://wiki.archlinux.org/index.php/Locale#Supported_variables
Comment 2 Grégoire 2015-12-01 17:40:52 EST
(In reply to Tom "spot" Callaway from comment #1)
> LC_LOCALE isn't valid. You want LANG=.
> 
> [spot@localhost libpaper]$ paperconf
> letter
> [spot@localhost libpaper]$ LANG=en_GB.UTF-8 paperconf
> a4
> [spot@localhost libpaper]$ LANG=en_US.UTF-8 paperconf
> letter
> 
> See: https://wiki.archlinux.org/index.php/Locale#Supported_variables

Sorry, I meant

 $ export LC_PAPER=en_GB.UTF-8

LC_PAPER is in the list of supported variables and it is also mentioned in the manpage for paperconf.
Comment 3 Tom "spot" Callaway 2015-12-02 11:11:39 EST
I'm not seeing that bug. On my en_US.UTF-8 system (Fedora 23 x86_64):

[spot@localhost pam.d]$ rpm -q libpaper
libpaper-1.1.24-11.fc23.x86_64
[spot@localhost pam.d]$ echo $LANG
en_US.utf8
[spot@localhost pam.d]$ echo $LC_PAPER

[spot@localhost pam.d]$ paperconf
letter
[spot@localhost pam.d]$ LC_PAPER=en_GB.UTF-8 paperconf
a4
[spot@localhost pam.d]$ export LC_PAPER=en_GB.UTF-8
[spot@localhost pam.d]$ echo $LC_PAPER
en_GB.UTF-8
[spot@localhost pam.d]$ paperconf
a4

Please reopen if you can reproduce.
Comment 4 Grégoire 2015-12-03 15:42:19 EST
Strange. I have globally the same config (fedora 23, x86_64, en_US.UTF-8) but here is what I get:

[gregoire@mbp ~]$ rpm -q libpaper
libpaper-1.1.24-11.fc23.x86_64
[gregoire@mbp ~]$ echo $LANG
en_US.UTF-8
[gregoire@mbp ~]$ echo $LC_PAPER

[gregoire@mbp ~]$ paperconf
letter
[gregoire@mbp ~]$ LC_PAPER=en_GB.UTF-8 paperconf
letter
[gregoire@mbp ~]$ export LC_PAPER=en_GB.UTF-8
[gregoire@mbp ~]$ echo $LC_PAPER
en_GB.UTF-8
[gregoire@mbp ~]$ paperconf
letter

And in addition:

[gregoire@mbp ~]$ echo $PAPERCONF

[gregoire@mbp ~]$ echo $PAPERSIZE
Comment 5 Grégoire 2015-12-03 15:58:12 EST
Ok so it seems that there is no mention of LC_PAPER in the source, which is strange because it includes the manpage which, on my system, clearly mention LC_PAPER

❯❯❯ yumdownloader --source libpaper
❯❯❯ rpm2cpio libpaper-1.1.24-11.fc23.src.rpm |cpio -idm
❯❯❯ tar xf libpaper_1.1.24+nmu3.tar.gz
❯❯❯ grep -r LC_PAPER libpaper-1.1.24+nmu3
<nothing>
Comment 6 Fedora End Of Life 2016-11-24 08:47:24 EST
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 7 Grégoire 2016-11-25 08:24:29 EST
Reproducible on Fedora 24
Comment 8 Fedora End Of Life 2017-07-25 15:34:34 EDT
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 9 Grégoire 2017-08-06 05:54:48 EDT
Reproducible on Fedora 25
Comment 10 Tom "spot" Callaway 2017-08-07 12:40:20 EDT
I cannot reproduce this any more than I originally could.

spot@localhost ~]$ rpm -q libpaper
libpaper-1.1.24-14.fc26.x86_64
[spot@localhost ~]$ paperconf
letter
[spot@localhost ~]$ rpm -q libpaper
libpaper-1.1.24-14.fc26.x86_64
[spot@localhost ~]$ echo $LANG
en_US.UTF-8
[spot@localhost ~]$ echo $LC_PAPER

[spot@localhost ~]$ paperconf
letter
[spot@localhost ~]$ LC_PAPER=en_GB.UTF-8 paperconf
a4

Also, LC_PAPER is in the source code, specifically in lib/paper.c at line 114:

   #if defined(LC_PAPER) && defined(_GNU_SOURCE)

That conditional is true in the Fedora builds.

I suspect strongly that something else is different/broken on your system and that these issues are symptoms of that. Perhaps you are using a shell other than the default bash?
You may wish to try a clean install of Fedora in a VM and trying to reproduce it there.
Comment 11 Grégoire 2017-08-20 10:33:14 EDT
Ok, so I tried to reproduce the issue in a Fedora docker container and the results are a bit odd. I ran paperconf in clean containers with Fedora 20 to 26 and with LC_PAPER being either empty,  en_US.UTF-8 or en_GB.UTF-8 and here is what I got:

Fedora 20:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: letter
        LC_PAPER=en_GB.UTF-8: a4

Fedora 21:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: a4
        LC_PAPER=en_GB.UTF-8: a4

Fedora 22:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: letter
        LC_PAPER=en_GB.UTF-8: a4

Fedora 23:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: letter
        LC_PAPER=en_GB.UTF-8: a4

Fedora 24:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: a4
        LC_PAPER=en_GB.UTF-8: a4

Fedora 25:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: letter
        LC_PAPER=en_GB.UTF-8: a4

Fedora 26:
        LC_PAPER=: a4
        LC_PAPER=en_US.UTF-8: letter
        LC_PAPER=en_GB.UTF-8: a4

First oddity: it seems that the default value is a4 and not letter. There is a possibility that my current locale is leaking into the container, but as far as I can see, neither /etc/papersize nor any environment variables are.

Now if a4 is the actual fallback, I don't think that's a bug, as it is probably a better default. Then it's just the manual that needs to be updated.

As for the current bug, it seems that it only appears in the Fedora 21 and 24 images. I've had the bug on my laptop in Fedora 23, 24 and 25 but it might have been there before and I just didn't notice.

I would like to offer an hypothesis: I'm guessing there is a file somewhere which contains the map from locales to paper sizes and that for some reason, that file is missing, incomplete or otherwise broken in the Fedora 21 and 24 docker images.

Maybe that file is also not overwritten on system upgrades and on my laptop I've been using the using the same file since a clean install of Fedora 21. It would explain why I'm still seeing the issue on Fedora 25.

I've made a git repo with my Dockerfiles if you want to try and see if you can reproduce it: https://gitlab.com/gdetrez/fedora-1286270/
Comment 12 Fedora End Of Life 2017-11-16 13:52:01 EST
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Comment 13 Fedora End Of Life 2017-12-12 06:10:11 EST
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.