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

Disable shellcheck warning about impossible comparison #185

Merged
merged 2 commits into from
May 15, 2023

Conversation

Scrumplex
Copy link
Contributor

This shellcheck warning occurs when setting a path for a secret using the home-manager module.

I discovered this while moving my agenix secrets to home-manager this morning:

age.secrets."beets-secrets.yaml" = {
  file = ../../secrets/common/beets-secrets.yaml;
  path = "${config.xdg.cacheHome}/beets-secrets.yaml";
};
age.secrets."listenbrainz-token" = {
  file = ../../secrets/common/listenbrainz-token;
  path = "${config.xdg.cacheHome}/listenbrainz-token";
};

produces

In /nix/store/0hslyy6kiffcpvzzh5wy9q77vkihvyan-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 38:
[ "/home/scrumplex/.cache/beets-secrets.yaml" != "$XDG_RUNTIME_DIR/agenix/beets-secrets.yaml" ] && mkdir -p "$(dirname "/home/scrumplex/.cache/beets-secrets.yaml")"
                                              ^-- SC2193 (warning): The arguments to this comparison can never be equal. Make sure your syntax is correct.


In /nix/store/0hslyy6kiffcpvzzh5wy9q77vkihvyan-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 48:
[ "/home/scrumplex/.cache/beets-secrets.yaml" != "$XDG_RUNTIME_DIR/agenix/beets-secrets.yaml" ] && ln -sfn "$XDG_RUNTIME_DIR/agenix/beets-secrets.yaml" "/home/scrumplex/.cache/beets-secrets.yaml"
                                              ^-- SC2193 (warning): The arguments to this comparison can never be equal. Make sure your syntax is correct.


In /nix/store/0hslyy6kiffcpvzzh5wy9q77vkihvyan-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 68:
[ "/home/scrumplex/.cache/listenbrainz-token" != "$XDG_RUNTIME_DIR/agenix/listenbrainz-token" ] && mkdir -p "$(dirname "/home/scrumplex/.cache/listenbrainz-token")"
                                              ^-- SC2193 (warning): The arguments to this comparison can never be equal. Make sure your syntax is correct.


In /nix/store/0hslyy6kiffcpvzzh5wy9q77vkihvyan-agenix-home-manager-mount-secrets/bin/agenix-home-manager-mount-secrets line 78:
[ "/home/scrumplex/.cache/listenbrainz-token" != "$XDG_RUNTIME_DIR/agenix/listenbrainz-token" ] && ln -sfn "$XDG_RUNTIME_DIR/agenix/listenbrainz-token" "/home/scrumplex/.cache/listenbrainz-token"
                                              ^-- SC2193 (warning): The arguments to this comparison can never be equal. Make sure your syntax is correct.

For more information:
  https://www.shellcheck.net/wiki/SC2193 -- The arguments to this comparison ...

@Scrumplex
Copy link
Contributor Author

CC @ambroisie

P.S. Thanks for your awesome HM module!

ambroisie
ambroisie previously approved these changes May 12, 2023
@ambroisie
Copy link
Contributor

It might be good to add it to the test to make sure it doesn't regress?

This shellcheck warning occurs when setting a path for a secret using
the home-manager module.

Signed-off-by: Sefa Eyeoglu <[email protected]>
@Scrumplex
Copy link
Contributor Author

This should include some tests to make sure this doesn't regress now.

@ryantm ryantm merged commit db5637d into ryantm:main May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants