Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:15-SP2
salt.26903
change-the-delimeters-to-prevent-possible-trace...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File change-the-delimeters-to-prevent-possible-tracebacks.patch of Package salt.26903
From e28385eb37932809a11ec81c81834a51e094f507 Mon Sep 17 00:00:00 2001 From: Victor Zhestkov <Victor.Zhestkov@suse.com> Date: Thu, 1 Sep 2022 14:42:24 +0300 Subject: [PATCH] Change the delimeters to prevent possible tracebacks on some packages with dpkg_lowpkg * Use another separator on query to dpkg-query * Fix the test test_dpkg_lowpkg::test_info --- salt/modules/dpkg_lowpkg.py | 13 ++++++++----- tests/unit/modules/test_dpkg_lowpkg.py | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/salt/modules/dpkg_lowpkg.py b/salt/modules/dpkg_lowpkg.py index 2c25b1fb2a..fc93d99549 100644 --- a/salt/modules/dpkg_lowpkg.py +++ b/salt/modules/dpkg_lowpkg.py @@ -309,9 +309,8 @@ def _get_pkg_info(*packages, **kwargs): "origin:${Origin}\\n" "homepage:${Homepage}\\n" "status:${db:Status-Abbrev}\\n" - "======\\n" "description:${Description}\\n" - "------\\n'" + "\\n*/~^\\\\*\\n'" ) cmd += " {}".format(" ".join(packages)) cmd = cmd.strip() @@ -325,9 +324,13 @@ def _get_pkg_info(*packages, **kwargs): else: return ret - for pkg_info in [elm for elm in re.split(r"------", call["stdout"]) if elm.strip()]: + for pkg_info in [ + elm + for elm in re.split(r"\r?\n\*/~\^\\\*(\r?\n|)", call["stdout"]) + if elm.strip() + ]: pkg_data = {} - pkg_info, pkg_descr = re.split(r"======", pkg_info) + pkg_info, pkg_descr = pkg_info.split("\ndescription:", 1) for pkg_info_line in [ el.strip() for el in pkg_info.split(os.linesep) if el.strip() ]: @@ -344,7 +347,7 @@ def _get_pkg_info(*packages, **kwargs): if build_date: pkg_data["build_date"] = build_date pkg_data["build_date_time_t"] = build_date_t - pkg_data["description"] = pkg_descr.split(":", 1)[-1] + pkg_data["description"] = pkg_descr ret.append(pkg_data) return ret diff --git a/tests/unit/modules/test_dpkg_lowpkg.py b/tests/unit/modules/test_dpkg_lowpkg.py index d00fc46c66..a97519f489 100644 --- a/tests/unit/modules/test_dpkg_lowpkg.py +++ b/tests/unit/modules/test_dpkg_lowpkg.py @@ -290,7 +290,6 @@ class DpkgTestCase(TestCase, LoaderModuleMockMixin): "origin:", "homepage:http://tiswww.case.edu/php/chet/bash/bashtop.html", "status:ii ", - "======", "description:GNU Bourne Again SHell", " Bash is an sh-compatible command language interpreter that" " executes", @@ -307,7 +306,8 @@ class DpkgTestCase(TestCase, LoaderModuleMockMixin): " The Programmable Completion Code, by Ian Macdonald, is now" " found in", " the bash-completion package.", - "------", + "", + "*/~^\\*", # pylint: disable=W1401 ] ), } -- 2.37.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor