* [PATCH v2 1/2] classes/package_rpm: additionally escape \ and " in filenames
@ 2024-02-01 9:15 Alexander Kanavin
2024-02-01 9:15 ` [PATCH v2 2/2] classes/package_rpm: streamline the logic in one of the condition blocks Alexander Kanavin
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kanavin @ 2024-02-01 9:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Alexander Kanavin
As specified in:
https://github.com/rpm-software-management/rpm/blob/rpm-4.19.x/docs/manual/spec.md#shell-globbing
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
meta/classes-global/package_rpm.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index 819ee502783..45ac138084b 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -217,7 +217,7 @@ python write_specfile () {
return "%attr({:o},{},{}) ".format(mode, owner, group)
def escape_chars(p):
- return p.replace("%", "%%")
+ return p.replace("%", "%%").replace("\\", "\\\\").replace('"', '\\"')
path = rootpath.replace(walkpath, "")
if path.endswith("DEBIAN") or path.endswith("CONTROL"):
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2 2/2] classes/package_rpm: streamline the logic in one of the condition blocks
2024-02-01 9:15 [PATCH v2 1/2] classes/package_rpm: additionally escape \ and " in filenames Alexander Kanavin
@ 2024-02-01 9:15 ` Alexander Kanavin
0 siblings, 0 replies; 2+ messages in thread
From: Alexander Kanavin @ 2024-02-01 9:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Alexander Kanavin
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
meta/classes-global/package_rpm.bbclass | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index 45ac138084b..3743be8c821 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -243,13 +243,11 @@ python write_specfile () {
p = path + '/' + dir
# All packages own the directories their files are in...
target.append(get_attr(dir) + '%dir "' + escape_chars(p) + '"')
- else:
+ elif path:
# packages own only empty directories or explict directory.
# This will prevent the overlapping of security permission.
attr = get_attr(path)
- if path and not files and not dirs:
- target.append(attr + '%dir "' + escape_chars(path) + '"')
- elif path and path in dirfiles:
+ if (not files and not dirs) or path in dirfiles:
target.append(attr + '%dir "' + escape_chars(path) + '"')
for file in files:
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-01 9:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 9:15 [PATCH v2 1/2] classes/package_rpm: additionally escape \ and " in filenames Alexander Kanavin
2024-02-01 9:15 ` [PATCH v2 2/2] classes/package_rpm: streamline the logic in one of the condition blocks Alexander Kanavin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox