dev-libs/libusb: Sync with Gentoo

It's from Gentoo commit c7294a9fbd430edac6e849e738d8c927d9bc065c.
This commit is contained in:
Krzesimir Nowak 2023-03-28 17:29:53 +02:00
parent 61806e6a65
commit 3da3da3e64
5 changed files with 2 additions and 180 deletions

View File

@ -1,2 +1 @@
DIST libusb-1.0.24.tar.bz2 606593 BLAKE2B f6188b5af1225cf8b6d1486b6efcf48e837ee4f2e3592adab3ae6aae0a74a67aa54f40f0dd547f951a194d40954f2ee33acf741d2eee0b8449ce64f2edcf1018 SHA512 5aea36a530aaa15c6dd656d0ed3ce204522c9946d8d39ffbb290dab4a98cda388a2598da4995123d1032324056090bd429e702459626d3e8d7daeebc4e7ff3dc
DIST libusb-1.0.25.tar.bz2 609127 BLAKE2B 3aecfbf9fc068fdfb8e612918bb895988f8400dc2c3ffd96a81792ab844d632f0c098947200512ddc37cfa9003956f8454c1d0362973a5d646a225f81cc2923b SHA512 f1e6e5577d4bd1ff136927dc66c615014a06ac332ddd797b1d1ad5f7b68e2405e66068dcb210e2f0ae3e31681603ef72efbd88bf7fbe0eb41ce700fdc3f92f9d
DIST libusb-1.0.26.tar.bz2 620534 BLAKE2B 0cc397ecf4de0066abbff9b286a9e4fcd48658698d5e0d6b736abf56b48c1b55a05f15fff7be53fd33f767621e0c25d87275a47e05a4bcb44c4b8ac9221cd081 SHA512 fcdb85c98f21639668693c2fd522814d440972d65883984c4ae53d0555bdbdb7e8c7a32199cd4b01113556a1eb5be7841b750cc73c9f6bda79bfe1af80914e71

View File

@ -1,65 +0,0 @@
From f6d2cb561402c3b6d3627c0eb89e009b503d9067 Mon Sep 17 00:00:00 2001
From: Chris Dickens <christopher.a.dickens@gmail.com>
Date: Sun, 13 Dec 2020 15:49:19 -0800
Subject: [PATCH] linux_usbfs: Fix parsing of descriptors for
multi-configuration devices
Commit e2be556bd2 ("linux_usbfs: Parse config descriptors during device
initialization") introduced a regression for devices with multiple
configurations. The logic that verifies the reported length of the
configuration descriptors failed to count the length of the
configuration descriptor itself and would truncate the actual length by
9 bytes, leading to a parsing error for subsequent descriptors.
Closes #825
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
---
libusb/os/linux_usbfs.c | 12 ++++++++----
libusb/version_nano.h | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
index fb2ed53a..4d2dc8d6 100644
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -641,7 +641,12 @@ static int seek_to_next_config(struct libusb_context *ctx,
uint8_t *buffer, size_t len)
{
struct usbi_descriptor_header *header;
- int offset = 0;
+ int offset;
+
+ /* Start seeking past the config descriptor */
+ offset = LIBUSB_DT_CONFIG_SIZE;
+ buffer += LIBUSB_DT_CONFIG_SIZE;
+ len -= LIBUSB_DT_CONFIG_SIZE;
while (len > 0) {
if (len < 2) {
@@ -718,7 +723,7 @@ static int parse_config_descriptors(struct libusb_device *dev)
}
if (priv->sysfs_dir) {
- /*
+ /*
* In sysfs wTotalLength is ignored, instead the kernel returns a
* config descriptor with verified bLength fields, with descriptors
* with an invalid bLength removed.
@@ -727,8 +732,7 @@ static int parse_config_descriptors(struct libusb_device *dev)
int offset;
if (num_configs > 1 && idx < num_configs - 1) {
- offset = seek_to_next_config(ctx, buffer + LIBUSB_DT_CONFIG_SIZE,
- remaining - LIBUSB_DT_CONFIG_SIZE);
+ offset = seek_to_next_config(ctx, buffer, remaining);
if (offset < 0)
return offset;
sysfs_config_len = (uint16_t)offset;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 61a0a700..578b0979 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11584
+#define LIBUSB_NANO 11586

View File

@ -1,32 +0,0 @@
https://github.com/libusb/libusb/pull/1062
https://github.com/libusb/libusb/issues/1063
https://bugs.gentoo.org/832732
From 8bb81fe72286cdcb782c7af4f0d7ef715b2e137c Mon Sep 17 00:00:00 2001
From: Yegor Yefremov <yegorslists@googlemail.com>
Date: Sun, 6 Feb 2022 07:12:14 +0100
Subject: [PATCH] linux_usbfs: fix maybe-uninitialized error
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Initialize active_config to an invalid value to avoid the following
compilation error:
os/linux_usbfs.c: In function op_get_configuration:
os/linux_usbfs.c:1452:12: error: active_config may be used uninitialized in this function [-Werror=maybe-uninitialized]
1452 | *config = (uint8_t)active_config;
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
--- a/libusb/os/linux_usbfs.c
+++ b/libusb/os/linux_usbfs.c
@@ -1429,7 +1429,7 @@ static int op_get_configuration(struct libusb_device_handle *handle,
uint8_t *config)
{
struct linux_device_priv *priv = usbi_get_device_priv(handle->dev);
- int active_config;
+ int active_config = -1; /* to please compiler */
int r;
if (priv->sysfs_dir) {

View File

@ -1,76 +0,0 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit multilib-minimal usr-ldscript
DESCRIPTION="Userspace access to USB devices"
HOMEPAGE="https://libusb.info/ https://github.com/libusb/libusb"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.bz2"
LICENSE="LGPL-2.1"
SLOT="1"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
IUSE="debug doc examples static-libs test udev"
RESTRICT="!test? ( test )"
REQUIRED_USE="static-libs? ( !udev )"
RDEPEND="udev? ( >=virtual/libudev-208:=[${MULTILIB_USEDEP}] )"
DEPEND="${RDEPEND}
!udev? ( virtual/os-headers )"
BDEPEND="doc? ( app-doc/doxygen )"
PATCHES=(
"${FILESDIR}/${P}-multi_device_config_parsing.patch" #759814
)
multilib_src_configure() {
local myeconfargs=(
$(use_enable static-libs static)
$(use_enable udev)
$(use_enable debug debug-log)
$(use_enable test tests-build)
)
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
multilib_src_compile() {
emake
if multilib_is_native_abi; then
use doc && emake -C doc
fi
}
multilib_src_test() {
emake check
# noinst_PROGRAMS from tests/Makefile.am
if [[ -e /dev/bus/usb ]]; then
tests/stress || die
else
# https://bugs.gentoo.org/824266
ewarn "/dev/bus/usb does not exist, skipping stress test"
fi
}
multilib_src_install() {
emake DESTDIR="${D}" install
if multilib_is_native_abi; then
gen_usr_ldscript -a usb-1.0
use doc && dodoc -r doc/api-1.0
fi
}
multilib_src_install_all() {
find "${ED}" -type f -name "*.la" -delete || die
dodoc AUTHORS ChangeLog NEWS PORTING README TODO
if use examples; then
docinto examples
dodoc examples/*.{c,h}
fi
}

View File

@ -11,7 +11,7 @@ SRC_URI="https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}.tar.bz2"
LICENSE="LGPL-2.1"
SLOT="1"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
IUSE="debug doc examples static-libs test udev"
RESTRICT="!test? ( test )"
REQUIRED_USE="static-libs? ( !udev )"
@ -21,10 +21,6 @@ DEPEND="${RDEPEND}
!udev? ( virtual/os-headers )"
BDEPEND="doc? ( app-doc/doxygen )"
PATCHES=(
"${FILESDIR}"/${P}-fix-O3-warning.patch
)
multilib_src_configure() {
local myeconfargs=(
$(use_enable static-libs static)