Bug#1061465: bookworm-pu: package usbutils/014-1+deb12u1

2024-01-29 Thread Aurelien Jarno
On 2024-01-29 21:56, Adam D. Barratt wrote:
> Control: tags -1 + confirmed
> 
> On Wed, 2024-01-24 at 23:06 +0100, Aurelien Jarno wrote:
> > The usbutils package contains a simple shell script called usb-
> > devices
> > to list all USB devices with their basic characteristics. A
> > regression
> > has been introduced in the version in bookworm, which causes some
> > devices behind hubs to be missed.
> 
> Please go ahead.
 
Thanks, uploaded.

-- 
Aurelien Jarno  GPG: 4096R/1DDD8C9B
aurel...@aurel32.net http://aurel32.net



Bug#1061465: bookworm-pu: package usbutils/014-1+deb12u1

2024-01-29 Thread Adam D. Barratt
Control: tags -1 + confirmed

On Wed, 2024-01-24 at 23:06 +0100, Aurelien Jarno wrote:
> The usbutils package contains a simple shell script called usb-
> devices
> to list all USB devices with their basic characteristics. A
> regression
> has been introduced in the version in bookworm, which causes some
> devices behind hubs to be missed.

Please go ahead.

Regards,

Adam



Bug#1061465: bookworm-pu: package usbutils/014-1+deb12u1

2024-01-24 Thread Aurelien Jarno
Package: release.debian.org
Severity: normal
Tags: bookworm
User: release.debian@packages.debian.org
Usertags: pu
X-Debbugs-Cc: usbut...@packages.debian.org
Control: affects -1 + src:usbutils

[ Reason ]
The usbutils package contains a simple shell script called usb-devices
to list all USB devices with their basic characteristics. A regression
has been introduced in the version in bookworm, which causes some
devices behind hubs to be missed.

[ Impact ]
As the script is working partially listing some of the USB devices,
users might come to the wrong conclusion about the attached USB devices.

[ Tests ]
There is no automated testing for this shell script, however the fix has
been tested manually.

[ Risks ]
The patch is really simple and the fix has been in testing/unstable for
about 7 months without any reported issue.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
The changes consists in pulling the upstream patch into the package. The
print_device() function is called recursively to go through the USB
tree. The variables are global by default, so the values of the caller
got overwritten by the callee. The solution is to declare those
variables as local.
diff -Nru usbutils-014/debian/changelog usbutils-014/debian/changelog
--- usbutils-014/debian/changelog   2021-08-18 22:40:42.0 +0200
+++ usbutils-014/debian/changelog   2024-01-24 22:32:47.0 +0100
@@ -1,3 +1,10 @@
+usbutils (1:014-1+deb12u1) bookworm; urgency=medium
+
+  * Add 01-usb-devices-use-local-variable-type-to-handle-recurs.patch to fix
+usb-devices not printing all devices.  Closes: #1052307.
+
+ -- Aurelien Jarno   Wed, 24 Jan 2024 22:32:47 +0100
+
 usbutils (1:014-1) unstable; urgency=medium
 
   * New upstream version:
diff -Nru 
usbutils-014/debian/patches/01-usb-devices-use-local-variable-type-to-handle-recurs.patch
 
usbutils-014/debian/patches/01-usb-devices-use-local-variable-type-to-handle-recurs.patch
--- 
usbutils-014/debian/patches/01-usb-devices-use-local-variable-type-to-handle-recurs.patch
   1970-01-01 01:00:00.0 +0100
+++ 
usbutils-014/debian/patches/01-usb-devices-use-local-variable-type-to-handle-recurs.patch
   2024-01-24 22:32:47.0 +0100
@@ -0,0 +1,39 @@
+From b1c31712134d2b28877bbe01de1526a256ca676c Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman 
+Date: Fri, 15 Oct 2021 16:07:17 +0200
+Subject: [PATCH] usb-devices: use 'local' variable type to handle recursion
+
+When recursing into a long USB tree, the local variables in the
+print_device() function would get confused and take on the value of the
+previous device it printed.  This caused devices to not get printed out
+at all, the exact opposite of what we wanted.
+
+Resolve this by using the non-POSIX 'local' variable declaration.
+
+Signed-off-by: Greg Kroah-Hartman 
+---
+ usb-devices | 8 
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/usb-devices b/usb-devices
+index 4e14608..9aca88d 100755
+--- a/usb-devices
 b/usb-devices
+@@ -101,10 +101,10 @@ print_interface() {
+ }
+ 
+ print_device() {
+-  devpath=$1
+-  parent=$2
+-  level=$3
+-  count=$4
++  local devpath=$1
++  local parent=$2
++  local level=$3
++  local count=$4
+ 
+   [ -d $devpath ] || return
+   cd $devpath
+-- 
+2.42.0
+
diff -Nru usbutils-014/debian/patches/series usbutils-014/debian/patches/series
--- usbutils-014/debian/patches/series  1970-01-01 01:00:00.0 +0100
+++ usbutils-014/debian/patches/series  2024-01-24 22:32:47.0 +0100
@@ -0,0 +1 @@
+01-usb-devices-use-local-variable-type-to-handle-recurs.patch