NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.1k stars 14.15k forks source link

barman cron tries to run barman wrapper script with python #135238

Closed treed closed 2 years ago

treed commented 3 years ago

Describe the bug

The barman cron command is supposed to run minutely to launch various barman-related commands. However, it is hard-coded to prepend the command with a python interpreter. It is getting a real python interpreter, but the barman which is in the path is not Python, but a shell wrapper script.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install barman
  2. Add a cron for barman
  3. Cron fails to run correctly

The cron config in question:

    services.cron = {
      enable = true;
      systemCronJobs = [
        "* * * * * barman ${pkgs.systemd}/bin/systemd-cat -t barman-cron ${pkgs.barman}/bin/barman -c /etc/barman.conf -q cron --keep-descriptors"
      ];
    };

Expected behavior

barman cron is able to execute its various subprocesses

Screenshots

Aug 22 02:21:07 neta barman-cron[2578]: SyntaxError: invalid syntax Aug 22 02:21:07 neta barman-cron[2577]: File "/nix/store/a731yhifww58ixxbafrgkmraal1wcv0f-barman-2.12/bin/barman", line 2 Aug 22 02:21:07 neta barman-cron[2577]: export PATH='/nix/store/4s0h5aawbap3xhldxhcijvl26751qrjr-python3-3.8.9/bin:/nix/store/a731yhifww58ixxbafrgkmraal1wcv0f-barman-2.12/bin:/nix/store/22l1yckhf52hyyjnz14b77zbcqffph8j-python3.8-jmespath-0.10.0/bin:/nix/store/74hn6s7fa8k0qf20hj9f9vm92j6r4npf-python3.8-docutils-0.16/bin:/nix/store/i3lcb8bsy3vailhmnn9lwa9kaw9f3fdg-python3.8-argcomplete-1.12.2/bin:/nix/store/8hw5xh692ihfdzrv64rj3afxkj2fsi5r-python3.8-chardet-4.0.0/bin'${PATH:+':'}$PATH

You can see the execve call from strace here:

[pid 2560] execve("/nix/store/4s0h5aawbap3xhldxhcijvl26751qrjr-python3-3.8.9/bin/python3.8", ["/nix/store/4s0h5aawbap3xhldxhcijvl26751qrjr-python3-3.8.9/bin/python3.8", "/nix/store/a731yhifww58ixxbafrgkmraal1wcv0f-barman-2.12/bin/barman", "-c", "/etc/barman.conf", "-q", "receive-wal", "zenithia"], 0x7ffcbd6fa408 / 30 vars / <unfinished ...>

Notify maintainers

@freezeboy

Metadata

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

 - system: `"x86_64-linux"`
 - host os: `Linux 5.10.43, NixOS, 21.05.961.1f91fd10406 (Okapi)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.12`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute: barman
# a list of nixos modules affected by the problem
module:
freezeboy commented 3 years ago

As this "feature" is intended to use the correct python executable (and nix already handles this properly), i propose to patch de file command_wrapper.py:1012 and remove the sys.executable from the command line.

treed commented 3 years ago

Yeah, I figured the fix would involve something like that. Sounds reasonable to me.

On Aug 22, 2021, at 08:05, freezeboy @.***> wrote:

 As this "feature" is intended to use the correct python executable (and nix already handles this properly), i propose to patch de file command_wrapper.py:1012 and remove the sys.executable from the command line.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

rembo10 commented 3 years ago

Hi do you guys want to check out #142098 and let me know what might need to be patched with the update. i can update the PR

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info