about summary refs log tree commit diff
path: root/pkgs/applications/graphics/hugin
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-12-05 22:26:38 -0800
committerAdam Joseph <adam@westernsemico.com>2022-12-05 22:28:03 -0800
commitccdfaa8de744a01cd46aaef748ddba5bb46ab1d2 (patch)
treef02d229dee04d19cd2f11ca322c998d2de2fb5f7 /pkgs/applications/graphics/hugin
parent7b81ec9be58bf441b067bc8678de8f9d97f3c48b (diff)
hugin: cherrypick fix for segfault on empty XDG_DATA_DIR
Hugin segfaults if the environment variable XDG_DATA_DIR is unset
(rather than being the empty string).  Upstream has committed a fix
in edfddc6070ca6d4223d359fb4b38273a5aed2f2d but has not released it
(hugin releases are *very* infrequent).

Let's cherry-pick the fix since it might be a while before they
manage another release.
Diffstat (limited to 'pkgs/applications/graphics/hugin')
-rw-r--r--pkgs/applications/graphics/hugin/default.nix6
-rw-r--r--pkgs/applications/graphics/hugin/dont-crash-if-XDG_DATA_DIRS-not-set-edfddc6070ca6d4223d359fb4b38273a5aed2f2d.patch14
2 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/hugin/default.nix b/pkgs/applications/graphics/hugin/default.nix
index 3e68a4b9467d5..925175e5bf616 100644
--- a/pkgs/applications/graphics/hugin/default.nix
+++ b/pkgs/applications/graphics/hugin/default.nix
@@ -43,6 +43,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-BHrqin+keESzTvJ8GdO2l+hJOdyx/bvrLCBGIbZu6tk=";
   };
 
+  patches = [
+    # committed upstream but unreleased:
+    #   https://sourceforge.net/p/hugin/hugin/ci/edfddc6070ca6d4223d359fb4b38273a5aed2f2d
+    ./dont-crash-if-XDG_DATA_DIRS-not-set-edfddc6070ca6d4223d359fb4b38273a5aed2f2d.patch
+  ];
+
   buildInputs = [
     boost
     cairo
diff --git a/pkgs/applications/graphics/hugin/dont-crash-if-XDG_DATA_DIRS-not-set-edfddc6070ca6d4223d359fb4b38273a5aed2f2d.patch b/pkgs/applications/graphics/hugin/dont-crash-if-XDG_DATA_DIRS-not-set-edfddc6070ca6d4223d359fb4b38273a5aed2f2d.patch
new file mode 100644
index 0000000000000..d38e07a595e8b
--- /dev/null
+++ b/pkgs/applications/graphics/hugin/dont-crash-if-XDG_DATA_DIRS-not-set-edfddc6070ca6d4223d359fb4b38273a5aed2f2d.patch
@@ -0,0 +1,14 @@
+--- a/src/hugin_base/hugin_utils/utils.cpp	2022-12-05 22:19:26.873574924 -0800
++++ b/src/hugin_base/hugin_utils/utils.cpp	2022-12-05 22:19:09.069575641 -0800
+@@ -472,9 +472,9 @@
+ #else
+ #ifdef USE_XDG_DIRS
+     char *xdgDataDir = getenv("XDG_DATA_HOME");
+-    if (strlen(xdgDataDir) == 0)
++    if (xdgDataDir == NULL || strlen(xdgDataDir) == 0)
+     {
+-        // no XDG_DATA_HOME enviroment variable set
++        // no XDG_DATA_HOME enviroment variable set or empty variable
+         // use $HOME/.local/share instead
+         const  std::string homeDir = GetHomeDir();
+         if (homeDir.empty())