darktable-org / darktable-org/lua-scripts
Lua Script GIMP doesn't waits for GIMP locks when it's previously opened
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Lua
- Estrellas
- 219
- Forks
- 142
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Abre contrib/gimp.lua e inspecciona la construcción del comando de GIMP alrededor de la línea 99. Reproduce el flujo de trabajo con GIMP ya en ejecución, aplica después el cambio de comando propuesto y verifica que la sesión de edición espere, que el archivo de origen siga disponible y que la reimportación en darktable se realice correctamente después de cerrar GIMP.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- lua
- Área
- desktop, tooling
- Tipo de issue
- Error
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 65/100