Package: bash
Version: 5.2.15-2+b1
Severity: normal
Tags: patch

Dear Maintainer,

When running the man-pages linters with 2>&1 | less, I got a wall of
  /etc/bash.bashrc: line 7: PS1: unbound variable

It uses
  SHELL := /usr/bin/env bash -Eeuo pipefail
and, /etc/bash.bashrc says, ll. 7,8:
  # If not running interactively, don't do anything
  [ -z "$PS1" ] && return

I've fixed this by making that expansion ${PS1-} instead;
this is what debian_chroot does below, for presumably the same reason.

I've preventatively done the same thing to the rest of the variables,
but just the PS1 thing was enough to run the tests.

I'm attaching a diff of the unpacked source
(incl. a $(cat => $(<; this a free optimisation in bash-specific code);
this would be much easier if the VCS pointed at anything (#1024158).

Best,
наб


-- System Information:
Debian Release: 12.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: x32 (x86_64)
Foreign Architectures: amd64, i386

Kernel: Linux 6.1.0-2-amd64 (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.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 bash depends on:
ii  base-files   12.4
ii  debianutils  5.7-0.4
ii  libc6        2.36-9
ii  libtinfo6    6.4-2

Versions of packages bash recommends:
ii  bash-completion  1:2.11-6

Versions of packages bash suggests:
pn  bash-doc  <none>

-- no debconf information
diff -ur bash-5.2.15.orig/debian/etc.bash.bashrc bash-5.2.15/debian/etc.bash.bashrc
--- bash-5.2.15.orig/debian/etc.bash.bashrc	2023-04-21 04:27:38.741253125 +0200
+++ bash-5.2.15/debian/etc.bash.bashrc	2023-04-21 04:30:57.006972972 +0200
@@ -4,7 +4,7 @@
 # this file has to be sourced in /etc/profile.
 
 # If not running interactively, don't do anything
-[ -z "$PS1" ] && return
+[ -z "${PS1-}" ] && return
 
 # check the window size after each command and, if necessary,
 # update the values of LINES and COLUMNS.
@@ -12,12 +12,12 @@
 
 # set variable identifying the chroot you work in (used in the prompt below)
 if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
-    debian_chroot=$(cat /etc/debian_chroot)
+    debian_chroot=$(< /etc/debian_chroot)
 fi
 
 # set a fancy prompt (non-color, overwrite the one in /etc/profile)
 # but only if not SUDOing and have SUDO_PS1 set; then assume smart user.
-if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then
+if ! [ -n "${SUDO_USER-}" -a -n "${SUDO_PS1-}" ]; then
   PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 fi
 

Attachment: signature.asc
Description: PGP signature

Reply via email to