From b266b21306f3ad001ae2ae83be1605c631658461 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 28 Mar 2019 00:21:58 -0700 Subject: [PATCH] v4l-utils: Update to 1.16.5 Add Alpine Linux patch that fixes a crash under Musl. Signed-off-by: Rosen Penev --- libs/libv4l/Makefile | 6 ++-- .../patches/010-remove-libudev-check.patch | 2 +- libs/libv4l/patches/030-getsubopt.patch | 36 +++++++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 libs/libv4l/patches/030-getsubopt.patch diff --git a/libs/libv4l/Makefile b/libs/libv4l/Makefile index b034e3638..23b891a3d 100644 --- a/libs/libv4l/Makefile +++ b/libs/libv4l/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=v4l-utils -PKG_VERSION:=1.16.3 +PKG_VERSION:=1.16.5 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.linuxtv.org/downloads/v4l-utils -PKG_HASH:=7c5c0d49c130cf65d384f28e9f3a53c5f7d17bf18740c48c40810e0fbbed5b54 +PKG_HASH:=ed80242510385017a1dc566e17a285a77222bb301f5bc19386badfcc2c19df1b PKG_MAINTAINER:=Ted Hess PKG_LICENSE:=GPL-2.0 LGPL-2.1 @@ -29,7 +29,7 @@ include $(INCLUDE_DIR)/nls.mk define Package/libv4l/Default TITLE:=Video 4 Linux - URL:=http://www.linuxtv.org/ + URL:=https://www.linuxtv.org/ endef define Package/libv4l/Default/description diff --git a/libs/libv4l/patches/010-remove-libudev-check.patch b/libs/libv4l/patches/010-remove-libudev-check.patch index 6a9784adb..2e55aa288 100644 --- a/libs/libv4l/patches/010-remove-libudev-check.patch +++ b/libs/libv4l/patches/010-remove-libudev-check.patch @@ -1,6 +1,6 @@ --- a/configure.ac +++ b/configure.ac -@@ -283,16 +283,9 @@ else +@@ -309,16 +309,9 @@ else AC_MSG_WARN(ALSA library not available) fi diff --git a/libs/libv4l/patches/030-getsubopt.patch b/libs/libv4l/patches/030-getsubopt.patch new file mode 100644 index 000000000..c476e5ed7 --- /dev/null +++ b/libs/libv4l/patches/030-getsubopt.patch @@ -0,0 +1,36 @@ +POSIX says that behavior when subopts list is empty is undefined. +musl libs will set value to NULL which leads to crash. + +Simply avoid getsubopt, since we cannot rely on it. + +diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp +index 3ea6cd3..291fb3e 100644 +--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp ++++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp +@@ -692,16 +692,17 @@ static bool parse_subset(char *optarg) + + static bool parse_next_subopt(char **subs, char **value) + { +- static char *const subopts[] = { +- NULL +- }; +- int opt = getsubopt(subs, subopts, value); ++ char *p = *subs; ++ *value = *subs; + +- if (opt < 0 || *value) +- return false; +- fprintf(stderr, "No value given to suboption <%s>\n", +- subopts[opt]); +- return true; ++ while (*p && *p != ',') ++ p++; ++ ++ if (*p) ++ *p++ = '\0'; ++ ++ *subs = p; ++ return false; + } + + void common_cmd(int ch, char *optarg)