Skip to content
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

bug: xdg.mime.enabled = true causes crash when encountering a .json file #4955

Closed
2 tasks done
MyNameIs-13 opened this issue Jan 25, 2024 · 5 comments · Fixed by #5920
Closed
2 tasks done

bug: xdg.mime.enabled = true causes crash when encountering a .json file #4955

MyNameIs-13 opened this issue Jan 25, 2024 · 5 comments · Fixed by #5920
Assignees
Labels
bug status: stale triage Issues or feature request that have not been triaged yet

Comments

@MyNameIs-13
Copy link

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

Intro and Workaround

Not sure if I'm supposed to add information to issue 4682 or create a new one.
Sorry in case I chose the wrong approach. (sounds like a different problem, even though the same fix/workaround can be used)

Originally posted by @hexclover in #4682 (comment)

For me setting xdg.mime.enable = false; in home-manager also works

Problem description and steps to reproduce:

encountering1 a .json file crashes a lot of programs2 in at least Gnome and KDE

I first encountered the problem on bare metal PopOS 22.04
and then reproduced it with (quickemu) VMs (Kubuntu 23.10, Ubuntu 23.10, Fedora 39)

For the tests in the VMs I used the following code (but also tested once with a multiuser install)

echo 1 >> ~/Downloads/foo.json
sudo apt install -y curl
sh <(curl -L https://nixos.org/nix/install) --no-daemon --yes
. "/home/${USER}/.nix-profile/etc/profile.d/nix.sh"
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install

Then rebooted and tried to access/open the .json file

Maintainer CC

No response

System information

- system: `"x86_64-linux"`
 - host os: `Linux 6.6.10-76060610-generic, Pop!_OS, 22.04 LTS, nobuild`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - nixpkgs: `/home/foobar/.nix-defexpr/channels/nixpkgs`

Footnotes

  1. (with 'encountering' I mean clicking it in file explorer apps or opening it in editor apps)

  2. Explicitly tested Nautilus, gedit, new gnome Text Editor (no idea what the name is), thunar and Dolphin.

@MyNameIs-13 MyNameIs-13 added bug triage Issues or feature request that have not been triaged yet labels Jan 25, 2024
@anibali
Copy link

anibali commented Feb 8, 2024

This sounds like the same issue I ran into, so I'll add my findings in case they're helpful. From my testing I found that crashes occurred with both .json and .js files, and that the file must be non-empty for the crash to occur. Crashes still occur when the file is hidden. I also found that the issue does not exist in home-manager 23.11.

@jonknapp
Copy link

Similar to my issue, it's occurring when I try to create a zip file as well. I am running home manager + nix on PopOS.

I just started to rebuild my dotfiles from scratch to try and track down the issue. Mine crashes as soon as I introduce targets.genericLinux.enable = true; to my home manager configuration. For me, xdg.enable = false; had no effect on stopping the crashes.

@jonknapp
Copy link

Disregard my comment. While related, it's more applicable to #4682.

@0xlynett
Copy link

0xlynett commented Apr 7, 2024

I'm having the same issue.

I believe it has something to do with a mismatch between the home-manager shared-mime-info version and the default version of that package (we have shared-mime-info-2.4 according to home-manager packages but the latest version for Pop is 2.1-2)

Setting xdg.mime.enabled = false fixes the issue.

Running home-manager 23.11.

Copy link

stale bot commented Jul 6, 2024

Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.

If you are the original author of the issue

  • If this is resolved, please consider closing it so that the maintainers know not to focus on this.
  • If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

If you are not the original author of the issue

  • If you are also experiencing this issue, please add details of your situation to help with the debugging process.
  • If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.

Memorandum on closing issues

Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.

@stale stale bot added the status: stale label Jul 6, 2024
notalltim added a commit to notalltim/home-manager that referenced this issue Oct 1, 2024
The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here ?????), resolve nix-community#4955, nix-community#5102
, nix-community#4682, and possibly nix-community#4941. The problem seems to stem from a mismatch
in the version of `shared-mime-info` with the host.
notalltim added a commit to notalltim/home-manager that referenced this issue Oct 1, 2024
The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here ?????), resolve nix-community#4955, nix-community#5102
, nix-community#4682, and possibly nix-community#4941. The problem seems to stem from a mismatch
in the version of `shared-mime-info` with the host.
notalltim added a commit to notalltim/home-manager that referenced this issue Oct 1, 2024
The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here notalltim/home-mananger-config#4),
resolve nix-community#4955, nix-community#5102, nix-community#4682, and possibly nix-community#4941. The problem seems to stem
from a mismatch in the version of `shared-mime-info` with the host.
notalltim added a commit to notalltim/home-manager that referenced this issue Oct 1, 2024
The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here notalltim/home-manager-config#4),
resolve nix-community#4955, nix-community#5102, nix-community#4682, and possibly nix-community#4941. The problem seems to stem
from a mismatch in the version of `shared-mime-info` with the host.

I also switched from using `buildPackages` to `pkgs` to improve
cross-compilation compatibility.
@teto teto closed this as completed in #5920 Oct 7, 2024
@teto teto closed this as completed in 0386303 Oct 7, 2024
Mikilio pushed a commit to Mikilio/home-manager that referenced this issue Oct 11, 2024
* xdg-mime: allow overrides to shared-mime-info and desktop-file-utils

The `xdg-mime` module now exposes packages to determine what will be run
for update-mime-database and update-desktop-database. This allows users
to select a different version of these packages if the are incompatible.
This should, in combination with an override to the version of
`shared-mime-info` (can be found here notalltim/home-manager-config#4),
resolve nix-community#4955, nix-community#5102, nix-community#4682, and possibly nix-community#4941. The problem seems to stem
from a mismatch in the version of `shared-mime-info` with the host.

I also switched from using `buildPackages` to `pkgs` to improve
cross-compilation compatibility.

* xdg-mime: Add tests for xdg-mime module

The xdg-mime module was missing tests so I added basic test for all the
options and checked the basic behavior. It covers ensuring that the
proper files/folders are created and that the package overrides work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status: stale triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants