Bug 498077

Summary: digitaglinktree fails with blkid and does wrong uuid extraction [patch]
Product: [Applications] digikam Reporter: Dr. Jürgen Hannappel <juergen>
Component: Setup-CLIAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version First Reported In: 8.5.0   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 8.6.0
Sentry Crash Report:

Description Dr. Jürgen Hannappel 2024-12-31 08:50:29 UTC
SUMMARY
at least on opensuse tumbleweed digitaglinktree fails in the getAlbumRoots{() function trying to use blkid

STEPS TO REPRODUCE
1.   call digitaglinktree

OBSERVED RESULT
digitaglinktree -d /data/fotos/digikam4.db -l $(pwd)/tags
Cannot find device /dev/disk/by-uuid/ae0e20a3-b7eb-4ac1-9ecc-d91992003348 or  ..../AE0E20A3-B7EB-4AC1-9ECC-D91992003348. Skipped.
Processed 0 photos. 


EXPECTED RESULT
normal operation

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
I traced the problem to two issues:
On opensuse a call like
    $uuiddev=`blkid -U $uuid`;
 fails because some nanny script says:
   Absolute path to 'blkid' is '/usr/sbin/blkid', so running it may require superuser privileges (eg. root).
Fix: Use:
   $blkid = `PATH=\$PATH:/usr/sbin/ which blkid`
   chomp $blkid
   $uuiddev=`$blkid -U $uuid`;

Other issue: Extracxing the uuid from the identifier with
   $uuid=$identifier;
   $uuid=~s/^.*uuid=//i;
Doesn't work,
  ($uuid) = $identifier =~ /\?uuid=([-0-9a-z]+)\&/;
does..


So the total diff to fix the bug would be:
diff digitaglinktree /usr/bin/digitaglinktree
839,841c839,840
< 	 $blkid = `PATH=\$PATH:/usr/sbin/ which blkid`;
< 	 chomp $blkid;
<          ($uuid) = $identifier =~ /\?uuid=([-0-9a-z]+)\&/;
---
> 	 $uuid=$identifier;
> 	 $uuid=~s/^.*uuid=//i; 
844c843
< 	    $uuiddev=`$blkid -U $uuid`;
---
> 	    $uuiddev=`blkid -U $uuid`;
847c846
< 	    $uuiddev=`$blkid -U $ucuuid`;
---
> 	    $uuiddev=`blkid -U $ucuuid`;
Comment 1 caulier.gilles 2024-12-31 09:11:42 UTC
Git commit a0ee498d87329b71fe93fff576017afaaef306d4 by Gilles Caulier.
Committed on 31/12/2024 at 09:10.
Pushed by cgilles into branch 'master'.

Apply patch from Jürgen Hannappel
FIXED-IN: 8.6.0

M  +5    -4    core/data/scripts/digitaglinktree/digitaglinktree

https://invent.kde.org/graphics/digikam/-/commit/a0ee498d87329b71fe93fff576017afaaef306d4