diff options
author | Stefan Frijters <sfrijters@gmail.com> | 2020-10-01 13:13:44 +0200 |
---|---|---|
committer | Stefan Frijters <sfrijters@gmail.com> | 2021-02-27 17:55:58 +0100 |
commit | 580cf02c1967c6338058862fbe3724b57a559a39 (patch) | |
tree | 7b65f110a7866a25930b0bbc575aa5abe152d88e | |
parent | ee713d36bccc0a98b7c46fc4830ab48bc808c421 (diff) | |
download | nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar.gz nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar.bz2 nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar.lz nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar.xz nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.tar.zst nixpkgs-580cf02c1967c6338058862fbe3724b57a559a39.zip |
nixos/x11: Be more defensive when removing XCOMPOSECACHE
-rw-r--r-- | nixos/modules/services/x11/display-managers/default.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/nixos/modules/services/x11/display-managers/default.nix b/nixos/modules/services/x11/display-managers/default.nix index a70a7b6e9b5..e04fcdaf414 100644 --- a/nixos/modules/services/x11/display-managers/default.nix +++ b/nixos/modules/services/x11/display-managers/default.nix @@ -70,8 +70,12 @@ let # Speed up application start by 50-150ms according to # http://kdemonkey.blogspot.nl/2008/04/magic-trick.html compose_cache="''${XCOMPOSECACHE:-$HOME/.compose-cache}" - rm -rf "$compose_cache" mkdir -p "$compose_cache" + # To avoid accidentally deleting a wrongly set up XCOMPOSECACHE directory, + # defensively try to delete cache *files* only, following the file format specified in + # https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/modules/im/ximcp/imLcIm.c#L353-358 + # sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); + ${pkgs.findutils}/bin/find "$compose_cache" -maxdepth 1 -regextype posix-extended -regex '.*/[Bl][0-9]+_[0-9a-f]{3}_[0-9a-f]{8}_[0-9a-f]{8}' -delete unset compose_cache # Work around KDE errors when a user first logs in and |