NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.99k stars 14.01k forks source link

pythonPackages.dbus-next fails to build #197408

Closed archer-65 closed 1 year ago

archer-65 commented 2 years ago

Steps To Reproduce

Try building qtile-0.22.1

Build log

error: builder for '/nix/store/ymnmr0kr6v2gwwc5rcyv39311gidw9rp-python3.10-dbus-next-0.2.3.drv' failed with exit code 1;
       last 10 log lines:
       > dbus_next/proxy_object.py              134     24    82%
       > dbus_next/service.py                   282     17    94%
       > dbus_next/signature.py                 258     50    81%
       > dbus_next/validators.py                 66      6    91%
       > --------------------------------------------------------
       > TOTAL                                 2835    600    79%
       >
       > =========================== short test summary info ============================
       > FAILED test/test_tcp_address.py::test_tcp_connection_with_forwarding - Assert...
       > ============ 1 failed, 73 passed, 7 skipped, 1 deselected in 1.99s =============
       For full logs, run 'nix log /nix/store/ymnmr0kr6v2gwwc5rcyv39311gidw9rp-python3.10-dbus-next-0.2.3.drv'.
error: 1 dependencies of derivation '/nix/store/xf1nfx10frcqjxl0vyfapnqd5vdb6gp1-python3.10-qtile-0.22.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/g3qz7qqf64vmz78dgdxg5lifgbg3zyra-qtile-0.22.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/adrwnbiqcvdm63wfi8siy9m1101s47pl-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jqpzadgg7dd0wclx0l3njv0pcc0zvqp0-xsession.drv' failed to build
error: 1 dependencies of derivation '/nix/store/61fid3r582xhqj9fl98praqi9g2x15jl-nixos-system-quietfrost-22.11.20221022.95aeaf8.drv' failed to build

Details

=================================== FAILURES ===================================
_____________________ test_tcp_connection_with_forwarding ______________________

event_loop = <_UnixSelectorEventLoop running=False closed=False debug=False>

    @pytest.mark.asyncio
    async def test_tcp_connection_with_forwarding(event_loop):
        closables = []
        host = '127.0.0.1'
        port = '55556'

        addr_info = parse_address(os.environ.get('DBUS_SESSION_BUS_ADDRESS'))
        assert addr_info
>       assert 'abstract' in addr_info[0][1]
E       AssertionError: assert 'abstract' in {'guid': '7af5804b347fbb67d5e05b5363558be6', 'path': '/tmp/dbus-FiRdGeuhNS'}

test/test_tcp_address.py:18: AssertionError

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.0.0, NixOS, 22.11 (Raccoon), 22.11.20221012.f634d42`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.0`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
SFrijters commented 2 years ago

Just ran into the same problem when updating my system flake. For bisecting purposes, nixpkgs 61a8739e25aff217d3c706f376187398d10cd39c was my previous (working) configuration.

EDIT: bisection in progress, have to do some large builds now:

$ git bisect log
git bisect start
# status: waiting for both good and bad commits
# bad: [86ad681303d9bc567cca762b239f3fde0b951d64] Merge pull request #194195 from r-ryantm/auto-update/gnuplot
git bisect bad 86ad681303d9bc567cca762b239f3fde0b951d64
# status: waiting for good commit(s), bad commit known
# good: [61a8739e25aff217d3c706f376187398d10cd39c] Merge pull request #195676 from K900/oracle-fixes
git bisect good 61a8739e25aff217d3c706f376187398d10cd39c
# good: [ba90bab628277d977d3a381e91d4ce0af4ea4f91] Merge pull request #196781 from 9999years/fix-ormolu-fourmolu-darwin-aarch64
git bisect good ba90bab628277d977d3a381e91d4ce0af4ea4f91
# bad: [c43416535429396cc99bccf16e7fbe4c0adea4cf] Merge master into staging-next
git bisect bad c43416535429396cc99bccf16e7fbe4c0adea4cf
# bad: [62bcf0ac6285e98583d42b41649bd3d1aaab6896] Merge staging-next into staging
git bisect bad 62bcf0ac6285e98583d42b41649bd3d1aaab6896
# good: [448bb9bbaecd27e90e3a20b761736db25c939e87] vimUtils.buildVimPlugin: prevent building twice
git bisect good 448bb9bbaecd27e90e3a20b761736db25c939e87
SFrijters commented 2 years ago
Bisecting: 0 revisions left to test after this (roughly 0 steps)
[bdb347b42cf507871d5b0c0a3bd632ba0cec8018] dbus: 1.14.0 -> 1.14.4

Excerpt from https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-1.14.4/NEWS :

Behaviour changes:

• On Linux, dbus-daemon and other uses of DBusServer now create a
  path-based Unix socket, unix:path=..., when asked to listen on a
  unix:tmpdir=... address. This makes unix:tmpdir=... equivalent to
  unix:dir=... on all platforms.
  Previous versions would have created an abstract socket, unix:abstract=...,
  in this situation.

which seems to be the change that breaks python3Packages.dbus-next, so we probably need to file an upstream dbus-next issue.

SFrijters commented 2 years ago

https://github.com/altdesktop/python-dbus-next/issues/135

archer-65 commented 2 years ago

As a workaround, something like this should work:

dbus = super.dbus.overrideAttrs (old: rec {
  version = "1.14.0";

  src = pkgs.fetchurl {
    url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.xz";
    sha256 = "sha256-zNfM43WW4KGVWP1mSNEnKrQ/AR2AyGNa6o/QutWK69Q=";
  };
});
vcunat commented 2 years ago

Note that the downgrade would undo some security fixes; see PR #195264 ... which is also why we backported this problem to 22.05.

archer-65 commented 2 years ago

Note that the downgrade would undo some security fixes; see PR #195264 ... which is also why we backported this problem to 22.05.

I see...I'll wait to re-enable qtile then

SFrijters commented 2 years ago

Depending on how much value you place on the failing test, something like this worked for me:

  pypkgs = (python3.override {
    packageOverrides = self: super: {
      # https://github.com/NixOS/nixpkgs/issues/197408
      dbus-next = super.dbus-next.overridePythonAttrs (old: {
        checkPhase = builtins.replaceStrings ["not test_peer_interface"] ["not test_peer_interface and not test_tcp_connection_with_forwarding"] old.checkPhase;
      });
    };
  }).pkgs;

Modifying the package in a general overlay triggered huge rebuilds for me, so I've just replaced it inside my maestral-qt derivation, which is what pulls in dbus-next in my system configuration.

Panadestein commented 2 years ago

@SFrijters How would you modify the package with a general overlay? Something like this didn't work for me:

(self: super: {
      python3 = super.python3.override {
         packageOverrides = pyself: pysuper: {
            dbus-next = pysuper.dbus-next.overridePythonAttrs (old: {
                checkPhase = builtins.replaceStrings ["not test_peer_interface"] ["not test_peer_interface and not test_tcp_connection_with_forwarding"] old.checkPhase;
            });
        };
     };
 })
arjan-s commented 2 years ago

This global overlay works for me, without annoying rebuilds:

self: super: {
  python3Packages = super.python3Packages.override {
    overrides = pfinal: pprev: {
      dbus-next = pprev.dbus-next.overridePythonAttrs (old: {
        # temporary fix for https://github.com/NixOS/nixpkgs/issues/197408
        checkPhase = builtins.replaceStrings ["not test_peer_interface"] ["not test_peer_interface and not test_tcp_connection_with_forwarding"] old.checkPhase;
      });
    };
  };
}

Note, I'm using flake-utils-plus and this is imported in sharedOverlays. I don't know if you can use it without modifications otherwise.

SFrijters commented 2 years ago

I have a similar setup, I have (minus the let bindings I have in my config):

nixpkgs.overlays = [
  (final: prev: {
    python3 = prev.python3.override {
      packageOverrides = self: super: {
        # https://github.com/NixOS/nixpkgs/issues/197408
        dbus-next = super.dbus-next.overridePythonAttrs (old: {
          checkPhase = builtins.replaceStrings ["not test_peer_interface"] ["not test_peer_interface and not test_tcp_connection_with_forwarding"] old.checkPhase;
        });
      };
    };
  })
   ...
];

@Panadestein So I don't see the difference between our configs...

Panadestein commented 2 years ago

Somehow, the overlay proposed by @arjan-s worked. This reaches about the limits of my Nix knowledge, but maybe python3Packages is required instead of simply python3? Is the only difference I can notice.