New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when attempting to open NEF files #6876
Comments
Cannot reproduce on a self-compiled RawTherapee both on 5.9 and dev. Unfortunately, the GDB report does not contain enough information because it is from a release build. If you are able to get your hands on a debug build and reproduce the crash, that would provide useful hints. You can also try the AppImage from the download page. If that works fine, the crash could be caused by something in the FreeBSD build. |
Yeah, AppImages are a Linux specific thing. |
I was able to reproduce this on both 13.2 and 14.0 FreeBSD. I found out that it works if I start this in GNOME session (gdm->gnome). If I use something else (such as openbox started by startx directly) it crashes. It seems to be related to ICC color profiles. Crash occurs here:
The code snippet from rtengine/color.cc:501
The wprof is NULL when not ran from GNOME session. When I modified the snippet above to see the values:
Working example:
Failing example
|
I did some testing - it seems these ICC color profiles are somehow set by GDM (I have no idea, till today I never heard about it).
I still think it's a problem that code assumes wprof will never be NULL but this way segfault can be avoided. |
Hi @Lawrence37, Yes, it seems the same issue. I played around with this a bit more. The problematic function: https://github.com/Beep6581/RawTherapee/blob/dev/rtengine/iccstore.cc#L505 Both in success and failure scenarios these ICC profiles are loaded. In the failing situation I found out that "sRGB" profile is the last profile in the map. Debug output of such scenario:
In this list you can see that profiles are there. But it just cannot find the last profile for some reason. In my patch I changed the "default" profile to "BestRGB" and it started working. It was working under gdm because "sRGB" was not the last profile loaded for some reason (WideGamut was). I'm not that familiar with C++, I don't do much in it. I tried to few things but nothing helped. I don't understand why it cannot find it. Checking memory location with gdb seems ok - expected values are there. |
I was in the middle of my comment when you wrote yours. I did want to send it, it if anything because I invested some time debugging it. The bug you linked - 6357 - and the PR it refers to is a solution to the problem. I don't do C++ much so I can't comment further. It seems locales are really pain. I guess it's just worth noting that the function expects to find something blindly and uses it further without any sanity check on the results. Especially if that function is locales sensitive. |
Those are interesting results. It does look like |
There is one thing I don't understand though. In my failing scenario ( no gdm, just startx starting gnome-session) it fails with the output I shared above. In my patch I changed the default profile to something else that is not the last element in map and it was working. If this is a locale issue why it is failing on last element of map only? I would expect it to fail the same way on the key "BestRGB" the same way it failed on "sRGB". But it really is working with the C.UTF-8 locale set as mentioned in PR. Maybe some sort of C++ weirdness? I dunno.. |
It's probably because of the way |
@martin-0 I created pull request #6889 which should fix the crash. @e14tech I'm not sure if the crash you encountered is the same as the one brought up by @martin-0. If you are not able to get a GDB report from a debug build or try the fix, you can try changing the locale like @martin-0 did (set the environment variable |
I added "LC_ALL=C.UTF-8" and it works now! |
Great! That means there's a high chance it's the same kind of crash. I'll close this issue and track future updates in #6357. |
ChangeLog: https://rawtherapee.com/downloads/5.10/#new-features We need to stick to GCC because LLVM-compiled code may take more than twice as much processing time as GCC-compiled does, for my test set comparing a few images with denoising and stuff on FreeBSD-14.0-RELEASE amd64 comparing GCC 12.3 to clang 16.0, and similar values on FreeBSD-13.2-RELEASE. Pin GCC to 12 and override -stdlib accordingly, to fix PR: 273682 Clean up Makefile a bit, but we cannot let go of the CCACHE workarounds yet, which we need when enforcing GCC compile. Convert some .if branches to options helpers. Make LTO an option that defaults to on. For some strange reason, massively-parallel compilation WITHOUT LTO appears to trigger OOM kills much more than an LTO-enabled build. Upstream states that LTO build should run faster. For one self-test that fails frequently with SIGPIPE (Exit code 141 is 128 for core dump + 13 for SIGPIPE), pipe through dd with bigger input buffer to avoid SIGPIPE/exit code 141 test failures. Replace echo by ${ECHO_CMD} in self-tests to appease portlint. Portlint misdetects "file system" as bare use of file though and suggests ${FILE}, which is wrong. Revise warnings around the CCACHE hacks because https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277204 strives to move ports to CCACHE_ENABLED, which does not work for this port. Also, 5.10 should fix the profile/locale related crash PR: 257255 by switching the std::map variable to use std::string as index, rather than Glib::ustring, which caused inconsistencies with locales. Upstream references (two bug reports, and the fix, in order): Beep6581/RawTherapee#6357 Beep6581/RawTherapee#6876 Beep6581/RawTherapee@a95a58a
Here is the gdb log info:
log.txt
I installed RawTherapee from the package repo for FreeBSD.
Here is the version info:
Version: 5.9
Branch: releases
Commit: 9b85839
Commit date: 2022-11-27
Compiler: cc 14.0.5
Processor: generic x86
System: Linux
Bit depth: 64 bits
Gtkmm: V3.24.2
Lensfun: V0.3.95.0
Build type: Release
Build flags: -O2 -pipe -I/usr/local/include -fPIC -flto=thin -O3 -funroll-loops -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -std=c++11 -mtune=generic -Werror=unused-label -Werror=delete-incomplete -fno-math-errno -Wno-attributes -Wall -Wuninitialized -Wcast-qual -Wno-deprecated-declarations -Wno-unused-result -Wunused-macros -fopenmp=libomp -Werror=unknown-pragmas -O2 -pipe -I/usr/local/include -fPIC -flto=thin -O3 -funroll-loops -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -DNDEBUG -ftree-vectorize
Link flags: -Wl,--as-needed -lpthread -flto=thin -O3 -funroll-loops -lm -lomp -fstack-protector-strong -L/usr/local/lib -mtune=generic
OpenMP support: true
MMAP support: ON
Build OS:
Build date: UTC
Build epoch:
Build UUID:
I'm running FreeBSD 13.2-RELEASE-p4.
To produce this issue:
Here is an NEF file:
https://drive.proton.me/urls/0891WA1DXC#jgR1f0bve4Uf
Here is the associated PP3 file:
https://drive.proton.me/urls/S8D38725KG#WyNFxfGHq1oZ
The text was updated successfully, but these errors were encountered: