Project

General

Profile

Bug #12339

Collection selection is without effect

Added by Damian D. Martinez Dreyer 3 months ago. Updated 25 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Lighttable
Target version:
-
Start date:
09/23/2018
Due date:
% Done:

0%

Affected Version:
git master branch
System:
other GNU/Linux
bitness:
64-bit
hardware architecture:
amd64/x86

Description

With the current git build, I am unable to narrow down the lighttable by selecting a collection.
I can select them or create new ones (tags, film rolls), but in any case, all pictures are shown on the lighttable.

History

#1 Updated by Damian D. Martinez Dreyer 3 months ago

Build commit 93445e533.
Manjaro with Linux 4.18 and 4.19rc

Deps:
pugixml 1.9-1
libjpeg-turbo 2.0.0-1
colord-gtk 0.1.26+5+ga9d9c91-1
libgphoto2 2.5.19-1
openexr 2.3.0-1
lensfun-git 0.3.2.r1455.gb984163-1
iso-codes 3.79-1
exiv2 0.26-2
flickcurl 1.26-5
openjpeg2 2.3.0-3
graphicsmagick 1.3.30-3
lua 5.3.5-1
osm-gps-map 1.1.0-3
libsecret 0.18.6-1

#2 Updated by Ulrich Pegelow 2 months ago

I have experienced the same or a similar issue. For me it occured all of a sudden when working with recent git master. Whatever I would set in "collect images" the lighttable shows the full collection in my database without being able to restrict it.

In my case this seems to be triggered by some entries in darktablerc. For me it has been sufficient to remove all items in that file starting with "plugins/lighttable/collect". Restarting darktable after these changes once again shows all images. But now I can go into the "collect images" panel and define to show only the images of a certain film roll which now works as it should.

#3 Updated by Wolfgang Goetz about 1 month ago

same happened here an hour ago. release-2.5.0-809-g473fe0045
many thanks to Ulrich for the quick hack in darktablerc!

#4 Updated by Ulrich Pegelow about 1 month ago

Maybe someone with a deeper understanding of that module may have a look. Here are the relevant config strings from darktablerc which seem to have triggered the issue for me.

plugins/lighttable/collect/expanded=TRUE
plugins/lighttable/collect/item0=0
plugins/lighttable/collect/item1=7
plugins/lighttable/collect/item10=3
plugins/lighttable/collect/item11=3
plugins/lighttable/collect/item12=3
plugins/lighttable/collect/item2=3
plugins/lighttable/collect/item3=3
plugins/lighttable/collect/item4=3
plugins/lighttable/collect/item5=3
plugins/lighttable/collect/item6=3
plugins/lighttable/collect/item7=3
plugins/lighttable/collect/item8=3
plugins/lighttable/collect/item9=3
plugins/lighttable/collect/mode0=2
plugins/lighttable/collect/mode1=0
plugins/lighttable/collect/mode10=0
plugins/lighttable/collect/mode11=0
plugins/lighttable/collect/mode12=0
plugins/lighttable/collect/mode2=0
plugins/lighttable/collect/mode3=0
plugins/lighttable/collect/mode4=0
plugins/lighttable/collect/mode5=0
plugins/lighttable/collect/mode6=0
plugins/lighttable/collect/mode7=0
plugins/lighttable/collect/mode8=0
plugins/lighttable/collect/mode9=0
plugins/lighttable/collect/num_rules=1
plugins/lighttable/collect/string0=/home/pegelow/Bilder/Industriekultur
plugins/lighttable/collect/string1=Grün
plugins/lighttable/collect/string10=darktable|format|tif
plugins/lighttable/collect/string11=Sevastopol
plugins/lighttable/collect/string12=Sevastopol
plugins/lighttable/collect/string2=darktable|format|cr2
plugins/lighttable/collect/string3=darktable|format|cr2
plugins/lighttable/collect/string4=darktable|format|cr2
plugins/lighttable/collect/string5=darktable|format|cr2
plugins/lighttable/collect/string6=darktable|format|cr2
plugins/lighttable/collect/string7=darktable|format|cr2
plugins/lighttable/collect/string8=darktable|format|cr2
plugins/lighttable/collect/string9=darktable|format|cr2

#5 Updated by Ariel Glenn 25 days ago

I've seen this on the master branch since April 2018. Finally poked around on master (from 7fc642218e2fbd25cd31745a1e415e387b46a8d4) today. With old working darktable I see sql queries like:

[sql] /builddir/build/BUILD/darktable-2.4.4/src/common/collection.c:1207, function dt_collection_update_query(): prepare "DELETE FROM main.selected_images WHERE imgid NOT IN (SELECT DISTINCT id FROM main.images WHERE   (flags & 256) != 256 AND ((film_id IN (SELECT id FROM main.film_rolls WHERE folder LIKE '/home/ariel/Εικόνες/2018/incoming74'))) ORDER BY filename, version LIMIT ?1, ?2)" 

With new build I see queries like:

[sql] /home/ariel/src/darktable/src/common/collection.c:1210, function dt_collection_update_query(): prepare "DELETE FROM main.selected_images WHERE imgid NOT IN (SELECT DISTINCT id FROM main.images WHERE   (flags & 256) != 256 AND (1=1 OR (film_id IN (SELECT id FROM main.film_rolls WHERE folder LIKE '/home/ariel/Εικόνες/2018/incoming73'))) ORDER BY filename, version LIMIT ?1, ?2)" 

That 1=1 clause is a problem. It appears to come from common/collection.c/dt_collection_get_extended_where which was introduced in https://github.com/darktable-org/darktable/pull/1581/commits/d8f833680268b3f0cd5c285fe47e213448b72ac7

I patched a local copy thus:

-  gchar *where_ext = dt_util_dstrcat(NULL, "(1=1%s)", complete_string);
+  gchar *where_ext = NULL;
+  if (g_str_has_prefix(complete_string, (gchar *)" OR ")) {
+    where_ext = dt_util_dstrcat(NULL, "(1=0%s)", complete_string);
+  }
+  else {
+    where_ext = dt_util_dstrcat(NULL, "(1=1%s)", complete_string);
+  }

It may break compound or other queries now but at least collection filtering by film works. Resulting query is now:

[sql] /home/ariel/src/darktable/src/common/collection.c:1453, function dt_collection_update_query(): prepare "DELETE FROM main.selected_images WHERE imgid NOT IN (SELECT DISTINCT id FROM main.images WHERE   (flags & 256) != 256 AND (1=0 OR (film_id IN (SELECT id FROM main.film_rolls WHERE folder LIKE '/home/ariel/Εικόνες/2018/incoming62'))) ORDER BY filename, version LIMIT ?1, ?2)" 

I didn't try to sort through all the darktablerc settings, or test anything else. Someone who actually knows this code and has looked at it for more than a few minutes should please check things out. Thanks!

Also available in: Atom PDF