Commit da3e9f8b authored by Alyssa Ross's avatar Alyssa Ross
Browse files

elogind: 246.10 -> 255.5

parent fbc59729
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
From 3a0181ab0fb6c40f613894e65009e148c6e652c9 Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Mon, 16 Sep 2024 10:24:08 +0200
Subject: [PATCH] Remove outdated musl hack in rlimit_nofile_safe

This was incorrect, because RLIM_FMT is not the format specifier for uintmax_t.

Since 53e84063a ("Change RLIM_FMT to '%llu' for non-glibc builds (#269)"),
RLIM_FMT is correct for musl, so there's no longer any need for this casting
version.

Link: https://github.com/elogind/elogind/pull/288
---
 src/basic/rlimit-util.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
index 091c111df..59bdc35a0 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
@@ -428,11 +428,7 @@ int rlimit_nofile_safe(void) {
         rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
         rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
         if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
-#ifdef __GLIBC__ /// To be compatible with musl-libc, elogind uses an (uintmax_t) cast.
                 return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
-#else // __GLIBC__
-                return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
-#endif // __GLIBC__
 
         return 1;
 }
-- 
2.45.2
+69 −7
Original line number Diff line number Diff line
{ stdenv
, lib
, fetchFromGitHub
, fetchurl
, fetchpatch
, meson
, ninja
, m4
, gperf
, getent
, acl
, audit
, dbus
, libcap
, libselinux
, pam
, gettext
, pkg-config
, udev
, eudev
, util-linux
, libxslt
, python3Packages
, docbook5
@@ -27,13 +35,13 @@

stdenv.mkDerivation rec {
  pname = "elogind";
  version = "246.10";
  version = "255.5";

  src = fetchFromGitHub {
    owner = "elogind";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-+Nv6FL9Yjmfxs24+2mUTP//wbjzGUq4ftgJLfuEqBJg=";
    hash = "sha256-4KZr/NiiGVwzdDROhiX3GEQTUyIGva6ezb+xC2U3bkg=";
  };

  nativeBuildInputs = [
@@ -48,12 +56,63 @@ stdenv.mkDerivation rec {
    libxslt.bin # xsltproc
    docbook5 docbook_xsl docbook_xsl_ns docbook_xml_dtd_42 docbook_xml_dtd_45 # needed for docbook without Internet

    # fixes: man/meson.build:111:0: ERROR: Could not execute command "/build/source/tools/xml_helper.py".
    python3Packages.python
    python3Packages.lxml
    python3Packages.jinja2
  ];

  buildInputs = [ libcap ] ++ (if enableSystemd then [ udev ] else [ eudev ]);
  buildInputs = [ acl audit dbus libcap libselinux pam util-linux ]
    ++ (if enableSystemd then [ udev ] else [ eudev ]);

  postPatch = ''
    substituteInPlace meson.build --replace-fail "install_emptydir(elogindstatedir)" ""
  '';

  patches = [
    (fetchurl {
      url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r.patch";
      hash = "sha256-amqXP12mLtrkWuAURb3/aoQeeTSRYlYqL2q2zrKbhxk=";
    })
    (fetchurl {
      url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/strerror_r_1.patch";
      hash = "sha256-tVUlmPValUPApqRX+Cqkzn7bkIILYSuCouvgRsdl9XE=";
    })
    (fetchpatch {
      url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/xxx-musl-fixes.patch";
      includes = [
        "src/basic/cgroup-util.c"
        "src/basic/missing_prctl.h"
        "src/libelogind/sd-journal/journal-file.h"
      ];
      hash = "sha256-kY+B1t87E/TtWa83r0VoiojhRrrB667ZhUAHtHE7m28=";
    })
    (fetchurl {
      url = "https://github.com/chimera-linux/cports/raw/49d65fe38be815b9918a15ac2d2ff2b123fc559a/main/elogind/patches/gshadow.patch";
      hash = "sha256-YBy1OeWD1EluLTeUvqUvZKyrZyoUbGg1mxwqG5+VNO0=";
    })
    (fetchurl {
      name = "FTW.patch";
      url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
      hash = "sha256-SGvP0GT43vfyHxrmvl4AbsWQz8CPmNGyH001s3lTxng=";
    })
    (fetchurl {
      name = "malloc_info.patch";
      url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
      hash = "sha256-8aOw+BTtl5Qta8aqLmliKSHEirTjp1xLM195EmBdEDI=";
    })
    (fetchpatch {
      name = "malloc_trim.patch";
      url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
      stripLen = 3;
      extraPrefix = [ "src/libelogind/" ];
      hash = "sha256-rtSnCEK+frhnlwl/UW3YHxB8MUCAq48jEzQRURpxdXk=";
    })
    (fetchurl {
      name = "malloc_info.patch";
      url = "https://git.openembedded.org/openembedded-core/plain/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch?id=6bc5e3f3cd882c81c972dbd27aacc1ce00e5e59a";
      hash = "sha256-ZyOCmM5LcwJ7mHiZr0lQjV4G+XMxjhsUm7g7L3OzDDM=";
    })
    ./0001-Remove-outdated-musl-hack-in-rlimit_nofile_safe.patch
  ];

  # Inspired by the systemd `preConfigure`.
  # Conceptually we should patch all files required during the build, but not scripts
@@ -68,8 +127,11 @@ stdenv.mkDerivation rec {
  '';

  mesonFlags = [
    "-Drootprefix=${placeholder "out"}"
    "-Dsysconfdir=${placeholder "out"}/etc"
    (lib.mesonOption "dbuspolicydir" "${placeholder "out"}/share/dbus-1/system.d")
    (lib.mesonOption "dbussystemservicedir" "${placeholder "out"}/share/dbus-1/system-services")
    (lib.mesonOption "sysconfdir" "${placeholder "out"}/etc")
    (lib.mesonBool "utmp" (!stdenv.hostPlatform.isMusl))
    (lib.mesonEnable "xenctrl" false)
  ];

  meta = with lib; {