[neon/extras/ktechlab] debian: fix lifetime of intermediate temporary files

Pino Toscano null at kde.org
Thu Sep 8 15:56:01 BST 2022


Git commit 23dd3e534fffbf4484c0ca7c0d27635a69359248 by Pino Toscano.
Committed on 01/11/2020 at 08:57.
Pushed by jriddell into branch 'master'.

fix lifetime of intermediate temporary files

backport upstream commit a24dc9737462662390c9b0f37ce66774283df69c

M  +3    -0    debian/changelog
A  +1    -0    debian/patches/series
A  +37   -0    debian/patches/upstream_process-chain-keep-temporary-files-live-longer.patch

https://invent.kde.org/neon/extras/ktechlab/commit/23dd3e534fffbf4484c0ca7c0d27635a69359248

diff --git a/debian/changelog b/debian/changelog
index 61588ba..2a8205f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ ktechlab (0.50.0-2) UNRELEASED; urgency=medium
 
   [ Pino Toscano ]
   * Suggest gputils, picprog, and sdcc, as they can be used by default.
+  * Backport upstream commit a24dc9737462662390c9b0f37ce66774283df69c to fix
+    lifetime of intermediate temporary files; patch
+    upstream_process-chain-keep-temporary-files-live-longer.patch.
 
  -- Debian KDE Extras Team <pkg-kde-extras at lists.alioth.debian.org>  Thu, 29 Oct 2020 21:49:14 +0100
 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..683326b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+upstream_process-chain-keep-temporary-files-live-longer.patch
diff --git a/debian/patches/upstream_process-chain-keep-temporary-files-live-longer.patch b/debian/patches/upstream_process-chain-keep-temporary-files-live-longer.patch
new file mode 100644
index 0000000..681694d
--- /dev/null
+++ b/debian/patches/upstream_process-chain-keep-temporary-files-live-longer.patch
@@ -0,0 +1,37 @@
+From a24dc9737462662390c9b0f37ce66774283df69c Mon Sep 17 00:00:00 2001
+From: Pino Toscano <pino at kde.org>
+Date: Thu, 29 Oct 2020 23:39:00 +0100
+Subject: [PATCH] process chain: keep temporary files live longer
+
+A QTemporaryFile on the stack is created just to get a temporary file
+name; by default QTemporaryFile autodeletes the temporary file on
+removal, so a step after an indirect one fails because the result of the
+previous step does not exist anymore.
+
+While setting setAutoRemove(false) would solve the problem, it has the
+side effect of leaving the temporary file around. As a better solution,
+create the QTemporaryFile on the heap, parenting it to the processor
+class: as the processor is removed only when the process chain ends,
+the temporary file will be around during the whole chain processing,
+being removed at the end.
+---
+ src/languages/processchain.cpp | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/src/languages/processchain.cpp
++++ b/src/languages/processchain.cpp
+@@ -103,10 +103,10 @@ void ProcessChain::compile()
+ #define INDIRECT_PROCESS( path, processor, extension ) \
+         case ProcessOptions::ProcessPath::path: \
+             { \
+-                QTemporaryFile f(QDir::tempPath() + QLatin1String("/ktechlab_XXXXXX") + QLatin1String(extension)); \
+-                f.open(); \
+-                f.close(); \
+-                m_processOptions.setIntermediaryOutput( f.fileName() ); \
++                QTemporaryFile *f = new QTemporaryFile(QDir::tempPath() + QLatin1String("/ktechlab_XXXXXX") + QLatin1String(extension), processor()); \
++                f->open(); \
++                f->close(); \
++                m_processOptions.setIntermediaryOutput( f->fileName() ); \
+                 processor()->processInput(m_processOptions); \
+                 break; \
+             }



More information about the Neon-commits mailing list