darktable-org / darktable-org/lua-scripts

Lua Script GIMP doesn't waits for GIMP locks when it's previously opened

オープン 初心者向け
#618 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Lua
スター
219
フォーク
142
PR マージ指標
30日以内にマージされた PR はありません

説明

Description of the Issue

The contrib/gimp.lua script fails to open images in GIMP when an instance of GIMP is already running. The image is exported by Darktable, but GIMP displays a "No such file or directory" error, and the image is never re-imported into Darktable.

The Root Cause

Race Condition The script's logic relies on the GIMP process being blocking (waiting until the application closes) to proceed to the file cleanup/re-import phase.

Scenario A (GIMP Closed): The script works. The process blocks, user edits, closes GIMP, and the script continues.

Scenario B (GIMP Open): Modern GIMP behavior (especially GIMP 3.0 AppImages or modern 2.10 distros using DBus) defaults to "Single Instance" mode. The command sends a signal to the running instance and returns control immediately (non-blocking) to the shell.

Because of this non-blocking return, the Lua script immediately proceeds to df.file_move, moving/renaming the source file before the GIMP instance (which queues the open request as an idle job) has a chance to read it.

Verification
GIMP 3.0 (AppImage): Confirmed failure due to immediate process return.

GIMP 2.10 (Ubuntu Studio Repo): Confirmed failure on a standard, fresh install, ruling out custom environment issues.

CLI Reproduction: gimp image.jpg && mv image.jpg destination.jpg reproduces the failure in the terminal (GIMP fails to read because mv happens instantly).

The Solution According to GIMP Developer Jehan (discussed in GNOME/gimp #14827), the correct way to maintain the script's intended sequential workflow (Edit -> Wait -> Re-import) is to force a new instance.

Adding the --new-instance flag forces GIMP to spawn a new process that blocks the terminal until that specific window is closed, preventing the race condition.

Proposed Change In contrib/gimp.lua, modify the command construction:
Lua

-- Current implementation (around line 99) gimpStartCommand = gimp_executable .. " " .. img_list

-- Proposed fix
gimpStartCommand = gimp_executable .. " --new-instance " .. img_list

Result of the Fix I verified this locally. With --new-instance, the script correctly waits for the editing session to close, the file remains available for GIMP to read, and the re-import to Darktable succeeds upon closing the window.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

contrib/gimp.lua を開き、99 行目付近の GIMP コマンドの構築を調べます。GIMP がすでに起動している状態でワークフローを再現し、その後、提案されたコマンド変更を適用して、編集セッションが待機し、ソースファイルが利用可能なままになり、GIMP を終了した後に darktable への再インポートが成功することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
desktop, tooling
issue の種類
バグ
難易度
1/5
見積もり時間
1時間未満
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
65/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。