aports/community/appstream-generator/as-gen-mkdir-crash.patch
2023-04-24 01:17:39 +02:00

35 lines
1.8 KiB
Diff

commit 714f9da
Author: Pablo Correa Gómez <ablocorrea@hotmail.com>
Date: Mon Apr 24 00:49:08 2023 +0200
utils: guard mkdir call with std.file.exists
Fixes the following stack trace:
2023-04-23 21:02:16 - INFO: Exporting data for v3.15 (main/aarch64)
2023-04-23 21:02:16std.file.FileException@/usr/include/d/std/file.d(2972): /home/abuild/cache/export/media/v3.15/g/gv/gvim.desktop/4016a69fc2135fa29a3414b2c8bd20d9//icons: File exists
----------------
??:? @trusted bool std.file.cenforce!(bool).cenforce(bool, scope const(char)[], scope const(char)*, immutable(char)[], ulong) [0x563624998170]
??:? @safe void std.file.mkdir!(immutable(char)[]).mkdir(immutable(char)[]) [0x563624a439d0]
??:? @trusted void asgen.utils.copyDir(in immutable(char)[], in immutable(char)[], bool) [0x563624a43500]
??:? /usr/bin/appstream-generator [0x5636249e2190]
??:? void std.parallelism.ParallelForeach!(asgen.backends.interfaces.Package[]).ParallelForeach.opApply(scope int delegate(ref asgen.backends.interfaces.Package)).doIt() [0x5636249e8f30]
??:? void std.parallelism.TaskPool.executeWorkLoop() [0x7fd515e4efe0]
??:? thread_entryPoint [0x7fd515b9d5b0]
- DEBUG: Building final metadata and hints files.
diff --git a/src/asgen/utils.d b/src/asgen/utils.d
index ef59609..854293a 100644
--- a/src/asgen/utils.d
+++ b/src/asgen/utils.d
@@ -252,7 +252,8 @@ void copyDir (in string srcDir, in string destDir, bool useHardlinks = false) @t
foreach (DirEntry e; dirEntries (deSrc.name, SpanMode.breadth, true)) {
if (attrIsDir (e.attributes)) {
auto childDir = destRoot ~ e.name[srcLen..$];
- mkdir (childDir);
+ if (!std.file.exists (childDir))
+ mkdir (childDir);
} else {
files ~= e.name;
}