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

bug: git-sync dies when whitespace in repo path #6023

Open
2 tasks done
RedEtherbloom opened this issue Oct 31, 2024 · 2 comments
Open
2 tasks done

bug: git-sync dies when whitespace in repo path #6023

RedEtherbloom opened this issue Oct 31, 2024 · 2 comments
Assignees
Labels
bug triage Issues or feature request that have not been triaged yet

Comments

@RedEtherbloom
Copy link

RedEtherbloom commented Oct 31, 2024

Are you following the right branch?

  • My Nixpkgs and Home Manager versions are in sync

Is there an existing issue for this?

  • I have searched the existing issues

Issue description

This happens due to an improper unit environment. Example error message:

systemctl status --user git-sync-xyz.service                                                  
 ○ git-sync-xyz.service - Git Sync xyz
      Loaded: loaded (/home/<username>/.config/systemd/user/git-sync-xyz.service; enabled; preset: ignored)
      Active: inactive (dead)
      
      Okt 31 21:34:05 <hostname> systemd[<pid>]: /home/<username>/.config/systemd/user/git-sync-xyz.service:6: Invalid environment assignment, ignoring: Space/home-manager

Example code:

{ config, ...}:
{
  services.git-sync = {
    enable = true;
    repositories = {
      xyz = {
        path = "${config.home.homeDirectory}/Stuff Space/home-manager";
        interval = 1000;
        uri = "[email protected]:nix-community/home-manager.git";
      };
    };
  };
}

Reason in code:

"GIT_SYNC_DIRECTORY=${repo.path}"

Path gets written verbatim to Environment variable in systemd unit. The resulting environment variable gets rejected by sysemd as invalid.

PR is in the works, I will link it to this issue later.

Maintainer CC

@colonelpanic8 @cab404 @ryane

System information

- system: `"x86_64-linux"`
- host os: `Linux 6.10.14, NixOS, 24.11 (Vicuna), 24.11.20241023.2768c7d`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.24.9`
- channels(root): `"nixos"`
- nixpkgs: `/nix/store/lsy6c2f9alj2gkjj36h754kk63x6701l-source`
@RedEtherbloom RedEtherbloom added bug triage Issues or feature request that have not been triaged yet labels Oct 31, 2024
RedEtherbloom added a commit to RedEtherbloom/home-manager that referenced this issue Oct 31, 2024
systemd rejects the service unit due to whitespace in the environment
variable assignment, pointing to the repo path, being invalid for
systemds unit format.

See nix-community#6023 for
details.

The git-sync variable should also be escaped due to similar issues with
e.g. local git urls.

	modified:   modules/services/git-sync.nix
RedEtherbloom added a commit to RedEtherbloom/home-manager that referenced this issue Oct 31, 2024
systemd rejects the service unit due to whitespace in the environment
variable assignment, pointing to the repo path, being invalid for
systemds unit format.

See nix-community#6023 for
details.

The git-sync variable should also be escaped due to similar issues with
e.g. local git urls.

	modified:   modules/services/git-sync.nix
@RedEtherbloom
Copy link
Author

RedEtherbloom commented Nov 1, 2024

The bug in home-manager should be fixed, but during testing I discovered that the git-sync version in nixpkgs is outdated, resulting in a similar bug with whitespaces.

PR bumping the git-sync version in nixpkgs has been linked for documentation.

@colonelpanic8
Copy link
Contributor

looks good

RedEtherbloom added a commit to RedEtherbloom/home-manager that referenced this issue Nov 5, 2024
systemd rejects the service unit due to whitespace in the environment
variable assignment, pointing to the repo path, being invalid for
systemds unit format.

See nix-community#6023 for
details.

The git-sync variable should also be escaped due to similar issues with
e.g. local git urls.

	modified:   modules/services/git-sync.nix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Issues or feature request that have not been triaged yet
Projects
None yet
Development

No branches or pull requests

5 participants