Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: [email protected], Jody Bruchon <[email protected]>
Control: affects -1 + src:jdupes
User: [email protected]
Usertags: pu

[ Reason ]
Jody Bruchon, the jdupes author, told me that the hash database feature is
disabled due to a conditional logic error introduced in v1.28.0 during the
major hashdb changes.

The condition was inadvertently written with the opposite logic, completely
disabling the hash database functionality.

[ Impact ]
This does not affect the correctness of jdupes results or pose any data
integrity risk, but causes a significant performance regression, especially
when processing large, unchanging datasets where the hash database provides
substantial performance improvements.

Several Debian packages use jdupes during the package build process.

[ Tests ]
Some manual tests were performed to confirm that the package works fine after
fixing the issue.

[ Risks ]
This is a small and straightforward change provided by upstream, with no
expected risks.

[ Checklist ]
  [x] *all* changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in (old)stable
  [x] the issue is verified as fixed in unstable

[ Changes ]
A small patch provided by upstream was applied. This fix is closing the bug
#1148491.

[ Other info ]
No more info.
diff -Nru jdupes-1.28.0/debian/changelog jdupes-1.28.0/debian/changelog
--- jdupes-1.28.0/debian/changelog      2025-10-05 22:45:33.000000000 -0300
+++ jdupes-1.28.0/debian/changelog      2026-09-19 23:18:35.000000000 -0300
@@ -1,3 +1,12 @@
+jdupes (1.28.0-1+deb13u2) trixie; urgency=medium
+
+  * debian/patches/030_fix-hashdb.patch: created to fix a conditional logic
+    error that disabled the hash database feature, resulting in a significant
+    performance regression for large, unchanging datasets. Thanks to Jody
+    Bruchon <[email protected]> (upstream). (Closes: #1148491)
+
+ -- Joao Eriberto Mota Filho <[email protected]>  Sat, 19 Sep 2026 23:18:35 
-0300
+
 jdupes (1.28.0-1+deb13u1) trixie; urgency=medium
 
   * debian/patches/020_fix-uniq-count.patch: created to fix flag overlap
diff -Nru jdupes-1.28.0/debian/patches/030_fix-hashdb.patch 
jdupes-1.28.0/debian/patches/030_fix-hashdb.patch
--- jdupes-1.28.0/debian/patches/030_fix-hashdb.patch   1969-12-31 
21:00:00.000000000 -0300
+++ jdupes-1.28.0/debian/patches/030_fix-hashdb.patch   2026-09-19 
23:18:35.000000000 -0300
@@ -0,0 +1,63 @@
+Description: Fix a conditional logic error that disables the hash database 
feature
+             The incorrect condition was introduced in v1.28.0 and caused the
+             hash database to be completely disabled.
+Author: Jody Bruchon <[email protected]>
+Origin: upstream
+Bug-Debian: https://bugs.debian.org/1148491
+Last-Update: 2026-09-02
+Index: jdupes-1.28.0/hashdb.c
+===================================================================
+--- jdupes-1.28.0.orig/hashdb.c
++++ jdupes-1.28.0/hashdb.c
+@@ -530,19 +530,24 @@ int read_hashdb_entry(file_t *file)
+   if (file == NULL || file->d_name == NULL) goto error_null;
+   if (get_path_hash(file->d_name, file->d_name_len, &path_hash) != 0) goto 
error_path_hash;
+   bucket = path_hash & HT_MASK;
+-  if (hashdb[bucket] == NULL) return 0;
++  if (hashdb[bucket] == NULL) goto end_read_hashdb;
+   cur = hashdb[bucket];
+   while (1) {
+     if (cur->path_hash != path_hash) {
+       if (path_hash < cur->path_hash) cur = cur->left;
+       else cur = cur->right;
+-      if (cur == NULL) return 0;
++      if (cur == NULL) goto end_read_hashdb;
+       continue;
+     }
+     /* Found a matching path hash */
+-    if (cur->pathlen == file->d_name_len && memcmp(cur->path, file->d_name, 
cur->pathlen) == 0) {
++    LOUD(fprintf(stderr, "read_hashdb_entry: found a matching path hash\n");)
++    if ((cur->pathlen != file->d_name_len) || (memcmp(cur->path, 
file->d_name, cur->pathlen) != 0)) {
++      LOUD(fprintf(stderr, "read_hashdb_entry: name check failed, not 
populating (%u != %u, '%s' != '%s', cmp %d)\n",
++                            cur->pathlen, file->d_name_len,
++                            cur->path, file->d_name,
++                            memcmp(cur->path, file->d_name, cur->pathlen));)
+       cur = cur->left;
+-      if (cur == NULL) return 0;
++      if (cur == NULL) goto end_read_hashdb;
+       continue;
+     } else {
+       /* Found a matching path too but check mtime */
+@@ -552,10 +557,12 @@ int read_hashdb_entry(file_t *file)
+       if (cur->size  != file->size)  exclude |= 4;
+       if (exclude != 0) {
+         /* Invalidate if something has changed */
++        LOUD(fprintf(stderr, "read_hashdb_entry: metadata changed, 
invalidating entry\n");)
+         cur->hashcount = 0;
+         hashdb_dirty = 1;
+         return -1;
+       }
++      LOUD(fprintf(stderr, "read_hashdb_entry: copying hash data to file 
entry\n");)
+       file->filehash_partial = cur->partialhash;
+       if (cur->hashcount == 2) {
+         file->filehash = cur->fullhash;
+@@ -564,6 +571,9 @@ int read_hashdb_entry(file_t *file)
+       return 1;
+     }
+   }
++
++end_read_hashdb:
++  LOUD(fprintf(stderr, "read_hashdb_entry: exhausted hash scan\n");)
+   return 0;
+ 
+ error_null:
diff -Nru jdupes-1.28.0/debian/patches/series 
jdupes-1.28.0/debian/patches/series
--- jdupes-1.28.0/debian/patches/series 2025-10-05 22:45:33.000000000 -0300
+++ jdupes-1.28.0/debian/patches/series 2026-09-19 23:18:35.000000000 -0300
@@ -1,2 +1,3 @@
 010_fix-FTBFS-Hurd.patch
 020_fix-uniq-count.patch
+030_fix-hashdb.patch

Reply via email to