Hi Alexandre, Thanks for the report!
What an annoying edge-case :-). Essentially: controlling TTY isn't set
here.
An easier reproducer I wrote down when working on this code (with the fix):
$ setsid -w bts version
bts: WARN: Could not open /dev/tty despite STDIN being a TTY: No such
device or address
bts: Falling back to using STDIN.
[...]
I've added a fallback to just use STDIN in this case.
Thanks,
--Daniel
On Wed, Dec 24, 2025 at 12:05:32PM +0100, Alexandre Detiste wrote:
> since recently, my contrab that sometimes invokes "bts"
> to fixup bug metadata fails.
>
> I also provided here a minimal reproducer.
>
> Greetings
>
> Alexandre
>
>
>
>
> Minimal:
> """"""""
>
> tchet@quieter:~$ bts version
> bts version 2.25.32
> Copyright (C) 2001-2003 by Joey Hess <[email protected]>.
> Modifications Copyright (C) 2002-2004 by Julian Gilbey <[email protected]>.
> Modifications Copyright (C) 2007 by Josh Triplett <[email protected]>.
> It is licensed under the terms of the GPL, either version 2 of the
> License, or (at your option) any later version.
>
> tchet@quieter:~$ systemd-run --user bts version
> Running as unit: run-p14088-i14089.service; invocation ID:
> 3ab85a60c5024867a7d6fc038f722658
>
> tchet@quieter:~$ journalctl --user -u run-p14088-i14089.service
> déc 24 11:59:22 quieter systemd[1426]: Started run-p14088-i14089.service -
> [systemd-run] /usr/bin/bts version.
> déc 24 11:59:22 quieter bts[14089]: Use of uninitialized value $ENV{"_"} in
> pattern match (m//) at /usr/bin/bts line 1085.
> déc 24 11:59:22 quieter bts[14089]: Cannot open /dev/tty: No such device or
> address at /usr/bin/bts line 1232.
> déc 24 11:59:22 quieter systemd[1426]: run-p14088-i14089.service: Main
> process exited, code=exited, status=6/NOTCONFIGURED
> déc 24 11:59:22 quieter systemd[1426]: run-p14088-i14089.service: Failed with
> result 'exit-code'.
>
>
> How I found out origininaly:
> """"""""""""""""""""""""""""
>
>
> cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.service - [Cron] "@hourly
> bin/removal.py"
> Loaded: loaded (/var/spool/cron/crontabs/tchet; generated)
> Active: inactive (dead) since Sun 2025-12-21 04:01:12 CET; 59ms ago
> Invocation: 7d093e5515964bda8382e40011e7695f
> TriggeredBy: ● cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.timer
> Docs: man:systemd-crontab-generator(8)
> Process: 4047 ExecStart=/bin/sh
> /run/systemd/generator/cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.sh
> (code=exited, status=0/SUCCESS)
> Main PID: 4047 (code=exited, status=0/SUCCESS)
> Mem peak: 44.6M
> CPU: 440ms
> 2025-12-21T04:00:06+01:00 quieter systemd[1]: Starting
> cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.service - [Cron] "@hourly
> bin/removal.py"...
> 2025-12-21T04:01:12+01:00 quieter sh[4092]: Use of uninitialized value
> $ENV{"_"} in pattern match (m//) at /usr/bin/bts line 1085.
> 2025-12-21T04:01:12+01:00 quieter sh[4092]: Cannot open /dev/tty: No such
> device or address at /usr/bin/bts line 1232.
> 2025-12-21T04:01:12+01:00 quieter systemd[1]:
> cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.service: Deactivated
> successfully.
> 2025-12-21T04:01:12+01:00 quieter systemd[1]: Finished
> cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.service - [Cron] "@hourly
> bin/removal.py".
> 2025-12-21T04:01:12+01:00 quieter systemd[1]:
> cron-tchet-tchet-b98f38362b230cd617a7735d072a6463.service: Triggering
> OnSuccess= dependencies.
>
>
> tchet@quieter:~$ cat bin/removal.py
> #!/usr/bin/python3
>
> import time
> time.sleep(60)
>
> import subprocess
>
> import apt_pkg
> import debianbts as bts
>
> apt_pkg.init()
> SOURCES = apt_pkg.SourceRecords()
>
> bugs = bts.get_bugs(package='ftp.debian.org')
>
> for bug in bts.get_status(list(bugs)):
> if bug.affects or bug.done:
> continue
> if 'RM' in bug.subject and '/experimental' not in bug.subject:
> package = bug.subject.split(':')[1].strip('
> ').split()[0].split(',')[0]
> if SOURCES.lookup(package):
> subprocess.call(['bts', 'affect', str(bug.bug_num), package])
>
>
>
>
> -- Package-specific info:
>
> --- /etc/devscripts.conf ---
> USCAN_SYMLINK=rename
>
> --- ~/.devscripts ---
> Not present
>
> -- System Information:
> Debian Release: forky/sid
> APT prefers testing
> APT policy: (501, 'testing'), (450, 'unstable'), (400, 'experimental')
> Architecture: amd64 (x86_64)
> Foreign Architectures: i386
>
> Kernel: Linux 6.17.12+deb14-amd64 (SMP w/4 CPU threads; PREEMPT)
> Locale: LANG=fr_BE.UTF-8, LC_CTYPE=fr_BE.UTF-8 (charmap=UTF-8),
> LANGUAGE=fr_BE:fr
> Shell: /bin/sh linked to /usr/bin/dash
> Init: systemd (via /run/systemd/system)
> LSM: AppArmor: enabled
>
> Versions of packages devscripts depends on:
> ii dpkg-dev 1.22.21
> ii file 1:5.46-5
> ii gpg 2.4.8-4+b1
> ii gpg-agent 2.4.8-4+b1
> ii gpgv 2.4.8-4+b1
> ii libconfig-inifiles-perl 3.000003-4
> ii libdpkg-perl 1.22.21
> ii libfile-dirlist-perl 0.05-3
> ii libfile-homedir-perl 1.006-2
> ii libfile-touch-perl 0.12-2
> ii libio-string-perl 1.08-4
> ii libmoo-perl 2.005005-1
> ii libwww-perl 6.81-1
> ii patchutils 0.4.3-1
> ii perl 5.40.1-7
> ii python3 3.13.9-2
> ii sensible-utils 0.0.26
> ii wdiff 1.2.2-9
>
> Versions of packages devscripts recommends:
> ii apt 3.1.12
> ii curl 8.18.0~rc2-1
> ii dctrl-tools 2.24-3+b1
> ii debian-keyring 2025.09.18
> ii debian-tag2upload-keyring 1.1
> ii dput-ng [dput] 1.44
> ii equivs 2.3.2
> ii git-debpush 13.19
> ii libdistro-info-perl 1.14
> ii libencode-locale-perl 1.05-3
> ii libgitlab-api-v4-perl 0.27-1
> ii libjson-perl 4.10000-1
> ii liblwp-protocol-https-perl 6.14-1
> ii libmetacpan-client-perl 2.034000-1
> ii libsoap-lite-perl 1.27-3
> ii libstring-shellquote-perl 1.04-3
> ii liburi-perl 5.34-2
> ii licensecheck 3.3.9-1
> ii lintian 2.127.0
> ii lzip 1.25-4
> ii man-db 2.13.1-1
> ii patch 2.8-2
> ii pristine-tar 1.50+nmu2
> ii python3-apt 3.1.0
> ii python3-debian 1.0.1
> ii python3-magic 2:0.4.27-3
> ii python3-requests 2.32.5+dfsg-1
> ii python3-unidiff 0.7.5-2
> ii python3-xdg 0.28-3
> ii strace 6.16+ds-2
> ii unzip 6.0-29
> ii wget 1.25.0-2
> ii xz-utils 5.8.1-2
>
> Versions of packages devscripts suggests:
> ii adequate 0.17.6+b1
> pn at <none>
> ii autopkgtest 5.53
> pn bls-standalone <none>
> ii bsd-mailx [mailx] 8.1.2-0.20220412cvs-1.1
> ii build-essential 12.12
> pn check-all-the-things <none>
> ii debhelper 13.29
> ii diffoscope 309
> ii disorderfs 0.6.0-1
> pn docker.io <none>
> ii dose-extra 7.0.0-6+b4
> pn duck <none>
> pn elpa-devscripts <none>
> ii faketime 0.9.10+2024-06-05+gba9ed5b2-0.6
> ii gnuplot-nox [gnuplot] 6.0.3+dfsg1-1
> pn how-can-i-help <none>
> ii libauthen-sasl-perl 2.1900-1
> pn libdbd-pg-perl <none>
> pn libterm-size-perl <none>
> ii libtimedate-perl 2.3300-2
> ii libyaml-libyaml-perl 0.904.0+ds-1
> ii mailutils [mailx] 1:3.20-3
> ii mmdebstrap 1.5.7-3
> pn mutt <none>
> ii nullmailer [mail-transport-agent] 1:2.2+10~g7ed88a0-6.1
> ii openssh-client [ssh-client] 1:10.2p1-3
> ii piuparts 1.6.0
> ii postgresql-client-17 [postgresql-client] 17.6-1
> ii postgresql-client-18 [postgresql-client] 18.1-2
> pn pristine-lfs <none>
> ii python3-debianbts 4.1.1
> ii python3-pycurl 7.45.7-3+b1
> ii quilt 0.68-1
> ii ratt 0.0~git20250829.39528ce-1+b1
> ii reprotest 0.7.32
> pn svn-buildpackage <none>
> ii w3m 0.5.3+git20230121-2.1
>
> -- no debconf information
signature.asc
Description: PGP signature

