Package: bash
Version: 5.2.37-2+b2
Severity: normal

Install `command-not-found` package so that the bash function
`command_not_found_handle` defined in `/etc/bash.bashrc` runs.

Make a command typo: Can be simplified as: `a`
The python handler reports:
```
a: command not found
```

Make a command typo. Can be simplified as: `a </`
The python handler fails with:
```
Fatal Python error: init_sys_streams: <stdin> is a directory, cannot continue
Python runtime state: core initialized
```


I do not know if this is a good fix but editing `/etc/bash.bashrc
so that stdin is redirected from `/dev/null` avoids the failure:

```
        function command_not_found_handle {
                # check because c-n-f could've been removed in the meantime
                if [ -x /usr/lib/command-not-found ]; then
                   </dev/null /usr/lib/command-not-found -- "$1"
                   return $?
                elif [ -x /usr/share/command-not-found/command-not-found ]; then
                   /usr/share/command-not-found/command-not-found -- "$1"
                   return $?
                else
                   printf "%s: command not found\n" "$1" >&2
                   return 127
                fi
        }
```

My system does not have `/usr/share/command-not-dound/command-not-found`
(and I don't know where it comes from) so I do not know if that has the
same issue and should have a similar fix applied.



-- System Information:
Debian Release: 13.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 5.15.0-97-generic (SMP w/1 CPU thread)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_LIVEPATCH
Locale: LANG=C.UTF-8, LC_CTYPE=C.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   13.8
ii  debianutils  5.22
ii  libc6        2.41-8
ii  libtinfo6    6.5+20250216-2

Versions of packages bash recommends:
pn  bash-completion  <none>

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

-- no debconf information

Reply via email to