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

dracut: make module-setup.sh shebang explicit #6491

Merged
merged 1 commit into from Aug 14, 2017

Conversation

Fabian-Gruenbichler
Copy link
Contributor

@Fabian-Gruenbichler Fabian-Gruenbichler commented Aug 10, 2017

the script is full of bashisms, which trigger warnings on systems which are not using bash as default /bin/sh (like Debian and a lot of its derivates, which use dash).

Signed-off-by: Fabian Grünbichler f.gruenbichler@proxmox.com

Description & Motivation and Context

see commit message - the current shebangs produce linter warnings when building Debian packages.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

while these are source by dracut (which is a bash script)
the practical difference is small, but it is more correct:

/bin/sh is not bash on all systems (e.g. Debian and its
derivatives use /bin/dash as /bin/sh by default).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
@Fabian-Gruenbichler
Copy link
Contributor Author

note that I haven't checked the scripts actually used in the initramfs - some of those have /bin/sh as shebang as well and might in reality require /bin/bash as well..

@behlendorf
Copy link
Contributor

@Fabian-Gruenbichler thanks for pointing this out. We've been systematically expanding the use of shellcheck(1) utility to detect these kinds of problems but haven't yet applied it to the dracut directory. It would be great if we could update these scripts to remove any bash'isms and then include them in the automated shellcheck(1) checking to keep them that way. See the top-level Makefile 'shellcheck' target.

@Fabian-Gruenbichler
Copy link
Contributor Author

Fabian-Gruenbichler commented Aug 11, 2017 via email

@Rudd-O
Copy link
Contributor

Rudd-O commented Aug 11, 2017 via email

@bunder2015
Copy link
Contributor

The test suite could possibly also benefit from this, as I've seen shebangs in random .shlib/.kshlib and .cfg files.

@behlendorf
Copy link
Contributor

Since dracut already depends on bash I've no objection to merging this as is. But in general we should work on expanding the the number of scripts covered by shellcheck. It can check both sh and bash scripts as long as the shebang is set correctly for the file.

@behlendorf behlendorf merged commit 42a76fc into openzfs:master Aug 14, 2017
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Apr 28, 2019
while these are source by dracut (which is a bash script)
the practical difference is small, but it is more correct:

/bin/sh is not bash on all systems (e.g. Debian and its
derivatives use /bin/dash as /bin/sh by default).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Closes openzfs#6491
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.

None yet

4 participants