diff options
author | Andrew Marshall | 2024-04-02 18:56:14 -0400 |
---|---|---|
committer | Andrew Marshall | 2024-04-02 19:26:16 -0400 |
commit | 49e6c686f870addfd89b7fc3af68141a57659aee (patch) | |
tree | dc29c2dc38accae36118436bd6288842069dd8e7 /pkgs/os-specific/linux/mdadm | |
parent | 269f5806e0523962932659a454ff097a27f526f5 (diff) |
mdadm: Fix hardcoded directory
In [upstream change][1], handling of creating `/run/mdadm/creating-%s` file was changed to fail if it was unable to create the file. This revealed that the path itself incorrectly hardcodes `/run/mdadm` instead of using `MAP_DIR` or similar. Since nixpkgs sets `RUN_DIR=/run/.mdadm` at compile time, and `MAP_DIR=$(RUN_DIR)` in upstream, the `/run/mdadm` is never created. This remedies by fixing the hard-coded directory. [1]: https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/commit/?id=9f376da6439b07dc93ae084ab576e133b9d8d839
Diffstat (limited to 'pkgs/os-specific/linux/mdadm')
-rw-r--r-- | pkgs/os-specific/linux/mdadm/default.nix | 5 | ||||
-rw-r--r-- | pkgs/os-specific/linux/mdadm/fix-hardcoded-mapdir.patch | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/pkgs/os-specific/linux/mdadm/default.nix b/pkgs/os-specific/linux/mdadm/default.nix index 14a3589aff33..e9e90b3c388b 100644 --- a/pkgs/os-specific/linux/mdadm/default.nix +++ b/pkgs/os-specific/linux/mdadm/default.nix @@ -9,7 +9,10 @@ stdenv.mkDerivation rec { sha256 = "sha256-QWcnrh8QgOpuMJDOo23QdoJvw2kVHjarc2VXupIZb58="; }; - patches = [ ./no-self-references.patch ]; + patches = [ + ./no-self-references.patch + ./fix-hardcoded-mapdir.patch + ]; makeFlags = [ "NIXOS=1" "INSTALL=install" "BINDIR=$(out)/sbin" diff --git a/pkgs/os-specific/linux/mdadm/fix-hardcoded-mapdir.patch b/pkgs/os-specific/linux/mdadm/fix-hardcoded-mapdir.patch new file mode 100644 index 000000000000..cf50d6012487 --- /dev/null +++ b/pkgs/os-specific/linux/mdadm/fix-hardcoded-mapdir.patch @@ -0,0 +1,13 @@ +diff --git a/udev.c b/udev.c +index bc4722b0..aa2a1a24 100644 +--- a/udev.c ++++ b/udev.c +@@ -167,7 +167,7 @@ enum udev_status udev_block(char *devnm) + int fd; + char *path = xcalloc(1, BUFSIZ); + +- snprintf(path, BUFSIZ, "/run/mdadm/creating-%s", devnm); ++ snprintf(path, BUFSIZ, "%s/creating-%s", MAP_DIR, devnm); + + fd = open(path, O_CREAT | O_RDWR, 0600); + if (!is_fd_valid(fd)) { |