fcitx / fcitx5

maybe a new fcitx.
1.6k stars 118 forks source link

Fcitx5 overwrites read-only config files, breaking immutable configuration managers like Nix #948

Closed pluiedev closed 8 months ago

pluiedev commented 9 months ago

Describe the bug Ditto. Any read-only config file will be overwritten when app setttings change.

To Reproduce Steps to reproduce the behavior:

  1. chmod -w ~/.config/fcitx5/profile to make profile read-only
  2. fcitx5 -r to reload Fcitx5
  3. Try adding an input method or otherwise tweak the profile
  4. stat -c %A ~/.config/fcitx5/profile will return -rw-------, showing that it has been made writable and replaced

Expected behavior Fcitx5 should log an error saying that it could not write to the config file, but otherwise nothing should change.

Desktop (please complete the following information):

  1. lsb_release:

    lsb_release not found.

  2. /etc/lsb-release:

    DISTRIB_CODENAME=uakari
    DISTRIB_DESCRIPTION="NixOS 24.05 (Uakari)"
    DISTRIB_ID=nixos
    DISTRIB_RELEASE="24.05"
    LSB_VERSION="24.05 (Uakari)"
  3. /etc/os-release:

    BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
    BUILD_ID="24.05.20240117.842d9d8"
    DOCUMENTATION_URL="https://nixos.org/learn.html"
    HOME_URL="https://nixos.org/"
    ID=nixos
    LOGO="nix-snowflake"
    NAME=NixOS
    PRETTY_NAME="NixOS 24.05 (Uakari)"
    SUPPORT_URL="https://nixos.org/community.html"
    VERSION="24.05 (Uakari)"
    VERSION_CODENAME=uakari
    VERSION_ID="24.05"
  4. Desktop Environment:

    Cannot determine desktop environment.

  5. XDG SESSION TYPE:

    XDG_SESSION_TYPE='wayland'
  6. Bash Version:

    BASH_VERSION='5.2.21(1)-release'

Environment:

  1. DISPLAY:

    DISPLAY=':0'
    
    WAYLAND_DISPLAY='wayland-1'
  2. Keyboard Layout:

    1. setxkbmap:

      setxkbmap not found.

    2. xprop:

      xprop not found.

  3. Locale:

    1. All locales:

      C
      C.utf8
      en_US.utf8
      POSIX
    2. Current locale:

      LANG=en_US.UTF-8
      LC_CTYPE="en_US.UTF-8"
      LC_NUMERIC="en_US.UTF-8"
      LC_TIME="en_US.UTF-8"
      LC_COLLATE="en_US.UTF-8"
      LC_MONETARY="en_US.UTF-8"
      LC_MESSAGES="en_US.UTF-8"
      LC_PAPER="en_US.UTF-8"
      LC_NAME="en_US.UTF-8"
      LC_ADDRESS="en_US.UTF-8"
      LC_TELEPHONE="en_US.UTF-8"
      LC_MEASUREMENT="en_US.UTF-8"
      LC_IDENTIFICATION="en_US.UTF-8"
      LC_ALL=
  4. Directories:

    1. Home:

      /home/leah
    2. ${XDG_CONFIG_HOME}:

      Environment variable XDG_CONFIG_HOME is set to /home/leah/.config.

      Current value of XDG_CONFIG_HOME is ~/.config (/home/leah/.config).

    3. Fcitx5 Settings Directory:

      Current fcitx5 settings directory is ~/.config/fcitx5 (/home/leah/.config/fcitx5).

  5. Current user:

    The script is run as leah (1000).

Fcitx State:

  1. executable:

    Found fcitx5 at /etc/profiles/per-user/leah/bin/fcitx5.

  2. version:

    Fcitx version: 5.1.6

  3. process:

    Found 2 fcitx5 processes:

     420345 .fcitx5-wrapped
     423066 fcitx5-diagnose
  4. fcitx5-remote:

    fcitx5-remote works properly.

  5. DBus interface:

    Using dbus-send to check dbus.

    Owner of DBus name org.fcitx.Fcitx5 is :1.233.

    PID of DBus name org.fcitx.Fcitx5 owner is 420345.

    Debug information from dbus:

       Group [wayland:] has 4 InputContext(s)
      IC [45971e5597c644bf8da8f6f0b2070ae4] program:vesktop frontend:wayland_v2 cap:100000052 focus:0
      IC [f9512922807c4c2d9f27c17bc8661f7e] program:firefox frontend:wayland_v2 cap:52 focus:0
      IC [3b14690c5f2e47b3a9c366867d7db129] program:kitty frontend:wayland_v2 cap:100000052 focus:0
      IC [ce98cee3f69447daa6a862534f1d633c] program: frontend:wayland_v2 cap:100000052 focus:0
    Group [x11::0] has 0 InputContext(s)
    Input Context without group

Fcitx Configure UI:

  1. Config Tool Wrapper:

    Found fcitx5-configtool at /etc/profiles/per-user/leah/bin/fcitx5-configtool.

  2. Config GUI for qt:

    Found fcitx5-config-qt at /etc/profiles/per-user/leah/bin/fcitx5-config-qt.

  3. Config GUI for kde:

    kcmshell5 not found.

Frontends setup:

The environment variable checked by this script only shows the environment under current shell. It is still possible that you did not set the environment to the whole graphic desktop session. You may inspect the actual environment variable of a certain process by using xargs -0 -L1 /proc/$PID/environ for a certain process that you find not working.

Xim:

  1. ${XMODIFIERS}:

    Environment variable XMODIFIERS is set to "@im=fcitx" correctly. Xim Server Name from Environment variable is fcitx.

  2. XIM_SERVERS on root window:

    xprop not found.

Qt:

  1. qt4 - ${QT4_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    fcitx5-qt4-immodule-probing not found.

  2. qt5 - ${QT_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt5-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=fcitx
    IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
  3. qt6 - ${QT_IM_MODULE}:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt6-immodule-probing to check the actual im module to be used under current environment:

    QT_QPA_PLATFORM=wayland
    QT_IM_MODULE=fcitx
    IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext
  4. Qt IM module files:

    Following error may not be accurate because guessing Qt version from path depends on how your distribution packages Qt. It is not a critical error if you do not use any Qt application with certain version of Qt or you are using text-input support by Qt under Wayland. Cannot find fcitx5 input method module for Qt4. Cannot find fcitx5 input method module for Qt5. Cannot find fcitx5 input method module for Qt6.

Gtk:

  1. gtk - ${GTK_IM_MODULE}:

    Environment variable GTK_IM_MODULE is set to "fcitx" correctly.

    fcitx5-gtk2-immodule-probing not found.

    Using fcitx5-gtk3-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx

    Using fcitx5-gtk4-immodule-probing to check the actual im module to be used under current environment:

    GTK_IM_MODULE=fcitx
  2. gtk-query-immodules:

    1. gtk 2:

      Cannot find gtk-query-immodules for gtk 2

      Cannot find fcitx5 im module for gtk 2.

    2. gtk 3:

      Cannot find gtk-query-immodules for gtk 3

      Cannot find fcitx5 im module for gtk 3.

  3. Gtk IM module cache:

    1. gtk 2:

      Cannot find immodules cache for gtk 2

      Cannot find fcitx5 im module for gtk 2 in cache.

    2. gtk 3:

      Cannot find immodules cache for gtk 3

      Cannot find fcitx5 im module for gtk 3 in cache.

  4. Gtk IM module files:

    1. gtk 2:

      All found Gtk 2 immodule files exist.

    2. gtk 3:

      All found Gtk 3 immodule files exist.

    3. gtk 4:

      All found Gtk 4 immodule files exist.

Configuration:

Fcitx Addons:

  1. Addon Config Dir:

    Found fcitx5 addon config directory: /nix/store/267sqgghd02dfama5w0qh3k7ggz73ik8-fcitx5-5.1.6/share/fcitx5/addon.

  2. Addon List:

    1. Found 20 enabled addons:

      Classic User Interface 5.1.6
      Clipboard 5.1.6
      DBus 5.1.6
      DBus Frontend 5.1.6
      Emoji 5.1.6
      Fcitx4 Frontend 5.1.6
      IBus Frontend 5.1.6
      Input method selector 5.1.6
      Keyboard 5.1.6
      KDE Input Method Panel 5.1.6
      Status Notifier 5.1.6
      Notification 5.1.6
      Quick Phrase 5.1.6
      Spell 5.1.6
      Unicode 5.1.6
      DBus Virtual Keyboard 5.1.6
      Wayland 5.1.6
      Wayland Input method frontend 5.1.6
      XCB 5.1.6
      X Input Method Frontend 5.1.6
    2. Found 0 disabled addons:

  3. Addon Libraries:

    All libraries for all addons are found.

  4. User Interface:

    Found 3 enabled user interface addons:

    Classic User Interface
    KDE Input Method Panel
    DBus Virtual Keyboard

Input Methods:

  1. /home/leah/.config/fcitx5/profile:

    [Groups/0]
    # Group Name
    Name=Default
    # Layout
    Default Layout=us
    # Default Input Method
    DefaultIM=rime
    
    [Groups/0/Items/0]
    # Name
    Name=keyboard-us
    # Layout
    Layout=
    
    [Groups/0/Items/1]
    # Name
    Name=rime
    # Layout
    Layout=
    
    [Groups/0/Items/2]
    # Name
    Name=mozc
    # Layout
    Layout=
    
    [GroupOrder]
    0=Default

Log:

  1. date:

    Fri Jan 19 12:57:02 PM CET 2024
  2. /home/leah/.config/fcitx5/crash.log:

    /home/leah/.config/fcitx5/crash.log not found.

Warning: the output of fcitx5-diagnose contains sensitive information, including the distribution name, kernel version, name of currently running programs, etc.

Though such information can be helpful to developers for diagnostic purpose, please double check and remove as necessary before posting it online publicly.

wengxt commented 9 months ago

fcitx uses write & replace for writing any files. So that's expected. You probably want to make .config/fcitx5 read only.