Package: pastebinit
Version: 1.7.1-1
Severity: minor

I happened to do pastebinit in a minimal container and was surprised it tried 
to len(None).
Here is a minimal recipe:

    bash5$ mmdebstrap forky /dev/null --quiet --include=pastebinit \
             --customize-hook='echo hello | chroot $1 env -i PATH=/bin 
pastebinit'
    Traceback (most recent call last):
      File "/bin/pastebinit", line 442, in <module>
        if len(user) > user_length:
           ~~~^^^^^^
    TypeError: object of type 'NoneType' has no len()

This is happening here:

            'user'      : os.environ.get('USER', os.environ.get('LOGNAME')),

Is it reasonable to do an NSS lookup as well, or instead?

            'user'      : os.environ.get('USER', os.environ.get('LOGNAME', 
pwd.getpwuid(os.geteuid()).pw_name)),

    bash5$ mmdebstrap forky /dev/null http://localhost:3142/debian --quiet 
--include=pastebinit --customize-hook='echo hello | chroot $1 env -i PATH=/bin 
python3 -c "import os, pwd; print(pwd.getpwuid(os.geteuid()).pw_name)"'
    root

    >>> import os, pwd
    >>> for k in os.environ: del os.environ[k]
    ... 
    >>> os.environ.get('USER', os.environ.get('LOGNAME', 
pwd.getpwuid(os.geteuid()).pw_name))
    'twb'

If you strongly dislike this idea, just close this ticket.
I use pastebinit all the time, and this is the first time I've run into this, 
and
I can always use "-a Outis" as a workaround.



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

Kernel: Linux 6.12.107+deb13-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages pastebinit depends on:
ii  python3         3.13.5-1
ii  python3-distro  1.9.0-1

pastebinit recommends no packages.

pastebinit suggests no packages.

-- no debconf information

Reply via email to