🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.debian.bugs.dist
1 messages
1 total messages Started by Allen Nonymous Wed, 07 Oct 2026 02:20
Bug#1150204: /usr/sbin/paperconfig: PAPERSIZE in paperconfig clashes with PAPERSIZE in paper(1)
#4
Author: Allen Nonymous
Date: Wed, 07 Oct 2026 02:20
111 lines
4986 bytes
Package: libpaper-utils
Version: 2.2.5-0.3+b2
Severity: normal
File: /usr/sbin/paperconfig

The /usr/sbin/paperconfig script uses an internal shell variable
named PAPERSIZE, which contains the full path to a papersize file.
This usage conflicts with the environment variable of the same name,
which according to the paper(1) man page, does not contain such a path,
but instead contains the name of a particular media size to be used.
The collision can be demonstrated with a simple sequence of commands:

    #!/bin/bash

    # Simple setup, to clarify the output.
    PATH=/usr/bin:/usr/sbin
    LINE=--------------------------------

    # Log the commands used in this test.
    set -x

    # First clear any inherited value in the environment,
    # and prove that the clearing has actually occurred.
    ( set +x; echo $LINE ) 2>/dev/null
    printenv PAPERSIZE
    export -n PAPERSIZE
    printenv PAPERSIZE

    # Look at the default paper size.
    ( set +x; echo $LINE ) 2>/dev/null
    paper
    paperconf
    paperconfig

    # Set the paper size to a known non-default value.
    ( set +x; echo $LINE ) 2>/dev/null
    export PAPERSIZE=Letter

    # Look to see what effect that environment variable has.
    ( set +x; echo $LINE ) 2>/dev/null
    paper
    paperconf
    paperconfig

    # End this test.
    ( set +x; echo $LINE ) 2>/dev/null

Here's the output I get from that script, when run in my local
Debian 13.7 context:

    --------------------------------
    + printenv PAPERSIZE
    Letter
    + export -n PAPERSIZE
    + printenv PAPERSIZE
    --------------------------------
    + paper
    A4: 210x297 mm
    + paperconf
    a4
    + paperconfig
    A4
    --------------------------------
    + export PAPERSIZE=Letter
    + PAPERSIZE=Letter
    --------------------------------
    + paper
    Letter: 8.5x11 in
    + paperconf
    letter
    + paperconfig
    /usr/bin/paper: unknown paper '/etc/papersize'
    --------------------------------

It's the output from that last paperconfig command that shows the problem.
Compare that to the earlier output from paperconfig when the PAPERSIZE
environment variable was not set.

Recommended fix:

    Change all references to the PAPERSIZE shell variable within the
    paperconfig script to be PAPERSIZEFILE instead.  This will in fact fit
    the actual semantics of that shell variable, which holds a filepath
    in contrast to the environment variable of the same original name,
    which holds a media-size name.

        sed --in-place -e "s/PAPERSIZE/PAPERSIZEFILE/g" paperconfig


-- System Information:
Debian Release: 13.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.111+deb13-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libpaper-utils depends on:
ii  libc6           2.41-12+deb13u4
ii  libpaper2       2.2.5-0.3+b2
ii  sensible-utils  0.0.25

libpaper-utils recommends no packages.

libpaper-utils suggests no packages.

-- no debconf information
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads