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

Make SSHMaster::startCommand work on an args list #9833

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Jan 22, 2024

Motivation

This avoids split-on-whitespace errors:

  • No more bash -c needed

  • No more shellEscape needed

  • remote-program ssh store setting also cleanly supports args (e.g. nix daemon)

  • ssh uses -- to separate args for SSH from args for the command to run.

and will help with Hydra dedup: NixOS/hydra#1339

Context

Some code taken from #6628.

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the store Issues and pull requests concerning the Nix store label Jan 22, 2024
This avoids split-on-whitespace errors:

- No more `bash -c` needed

- No more `shellEscape` needed

- `remote-program` ssh store setting also cleanly supports args (e.g.
  `nix daemon`)

- `ssh` uses `--` to separate args for SSH from args for the command to
  run.

and will help with Hydra dedup.

Some code taken from NixOS#6628.

Co-Authored-By: Alexander Bantyev <[email protected]>
@Ericson2314 Ericson2314 changed the title Make SSH::startCommand work on an args list Make SSHMaster::startCommand work on an args list Jan 22, 2024
Ericson2314 added a commit to NixOS/hydra that referenced this pull request Jan 22, 2024
NixOS/nix#9833

Flake lock file updates:

• Updated input 'nix':
    'github:NixOS/nix/74534829f23b668fb9b2f2a14ff6afa4d5e71d4a' (2024-01-22)
  → 'github:obsidiansystems/nix/b71673109c2172cb1f933cc8a97c26b4352ac239' (2024-01-22)
Copy link
Member

@thufschmitt thufschmitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I'm just a bit concerned about it accidentally breaking the semantics of remote-program in some cases (because we're now the ones doing the word splitting instead of the shell). Does something like remote-program = some\ thing\ with\ escaped" and quoted spaces" behaves the same?

It's probably not the end of the world if it doesn't, but we should probably

  1. Be aware of it, and mention it in the release notes if we break that
  2. Provide a way for people to write arguments containing spaces in the setting

@Ericson2314
Copy link
Member Author

$ NIX_CONFIG='substituters = some\ thing\ with\ escaped" and quoted spaces"' nix show-config --extra-experimental-features nix-command --json | jq .substituters.value
[
  "some\\",
  "thing\\",
  "with\\",
  "escaped\"",
  "and",
  "quoted",
  "spaces\""
]

afraid the current setting thing doesn't handle this well at all.

Ericson2314 added a commit to NixOS/hydra that referenced this pull request Jan 23, 2024
NixOS/nix#9833

Flake lock file updates:

• Updated input 'nix':
    'github:NixOS/nix/74534829f23b668fb9b2f2a14ff6afa4d5e71d4a' (2024-01-22)
  → 'github:obsidiansystems/nix/b71673109c2172cb1f933cc8a97c26b4352ac239' (2024-01-22)
@edolstra edolstra merged commit b6aee9a into NixOS:master Jan 23, 2024
10 checks passed
@Ericson2314 Ericson2314 deleted the ssh-arg-split branch January 23, 2024 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
store Issues and pull requests concerning the Nix store
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants