From e3b407e555da9300d9e217cf7473f83c8f0effe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sat, 17 Oct 2020 07:35:52 +0200 Subject: [PATCH 1/2] Revert "softmaker-office: remove /bin/ls intercept" This reverts commit e883c6578c5550fd577c53eaa7d27f7c464377cc. --- .../applications/office/softmaker/generic.nix | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/office/softmaker/generic.nix b/pkgs/applications/office/softmaker/generic.nix index c1e25ecb00e..c7803fa3d1d 100644 --- a/pkgs/applications/office/softmaker/generic.nix +++ b/pkgs/applications/office/softmaker/generic.nix @@ -5,7 +5,7 @@ # For fixing up execution of /bin/ls, which is necessary for # product unlocking. -, coreutils +, coreutils, libredirect , pname, version, edition, suiteName, src, archive @@ -52,7 +52,22 @@ in stdenv.mkDerivation { runHook postUnpack ''; - installPhase = '' + installPhase = let + # SoftMaker/FreeOffice collects some system information upon + # unlocking the product. But in doing so, it attempts to execute + # /bin/ls. If the execve syscall fails, the whole unlock + # procedure fails. This works around that by rewriting /bin/ls + # to the proper path. + # + # SoftMaker Office restarts itself upon some operations, such + # changing the theme and unlocking. Unfortunately, we do not + # have control over its environment then and it will fail + # with an error. + lsIntercept = '' + --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \ + --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls" + ''; + in '' runHook preInstall mkdir -p $out/share @@ -61,9 +76,12 @@ in stdenv.mkDerivation { # Wrap rather than symlinking, so that the programs can determine # their resource path. mkdir -p $out/bin - makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker - makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations - makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker + makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \ + ${lsIntercept} + makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \ + ${lsIntercept} + makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \ + ${lsIntercept} for size in 16 32 48 64 96 128 256 512 1024; do mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps From c342e5a6dc98049b9ae91026fd7801a552057090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Sat, 17 Oct 2020 08:12:23 +0200 Subject: [PATCH 2/2] softmaker-office: add additional programs to PATH These seem to be needed for the SoftMaker/FreeOffice unlock code. If they are not added to PATH, startup takes a very long time and reports many segmentation faults. Fixes #71228. --- pkgs/applications/office/softmaker/generic.nix | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/office/softmaker/generic.nix b/pkgs/applications/office/softmaker/generic.nix index c7803fa3d1d..56f3cb74363 100644 --- a/pkgs/applications/office/softmaker/generic.nix +++ b/pkgs/applications/office/softmaker/generic.nix @@ -7,6 +7,9 @@ # product unlocking. , coreutils, libredirect + # Extra utilities used by the SoftMaker applications. +, gnugrep, utillinux, which + , pname, version, edition, suiteName, src, archive , ... @@ -59,13 +62,17 @@ in stdenv.mkDerivation { # procedure fails. This works around that by rewriting /bin/ls # to the proper path. # + # In addition, it expects some common utilities (which, whereis) + # to be in the path. + # # SoftMaker Office restarts itself upon some operations, such # changing the theme and unlocking. Unfortunately, we do not # have control over its environment then and it will fail # with an error. - lsIntercept = '' + extraWrapperArgs = '' --set LD_PRELOAD "${libredirect}/lib/libredirect.so" \ - --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls" + --set NIX_REDIRECTS "/bin/ls=${coreutils}/bin/ls" \ + --prefix PATH : "${stdenv.lib.makeBinPath [ coreutils gnugrep utillinux which ]}" ''; in '' runHook preInstall @@ -77,11 +84,11 @@ in stdenv.mkDerivation { # their resource path. mkdir -p $out/bin makeWrapper $out/share/${pname}${edition}/planmaker $out/bin/${pname}-planmaker \ - ${lsIntercept} + ${extraWrapperArgs} makeWrapper $out/share/${pname}${edition}/presentations $out/bin/${pname}-presentations \ - ${lsIntercept} + ${extraWrapperArgs} makeWrapper $out/share/${pname}${edition}/textmaker $out/bin/${pname}-textmaker \ - ${lsIntercept} + ${extraWrapperArgs} for size in 16 32 48 64 96 128 256 512 1024; do mkdir -p $out/share/icons/hicolor/''${size}x''${size}/apps