NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.16k stars 14.19k forks source link

sgdisk crashes with segmentation fault, can't create partition in GNOME Disks #219775

Closed ElnuDev closed 1 year ago

ElnuDev commented 1 year ago

Describe the bug

When creating a partition of any type in GNOME Disks, it throws the following error:

Error creating partition on /dev/sdc: Failed to determine /nix/store/dvx2w3x83i8qrrdhr4xxhnv7zvjvl9jc-gptfdisk-1.0.9/bin/sgdisk's version from: Process killed with a signal (udisks-error-quark, 0)

I'm assuming this isn't an issue upstream.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Go to a disk such as a USB stick in GNOME Disks that has free space
  2. Create a new partition

Expected behavior

GNOME Disks successfully creates the partition.

Notify maintainers

@NixOS/gnome @ehmry

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[elnu@elnu:~]$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.00 MiB download, 0.00 MiB unpacked):
  /nix/store/x6yjkzgmdppwi95y4gvm4lxi6q27936s-nix-info
copying path '/nix/store/x6yjkzgmdppwi95y4gvm4lxi6q27936s-nix-info' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.0, NixOS, 23.05 (Stoat), 23.05.20230226.7f5639f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
jtojnar commented 1 year ago

Looks like gptfdisk bug, sgdisk --version just crashes:

#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74
#1  0x00007fe7bb29b6c2 in __GI___strdup (s=0x0) at strdup.c:41
#2  0x000000000041e07c in GPTDataCL::DoOptions(int, char**) ()
#3  0x00000000004046fb in main ()

cc @ehmry

ElnuDev commented 1 year ago

Seems like all sgdisk commands fail with Segmentation fault (core dumped)

amarshall commented 1 year ago

Performed bisect on 22.11. cc @yu-re-ka

3ec8d0d5586257ddde2f3c528a1bef6932fd3c6a is the first bad commit

commit 3ec8d0d5586257ddde2f3c528a1bef6932fd3c6a
Author: Yureka <yuka@yuka.dev>
Date:   Sun Oct 16 12:19:32 2022 +0200

    gptfdisk: fix runtime problems with popt 1.19

 pkgs/tools/system/gptfdisk/default.nix     |  5 +++++
 pkgs/tools/system/gptfdisk/popt-1-19.patch | 13 +++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100644 pkgs/tools/system/gptfdisk/popt-1-19.patch

Reverting atop both release-22.11 and master results in sgdisk --version no longer segfaulting, however then it has the problem the above commit seems to be trying to solve.

ehmry commented 1 year ago

Could the problem be with popt?

amarshall commented 1 year ago

Prospective fix: https://github.com/NixOS/nixpkgs/pull/221066

ElnuDev commented 1 year ago

Seems to no longer be an issue after updating to 6c43a3495a11e261e5f41e5d7eda2d71dae1b2fe.