Skip to content

initramfs: fix zpool get argument order #14572

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

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

q66
Copy link
Contributor

@q66 q66 commented Mar 4, 2023

Motivation and Context

When using the zfs initramfs scripts on my system, I get various errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc (as a part of the https://chimera-linux.org/ project, which utilizes initramfs-tools, and therefore also the supporting scripts here), which may be why this happens. Or maybe it never worked at all, I have no way to test this on a glibc system.

Description

Fix the argument order to match the zpool get output, and to make my builds happy.

How Has This Been Tested?

I rebuilt my initramfs with these changes applied, and there are no more error messages. Since it's a simple change to follow posixly-correct argument order, it will not break any other configurations.

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)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

When using the zfs initramfs scripts on my system, I get various
errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc, which may be why
this happens. In any case, fix the argument order to make the
zpool binary happy, and to match its --help output.

Signed-off-by: Daniel Kolesa <[email protected]>
Copy link
Contributor

@ryao ryao left a comment

Choose a reason for hiding this comment

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

glibc's getopt does some magic to support non-standard orders. That GNUism got into the code by mistake.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

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

Thanks for catching this getopt ordering issue.

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Mar 7, 2023
@behlendorf behlendorf merged commit 4628bb9 into openzfs:master Mar 7, 2023
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Mar 7, 2023
When using the zfs initramfs scripts on my system, I get various
errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc, which may be why
this happens. In any case, fix the argument order to make the
zpool binary happy, and to match its --help output.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Signed-off-by: Daniel Kolesa <[email protected]>
Closes openzfs#14572
behlendorf pushed a commit that referenced this pull request Mar 7, 2023
When using the zfs initramfs scripts on my system, I get various
errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc, which may be why
this happens. In any case, fix the argument order to make the
zpool binary happy, and to match its --help output.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Signed-off-by: Daniel Kolesa <[email protected]>
Closes #14572
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Mar 13, 2023
When using the zfs initramfs scripts on my system, I get various
errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc, which may be why
this happens. In any case, fix the argument order to make the
zpool binary happy, and to match its --help output.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Signed-off-by: Daniel Kolesa <[email protected]>
Closes openzfs#14572
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Mar 16, 2023
When using the zfs initramfs scripts on my system, I get various
errors at initramfs stage, such as:

cannot open '-o': name must begin with a letter

My zfs binaries are compiled with musl libc, which may be why
this happens. In any case, fix the argument order to make the
zpool binary happy, and to match its --help output.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Richard Yao <[email protected]>
Signed-off-by: Daniel Kolesa <[email protected]>
Closes openzfs#14572
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants