luci-app-opkg: relax dependency parsing
authorJo-Philipp Wich <jo@mein.io>
Fri, 30 Sep 2022 07:59:39 +0000 (09:59 +0200)
committerJo-Philipp Wich <jo@mein.io>
Fri, 30 Sep 2022 08:03:35 +0000 (10:03 +0200)
Align depdendency parse logic with opkg to properly process certain
malformed dependency specifications. In particular do not require a
depdendency specification to end after the closing paren of a version
constraint and perform non-greedy matching in order to extract the
first version constraint only.

Fixes: #5997
Ref: https://forum.openwrt.org/t/x/138328
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 84ba6a5c36072f74721d535104735757b005c8d6)

applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js

index a019b2cc318a11260b74a032fea9b82ad2f7d592..a63928f3e4b0522a843b1df5e729a78987977e04 100644 (file)
@@ -571,7 +571,7 @@ function renderDependencies(depends, info)
                if (deps[i] === 'libc')
                        continue;
 
-               if (deps[i].match(/^(.+)\s+\((<=|>=|<<|>>|<|>|=)(.+)\)$/)) {
+               if (deps[i].match(/^(.+?)\s+\((<=|>=|<<|>>|<|>|=)(.+?)\)/)) {
                        dep = RegExp.$1.trim();
                        vop = RegExp.$2.trim();
                        ver = RegExp.$3.trim();