Do not force anchored patterns on libosinfo

Instead, do it in osinfo-db.

This reverts commit 21f50981dc.
This reverts commit 4ddc384c54.
This commit is contained in:
Fabiano Fidêncio 2018-10-11 20:02:30 +02:00
parent 21f50981dc
commit 336a1e9d04
2 changed files with 6 additions and 45 deletions

View File

@ -1,34 +0,0 @@
From e6168463f4fc659b9827b5c8694dc1c6d7d5239a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= <fidencio@redhat.com>
Date: Fri, 7 Sep 2018 15:53:20 +0200
Subject: [PATCH] db: Force anchored patterns when matching regex
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Without forcing anchored patterns some matches may be completely wrong
as "(J_)?CENN?A_X64FREV" (volume-id for Windows 10) that could be taken
as a match for "HRM_CENNA_X64FREV" (volume-id of a Windows 8 ISO).
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
---
osinfo/osinfo_db.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/osinfo/osinfo_db.c b/osinfo/osinfo_db.c
index fa14c6d..f4b3a8c 100644
--- a/osinfo/osinfo_db.c
+++ b/osinfo/osinfo_db.c
@@ -37,7 +37,7 @@ G_DEFINE_TYPE(OsinfoDb, osinfo_db, G_TYPE_OBJECT);
#define match_regex(pattern, str) \
(((pattern) == NULL) || \
(((str) != NULL) && \
- g_regex_match_simple((pattern), (str), 0, 0)))
+ g_regex_match_simple((pattern), (str), 0, G_REGEX_MATCH_ANCHORED)))
static gchar *get_raw_lang(const char *volume_id, const gchar *regex_str)
{
--
1.8.3.1

View File

@ -3,15 +3,11 @@
Summary: A library for managing OS information for virtualization
Name: libosinfo
Version: 1.2.0
Release: 4%{?dist}%{?extra_release}
Release: 5%{?dist}%{?extra_release}
License: LGPLv2+
Group: Development/Libraries
Source: https://releases.pagure.io/%{name}/%{name}-%{version}.tar.gz
URL: https://libosinfo.org/
### Patches ###
Patch0001: 0001-db-Force-anchored-patterns-when-matching-regex.patch
BuildRequires: intltool
BuildRequires: glib2-devel
BuildRequires: libxml2-devel >= 2.6.0
@ -22,9 +18,9 @@ BuildRequires: libcurl-devel
BuildRequires: /usr/bin/pod2man
BuildRequires: hwdata
BuildRequires: gobject-introspection-devel
BuildRequires: osinfo-db
BuildRequires: osinfo-db >= 20181011-1
Requires: hwdata
Requires: osinfo-db >= 20180920-1
Requires: osinfo-db >= 20181011-1
Requires: osinfo-db-tools
%description
@ -61,10 +57,6 @@ This package provides the Vala bindings for libosinfo library.
%prep
%setup -q
for p in %patches ; do
%__patch -p1 -i $p
done
%build
%configure --enable-introspection=yes --enable-vala=yes
%__make %{?_smp_mflags} V=1
@ -114,6 +106,9 @@ fi
%{_datadir}/vala/vapi/libosinfo-1.0.vapi
%changelog
* Thu Oct 11 2018 Fabiano Fidêncio <fabiano@fidencio.org> - 1.2.0-5
- Do not force anchored patterns on libosinfo, leave it for osinfo-db
* Thu Sep 20 2018 Fabiano Fidêncio <fabiano@fidencio.org> - 1.2.0-4
- Require osinfo-db >= 20180920-1