Bug#1108072: darktable: db backup file has 0200 permision

Greg Schmidt greg at gwschmidt.com
Sat Jun 21 05:02:35 BST 2025


David,

Thanks for looking at this.

My umask is ok, and i have several database files and they are not at 
the default location. To reproduce the problem try this.

mkdir dtdir

     darktable --library dtdir/lib.db --cachedir dtdir/cache --configdir 
dtdir

I took a look at the change history and see the following changes. One 
of which changed the permissions on the empty backup file from S_IRUSR 
to S_IWUSR.

The unreadable file can not be backed up.

Greg


commit 40936ac868f25e60f1e99e680472516b16538c0f (tag: upstream/5.0.1, 
origin/upstream)
Author: Tino Mettler <tino+debian at tikei.de>
Date:   Sat Feb 15 20:32:09 2025 +0100

    New upstream version 5.0.1

diff --git a/src/common/database.c b/src/common/database.c
index b1a53d914..eda9d2e4c 100644
--- a/src/common/database.c
+++ b/src/common/database.c
@@ -4075,15 +4075,15 @@void dt_database_backup(const char *filename)
     if(g_file_test(filename, G_FILE_TEST_EXISTS))
     {
       copy_status = g_file_copy(src, dest, G_FILE_COPY_NONE, NULL, 
NULL, NULL, &gerror);
-      if(copy_status) copy_status = g_chmod(backup, S_IRUSR) == 0;
     }
     else
     {
       // there is nothing to backup, create an empty file to prevent 
further backup attempts
-      int fd = g_open(backup, O_CREAT, S_IRUSR);
+      const int fd = g_open(backup, O_CREAT, S_IWUSR);
       if(fd < 0 || !g_close(fd, &gerror)) copy_status = FALSE;
     }
-    if(!copy_status) dt_print(DT_DEBUG_ALWAYS, "[backup failed] %s -> 
%s", filename, backup);
+    if(!copy_status)



On 6/20/25 08:47, David Bremner wrote:
> Control: tag -1 unreproducible
>
> Greg Schmidt<greg at gwschmidt.com> writes:
>
>> greg at desk1:~Pictures$ find . -name *.db-pre* -ls
>> -snip-
>>    5902143      0 --w-------   1 greg     greg            0 Apr 26 03:44 ./new/2025/darktable.d/data.db-pre-5.0.1
>>    5902144      0 --w-------   1 greg     greg            0 Apr 26 03:44 ./new/2025/darktable.d/lib.db-pre-5.0.1
>>    5768426      0 -r--------   1 greg     greg            0 Oct 30  2024 ./new/darktable.d/lib.db-pre-4.8.1
>>    5768336      0 -r--------   1 greg     greg            0 Oct 30  2024 ./new/darktable.d/data.db-pre-4.8.1
>> -snip-
> ╭─ minkowski:~/.config/darktable
> ╰─% ls -l *.db-pre*
> -r-------- 1 bremner bremner        0 Apr 11  2023 data.db-pre-4.2.1
> -r-------- 1 bremner bremner   311296 Jul 17  2023 data.db-pre-4.4.2
> -r-------- 1 bremner bremner   655360 Jan 14  2024 data.db-pre-4.6.1
> -r-------- 1 bremner bremner   655360 May 23  2024 data.db-pre-4.8.0
> -r-------- 1 bremner bremner   655360 Jul 30  2024 data.db-pre-4.8.1
> -r-------- 1 bremner bremner   720896 Dec  7  2024 data.db-pre-5.0.0
> -rw-r--r-- 1 bremner bremner  2588672 Mar 22 10:32 data.db-pre-5.0.1
> -r-------- 1 bremner bremner        0 Apr 11  2023 library.db-pre-4.2.1
> -r-------- 1 bremner bremner 12386304 Jul 17  2023 library.db-pre-4.4.2
> -r-------- 1 bremner bremner 12124160 Jan 14  2024 library.db-pre-4.6.1
> -r-------- 1 bremner bremner 17399808 May 26  2024 library.db-pre-4.8.0
> -r-------- 1 bremner bremner 25329664 Jul 31  2024 library.db-pre-4.8.1
> -r-------- 1 bremner bremner 27394048 Jan  1 20:35 library.db-pre-5.0.0
> -rw-r--r-- 1 bremner bremner 31784960 Mar 23 06:35 library.db-pre-5.0.1
>
> Maybe check your umask?  I noticed that your backups are somewhere
> different than mine, and also named differently (lib vs library).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-phototools-devel/attachments/20250621/84337a09/attachment.htm>


More information about the Pkg-phototools-devel mailing list