Package: bash
Version: 5.2~rc1-1
Severity: minor

Dear Maintainer,

`[ -x ... -o -x ... ]` does not short circuit, split to
`[ -x ... ] || [ -x ... ]` to avoid a `stat` call when looking for
command-not-found.


-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 'focal'), 
(100, 'focal-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.13.0-52-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en_US:en (charmap=UTF-8)
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   11ubuntu5.5
ii  debianutils  4.9.1
ii  libc6        2.31-0ubuntu9.9
ii  libtinfo6    6.2-0ubuntu2

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

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

-- no debconf information
>From bcc6298ba3b82753b9de7963aa5226a8b006ebe3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.sky...@iki.fi>
Date: Sun, 17 Jul 2022 22:43:11 +0300
Subject: [PATCH] perf(bashrc): avoid a command-not-found lookup stat

`[ -x ... -o -x ... ]` does not short circuit, split to
`[ -x ... ] || [ -x ... ]` to avoid a `stat` call.
---
 debian/etc.bash.bashrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/etc.bash.bashrc b/debian/etc.bash.bashrc
index 7fabe82..a3ce7e6 100644
--- a/debian/etc.bash.bashrc
+++ b/debian/etc.bash.bashrc
@@ -41,7 +41,7 @@ fi
 #fi
 
 # if the command-not-found package is installed, use it
-if [ -x /usr/lib/command-not-found -o -x 
/usr/share/command-not-found/command-not-found ]; then
+if [ -x /usr/lib/command-not-found ] || [ -x 
/usr/share/command-not-found/command-not-found ]; then
        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
-- 
2.25.1

Reply via email to