Bug 440197

Summary: Not loading any JPG file but load & display DNG/TIFF
Product: [Applications] digikam Reporter: RFDupuis <rogerfdupuis>
Component: Plugin-DImg-JPEGAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: metzpinguin
Priority: NOR    
Version: 7.3.0   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In: 7.4.0
Sentry Crash Report:
Attachments: Output after using: export QT_LOGGING_RULES="digikam*=true

Description RFDupuis 2021-07-23 15:04:54 UTC
SUMMARY
Just imported about 75,000 photos. None of the JPG photos are displayed. DNG/TIFF do show after quite a while.
Photos files are read from a network (Synology NAS) connected to the same local router. Running on Ubuntu
Also not reading any metadata


STEPS TO REPRODUCE
1. Import
2. 
3. 

OBSERVED RESULT
None of the JPG being displayed.

EXPECTED RESULT
Expecting to see all JPG photos

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 RFDupuis 2021-07-23 15:11:04 UTC
KDE Frame work 5.79.0
Qt 5.15.2
Comment 2 Maik Qualmann 2021-07-23 15:38:24 UTC
Is the digiKam version a snap package? If so, try our AppImage.

Maik
Comment 3 Maik Qualmann 2021-07-23 21:08:54 UTC
It is a shame that there are no up-to-date native digiKam packages for Ubuntu and Debian. We do not support Snap packages that use a sandbox. You can try to install the Snap package in Classic mode.

*** This bug has been marked as a duplicate of bug 439581 ***
Comment 4 RFDupuis 2021-07-25 03:56:18 UTC
Update: I move some picture files from the Network server (NAS) to a local hard drive and the JPG files are properly shown...
Comment 5 Maik Qualmann 2021-07-25 05:21:53 UTC
You did not reply to Comment 2. There are currently no known problems with network drives. To help, we need at least a complete terminal log with activated debug variable as described here:

https://www.digikam.org/contribute/

Maik
Comment 6 RFDupuis 2021-07-30 21:15:07 UTC
Created attachment 140418 [details]
Output after using: export QT_LOGGING_RULES="digikam*=true
Comment 7 Maik Qualmann 2021-07-31 20:11:08 UTC
This is a very strange problem and I don't think the bug is in digiKam.
First of all, Exiv2 cannot load metadata !!!
Loading via the JPG extension fails !!!
digiKam now checks the magic bytes and correctly finds 0xFF 0xD8 - a JPG file.
The JPG Loader checks again for 0xFF 0xD8 and rewinds to the beginning of the file with rewind(). The Libjpeg now identifies the 2 following bytes 0xFF 0xE0 and of course refuses it as a JPG file.

So your filesystem doesn't seem to support file positioning like rewind() for example. We could perhaps do a workaround for our JPG loader, but Exiv2 does not work with your file system either - you must repair your file system.

Maik
Comment 8 Maik Qualmann 2021-07-31 20:42:49 UTC
Git commit 7041168a8707d071bbedc0f612dff86cb1d078cc by Maik Qualmann.
Committed on 31/07/2021 at 20:41.
Pushed by mqualmann into branch 'master'.

remove extra check on a JPG file to avoid rewind ()
Libjpeg checks the Magic Bytes 0xFF, 0xD8.
FIXED-IN: 7.4.0

M  +0    -21   core/dplugins/dimg/jpeg/dimgjpegloader_load.cpp

https://invent.kde.org/graphics/digikam/commit/7041168a8707d071bbedc0f612dff86cb1d078cc
Comment 9 Maik Qualmann 2021-07-31 20:44:46 UTC
This will fix the loading of JPG files, but your mounted filesystem is not suitable for digiKam.

Maik
Comment 10 Maik Qualmann 2021-07-31 21:00:45 UTC
Git commit 276f52e692dc9fc43927d7e4edc7dd2d625c8447 by Maik Qualmann.
Committed on 31/07/2021 at 20:59.
Pushed by mqualmann into branch 'master'.

remove rewind() in the Jpeg2000 loader

M  +0    -26   core/dplugins/dimg/jpeg2000/dimgjpeg2000loader_load.cpp

https://invent.kde.org/graphics/digikam/commit/276f52e692dc9fc43927d7e4edc7dd2d625c8447
Comment 11 RFDupuis 2021-08-01 04:11:19 UTC
First, thank you for your detailed response in a very short time ! I am impressed.
But... I dont understand your comment about fixing this issue.
If I use the same computer and access the JPG files on the NAS, I see these pics no problem. I tried the same from a MacBook. So the JPG files are fine.
By curiosity, I tried the same setup I use for digiKam but did use the trial version of AfterShot from Corel and I got the same result than I got with digiKam.
So I agree with you that the problem do not seem to be in digikam.
I notice that to access these remote file, I dont use the same path because digikam do not show me the remote drive that I mapped. This may be the problem. If digikam could show me the same remote drive that my Ubuntu or my Mac give me, the problem may not be there...
I am very confuse. I sure would like to use the NAS to store my pics bu tuse digiKam to manage them.
Again, I very appreciate your time on this issue.
Comment 12 Maik Qualmann 2021-08-01 05:40:02 UTC
You have connected your NAS via FTP protocol. In this case, only linear reading of the file is possible, but programs cannot seek or rewind within the file. This is what some programs need. See the old bug report:

https://gitlab.gnome.org/GNOME/gvfs/-/issues/78

Your NAS provides additional protocols so that you can establish a connection at the file level, such as SMB or NFS.

Maik