Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msmtp: need ping from inetutils on darwin #202277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

peterhoeg
Copy link
Member

Description of changes

Further to #195532.

This is untested but was faster than explaining what I meant.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.11 Release Notes (or backporting 22.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Nov 22, 2022
@peterhoeg
Copy link
Member Author

@dbaynard , do you mind trying this out on darwin?

@dbaynard
Copy link
Contributor

I'll do it this weekend — thanks

@dbaynard
Copy link
Contributor

Build failure for msmtp-scripts

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/rfiax9m3dkj3hiicf2rw9yb2mlw8cc96-msmtp-scripts-unresholved-1.8.22
source root is msmtp-scripts-unresholved-1.8.22
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "installPhase" }
installing
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
[resholve context] : invoking resholve with PWD=/nix/store/lb9gw3xpjgdx85kr75wgxcn75n13iv3y-msmtp-scripts-1.8.22
[resholve context] RESHOLVE_LORE=/nix/store/7a6896z5881d5652igdya8ccgamn3v1y-more-binlore
[resholve context] RESHOLVE_EXECER=cannot:/nix/store/lb9gw3xpjgdx85kr75wgxcn75n13iv3y-msmtp-scripts-1.8.22/bin/msmtpq
[resholve context] RESHOLVE_INPUTS=/nix/store/lb9gw3xpjgdx85kr75wgxcn75n13iv3y-msmtp-scripts-1.8.22/bin
[resholve context] RESHOLVE_INTERPRETER=/nix/store/49wn01k9yikhjlxc1ym5b6civ29zz3gv-bash-5.1-p16/bin/bash
[resholve context] /nix/store/v2bax5kvfvzcc1lddsdqn0fa1al0zf16-resholve-0.8.1/bin/resholve --overwrite bin/msmtp-queue
Overwrote '/nix/store/lb9gw3xpjgdx85kr75wgxcn75n13iv3y-msmtp-scripts-1.8.22/bin/msmtp-queue'
[resholve context] RESHOLVE_LORE=/nix/store/66zzqry5h6i6qsxq1mbblxvdyfqx8lsa-more-binlore
[resholve context] RESHOLVE_EXECER='cannot:/nix/store/8fzckwvpd2nhsnw4fza2kfw90h3vn1il-msmtp-binaries-1.8.22/bin/msmtp cannot:/nix/store/ywm8r5lkhf7di5y59afpfbmd9ly7lgim-netcat-gnu-0.7.1/bin/nc cannot:/nix/store/px7jn0sr110w7m2wk5iqrpzhd8zhjw9a-inetutils-2.4/bin/ping'
[resholve context] RESHOLVE_FAKE='external:'\''systemd-cat'\'''
[resholve context] RESHOLVE_FIX='$MSMTP:'\''msmtp'\'''
[resholve context] RESHOLVE_INPUTS=/nix/store/8fzckwvpd2nhsnw4fza2kfw90h3vn1il-msmtp-binaries-1.8.22/bin:/nix/store/v8y9sd43ygc27x4808asaymbk5nn4ild-coreutils-9.1/bin:/nix/store/nran2s5ihfjmpvhf832dqz3msr73hbhc-gnugrep-3.7/bin:/nix/store/ywm8r5lkhf7di5y59afpfbmd9ly7lgim-netcat-gnu-0.7.1/bin:/nix/store/3y79k8g2khvjaq68ljds2ff8d32rq7zb-which-2.21/bin:/nix/store/px7jn0sr110w7m2wk5iqrpzhd8zhjw9a-inetutils-2.4/bin
[resholve context] RESHOLVE_INTERPRETER=/nix/store/49wn01k9yikhjlxc1ym5b6civ29zz3gv-bash-5.1-p16/bin/bash
[resholve context] /nix/store/v2bax5kvfvzcc1lddsdqn0fa1al0zf16-resholve-0.8.1/bin/resholve --overwrite bin/msmtpq
      ping -qnc2 -w10 debian.org >/dev/null 2>&1 || return 1
      ^~~~
/nix/store/lb9gw3xpjgdx85kr75wgxcn75n13iv3y-msmtp-scripts-1.8.22/bin/msmtpq:215: There is not yet a good way to resolve 'ping' in Nix builds.

Next steps:
- Your feedback will help clarify the best course of action.
- See the workaround in the issue.

https://github.com/abathur/resholve/issues/29

(Also: your instructions in the issue were clear, but you got to the changes before I did!).

For context, I ran this:

nix build -L 'github:peterhoeg/nixpkgs/msmtp_darwin#msmtp-scripts'

Again, I can take a look at this over the weekend and try to get a version that works.

@dbaynard
Copy link
Contributor

Turns out resholve is not capable of handling ping (see abathur/resholve#29).

I strongly recommend using the fix that works for me: switching to use netcat on darwin. If the ping break affects anybody (the package already fails silently at runtime; this is a strict improvement) they can raise an issue.

I'm extremely annoyed with the situaiton here, and I appreciate this is a) not your fault, and b) an inevitability of a complex distributed system, like maintaining nixpkgs, so I don't blame anybody (including the resholve maintainer) either. Please bear with me (or just skip the next paragraph).

Rant

I've spent more time than I would have liked trying to figure out resholve, and as someone new to it, I must say it is a nightmare. I had to spelunk multiple repositories to try to figure out what it was doing, (going three deep, through resholve, then to binlore, and then to yallback, only to land with what could perhaps have been recursive sql queries into a bundled sqlite database). In addition to intransigent code, the documentation itself admits it is not suitable; it's also not visible! I eventually found nixpkgs/pkgs/development/misc/resholve at master · NixOS/nixpkgs and it doesn't help — the examples are less than useless (broken nix syntax). I see that resholve allows nix-naive packages to be integrated into nixpkgs, and we all benefit (I really like that it moves runtime failures to build time); however in its
current state, it is not fit for use.

While I'm not willing to spend any more time trying to figure out the resholve API, I am willing to help get this merged. So if you want me to persist with enabling ping, you (or someone else) will have to spend a while explaining it, to me.

Thanks for your time, and patience.

@abathur abathur mentioned this pull request Nov 28, 2022
13 tasks
@abathur
Copy link
Member

abathur commented Nov 28, 2022

Sorry you had a rough weekend. I wish you'd dropped by the issue for help earlier--it was linked at the end of the error message you quoted two days ago.

I managed to pull something together tonight to get you unblocked. I've cut a release and opened a PR for the update. For reference, this is what you'll need to take advantage of it once the update is in: abathur@44fb86b

@dbaynard I'd like to circle back with you in private about the rant, though I'll also follow up to address a bit of this in public for later travellers.

@abathur
Copy link
Member

abathur commented Nov 28, 2022

Turns out resholve is not capable of handling ping (see abathur/resholve#29).

The issue here both isn't strictly that resholve can't handle ping. It's that some executables need setuid security wrappers which are handled outside of the normal function of basic Nix. Nix will give resholve an apparently-fine path to the executable, but it won't actually be runnable because it isn't wrapped. It's a trap no matter how we slice it.

I'll be overjoyed to throw this Nix-specific stumbling block out of resholve once there's a solution on the Nix/nixpkgs side. For now, it's there to keep people from making broken packages, raise awareness about the problem, help me gather information about where it crops up, and hopefully shake a creative solution loose.

@dbaynard
Copy link
Contributor

As mentioned privately, I didn't have a rough weekend! Thanks for the concern.

I'm happy to pick up the testing, if necessary, once the update to resholve has been merged.

@abathur
Copy link
Member

abathur commented Nov 30, 2022

@peterhoeg resholve update is merged, so you should be able to use fix.ping = true to get resholve to go ahead and try to resolve the ping command.

I noticed while discussing with David that (AFAICT) the ~regression here happened in peterhoeg@70220e7, which undid the hard-set EMAIL_CONN_TEST=n that you added back in 1c46605.

Since I've been able to use the Nix-built ping commands without the setuid wrapper, I suspect that only some flags in ping require setuid. Both of the ping commands in msmtpq worked fine for me in a pure nix-shell with inetutils on macOS and with both inetutils and iputils on NixOS. I'm not absolutely certain that the ~best fix is using this new resholve option (as opposed to restoring the env), but it seems like the right path if I'm not missing anything.

@wegank
Copy link
Member

wegank commented Dec 18, 2022

@ofborg build msmtp msmtp.passthru.tests

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 18, 2023
@FliegendeWurst FliegendeWurst added the needs_reviewer (old Marvin label, do not use) label Nov 29, 2024
@SigmaSquadron SigmaSquadron removed the needs_reviewer (old Marvin label, do not use) label Jan 5, 2025
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux 11.by: package-maintainer This PR was created by the maintainer of the package it changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants