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

tmux module: Fix escaping in TMUX_TMPDIR #62136

Merged
merged 1 commit into from May 31, 2019
Merged

Conversation

flokli
Copy link
Contributor

@flokli flokli commented May 27, 2019

5404595 relocated code but kept
one backslah too many, leading to

$ tmux
error creating /run/user/1000/tmux-1000 (No such file or directory)

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Yarny0
Copy link
Contributor

Yarny0 commented May 30, 2019

Review per https://nixos.org/nixpkgs/manual/#reviewing-contributions-module-updates

Reviewed points
  • changes are backward compatible
  • removed options are declared with mkRemovedOptionModule (none)
  • changes that are not backward compatible are documented in release notes (none)
  • module tests succeed on ARCHITECTURE (no tests available)
  • options types are appropriate (not changed)
  • options description is set (not changed)
  • options example is provided (not changed)
  • documentation affected by the changes is updated (none)
Possible (but certainly not necessary) improvements
  • The commit message could be changed to match the format given in https://nixos.org/nixpkgs/manual/#submitting-changes-making-patches , e.g. "nixos/tmux: Fix escaping in TMUX_TMPDIR".
  • I cannot reproduce the error message in the commit message's body. When the issue occurs (with this pull request applied), I'm seeing this instead: error creating /run/user/$(id -u)/tmux-1234 (No such file or directory). Maybe the commit message was accidentally passed through a shell?
Comments
  • I had a hard time to exact the bug fixed by this pull request as -- under normal circumstances -- pam_systemd correctly sets XDG_RUNTIME_DIR and the default value for TMUX_TMPDIR is not needed. In case someone else wants to investigate why the default value (thus the pull request at hand) is helpful: I added a systemd user service that sleeps 30 seconds while starting and thereby provokes a timeout in pam_systemd during login which prevents XDG_RUNTIME_DIR from being set. This renders tmux unable to start without this pull request.
  • With this pull request applied, tmux works even without XDG_RUNTIME_DIR.
  • The tmux.nix module has no maintainer set.
  • I recommend merging this (trivial) pull requests.

5404595 relocated code but kept
one backslah too many, leading to

	$ tmux
	error creating /run/user/$(id -u)/tmux-1000 (No such file or directory)

/run/user/$UID/ is created by pam_systemd(3) which also populates
XD_RUNTIME_DIR with that value.

Alternatively, TMUX_TMPDIR might simply default to XDG_RUNTIME_DIR
without providing the same directory yet again as default string in
parameter substitution, however such behaviour change is subject to
another patch.

In fact, with `security.polkit.enable = false` systemd_logind(8) fails
to start and /run/user/$UID/ is never created for unprivileged users
in proper login sessions;  XDG_RUNTIME_DIR would consequently not be
set either.

Removing the fallback to /run/user/$UID/ would have caused TMUX_TMPDIR
to be empty, which in turn would lead tmux(1) to use /tmp/.  This
effectively breaks the idea of isolated sockets entirely while hiding
errors from the user.
@andir
Copy link
Member

andir commented May 31, 2019

@Yarny0 I pushed a newer version of the commit (with a more descriptive message). Does it make more sense to you now?

@Yarny0
Copy link
Contributor

Yarny0 commented May 31, 2019

@Yarny0 I pushed a newer version of the commit (with a more descriptive message). Does it make more sense to you now?

Yes, thank! I didn't know about the connection of /run/user with polkit.
I have no further objections.

@andir andir merged commit d9238d7 into NixOS:master May 31, 2019
@flokli flokli deleted the tmux-tmpdir branch October 15, 2019 09:35
@flokli flokli mentioned this pull request Oct 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants