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

SC1010 false positive on ping -M do #3142

Open
2 of 4 tasks
TheCayman opened this issue Feb 11, 2025 · 0 comments
Open
2 of 4 tasks

SC1010 false positive on ping -M do #3142

TheCayman opened this issue Feb 11, 2025 · 0 comments

Comments

@TheCayman
Copy link

For bugs

  • Rule Id (if any, e.g. SC1000): SC1010
  • My shellcheck version (shellcheck --version or 'online'): online
  • I tried on shellcheck.net and verified that this is still a problem on the latest commit
  • It's not reproducible on shellcheck.net, but I think that's because it's an OS, configuration or encoding issue

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

# shellcheck=bash
ping -M do localhost

Here's what shellcheck currently says:

Line 2	SC1010: Use semicolon or linefeed before 'do' (or quote to make it literal).

Here's what I wanted or expected to see:

No error at all, as the 'do' here is a valid hint for ping and should not be interpreted by ShellCheck.

TODO: Describe expected/desired output
This is similar to issues #1801 and #1809.
1801 was not fixed, as that was related to a non-standard utility.
1809 was fixed.

This one is using ping, which is IMO a standard utility. The -M parameter specifies how ping should handle MTU path discovery. It can be passed three possible hints:
do
want
dont

See: https://linux.die.net/man/8/ping

The workaround of quoting the do-HINT does work, but without further explanation, it will not be clear to another developer why that was done, as it doesn't make sense in the context of the parameters to the ping command.

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

No branches or pull requests

1 participant