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 cannot handle whitespace in a pool name #439

Closed
dajhorn opened this issue Nov 7, 2011 · 9 comments
Closed

dracut cannot handle whitespace in a pool name #439

dajhorn opened this issue Nov 7, 2011 · 9 comments
Milestone

Comments

@dajhorn
Copy link
Contributor

dajhorn commented Nov 7, 2011

A literal space character is permitted in a zpool name. For example:

# zpool create 'foo bar' /dev/sdb
# zfs list
NAME                  USED  AVAIL  REFER  MOUNTPOINT
foo bar                75k  9.78G    30K  /foo bar

Unquoted variables near dracut/90zfs/mount-zfs.sh.in:64 like this:

mountpoint=`zfs get -H -o value mountpoint $zfsbootfs`

Get a command substitution like this:

zfs get -H -o value mountpoint foo bar/ROOT/linux
cannot open 'foo': dataset does not exist
cannot open 'bar/ROOT/linux': dataset does not exist
@behlendorf
Copy link
Contributor

Now this is a bug, the pool name should not be allowed to contain white space. How this is slipping through isn't immediately obvious because there is code to detect this sort of thing. See zpool_name_valid()->pool_namecheck()->valid_char() in the source. Allowed characters are a-z, A-Z, 0-9, -, _, ., and :. Passing a name which include a space should be caught.

@Rudd-O
Copy link
Contributor

Rudd-O commented Nov 10, 2011

Pool names cannot contain spaces?

Still, it'd be a good idea to quote variables in the dracut shell scripts. Better safe than sorry. Dajhorn, can you submit a fix in the form of a pull request to either my tree or Brian's?

@dajhorn
Copy link
Contributor Author

dajhorn commented Nov 14, 2011

I confirmed that a pool with whitespace in the name can be created on both Fedora 16, Ubuntu 11.10, and OpenIndiana 151a.

If this is a bug, then it is in OpenSolaris/Illumos too.

@behlendorf
Copy link
Contributor

Interesting, well it certainly still seems like a bug to me even if it is allowed by the other platforms. How do you guys want to handle this, fix the code to prevent the creation of pools with white space in their names. Or update all of the scripts/utilities to quote everything.

Preventing this entirely and pushing the fix back to Illumos seems like the best fix to me. There must be a ton of 3rd party scripts which also make this assumption.

@Rudd-O
Copy link
Contributor

Rudd-O commented Nov 14, 2011

I think the solution with the most closure is to quote all variables in
our scripts. That would allow us to handle crazy stuff we can't expect
robustly.

On Mon, 2011-11-14 at 12:51 -0800, Brian Behlendorf wrote:

Interesting, well it certainly still seems like a bug to me even if it is allowed by the other platforms. How do you guys want to handle this, fix the code to prevent the creation of pools with white space in their names. Or update all of the scripts/utilities to quote everything.

Preventing this entirely and pushing the fix back to Illumos seems like the best fix to me. There must be a ton of 3rd party scripts which also make this assumption.


Reply to this email directly or view it on GitHub:
#439 (comment)

@schakrava
Copy link
Contributor

I agree with Rudd-O. I don't see a reason to disallow same character set for zpool names and zfs filesystem names. Not allowing space character might actually cause problems with some potential use cases. Also looking at the code, i do see where its allowing the space character: zfs_namecheck.c:valid_char() line #55. Its the last character comparison.

@dajhorn
Copy link
Contributor Author

dajhorn commented Nov 18, 2011

In the same source file, the comment for snapshot_namecheck() gives a regex example that includes the space character, so it is probably intentional.

@behlendorf
Copy link
Contributor

OK, you've convinced me. It's intentional. If someone can provide a patch which adds the needed quoting to the relevant scripts I'm happy to pull it in.

behlendorf pushed a commit to behlendorf/zfs that referenced this issue Dec 5, 2011
For consistency and safety, quote all variables in the zpool_id
script. This accomodates a `-c CONFIG` parameter value with
whitespace in the path name.

Also fix a typo in the usage synopsis for `-h`.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#439
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Dec 5, 2011
For consistency and safety, quote all variables in the zfs.lsb script.
This protects in the unlikely case that any of the file names contain
whitespace.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#439
Rudd-O pushed a commit to Rudd-O/zfs that referenced this issue Feb 1, 2012
For consistency and safety, quote all variables in the zpool_id
script. This accomodates a `-c CONFIG` parameter value with
whitespace in the path name.

Also fix a typo in the usage synopsis for `-h`.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#439
Rudd-O pushed a commit to Rudd-O/zfs that referenced this issue Feb 1, 2012
For consistency and safety, quote all variables in the zfs.lsb script.
This protects in the unlikely case that any of the file names contain
whitespace.

Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#439
@behlendorf
Copy link
Contributor

This looks stale, and it should have been fixed by 660cbad. Closing issue.

behlendorf pushed a commit to behlendorf/zfs that referenced this issue May 21, 2018
Also add support for the "name" parameter in mutex_init().  The name
allows for better diagnostics, namely in /proc/lock_stats when
lock debugging is enabled.  Nested mutexes are necessary to support
CONFIG_PROVE_LOCKING. ZoL can use mutex_enter_nested()'s "class" argument
to to convey the locking hierarchy.

Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Closes openzfs#439
MoritzFago added a commit to MoritzFago/zrepl that referenced this issue Jun 19, 2018
Space is a allowed character in zfs names accoring to
openzfs/zfs#439.
problame pushed a commit to zrepl/zrepl that referenced this issue Jun 20, 2018
Space is a allowed character in zfs names accoring to
openzfs/zfs#439.
sdimitro pushed a commit to sdimitro/zfs that referenced this issue Sep 17, 2021
…zfs#439)

Add "heal" flag to "read block" request. If this flag is set, read from
cache and object store. If in cache, compare contents with what's in
object store, if differ then heal (overwrite) cache contents. return
contents from object store. If present, replace the entry in the object
cache with the data newly retrieved from S3.
sdimitro pushed a commit to sdimitro/zfs that referenced this issue May 23, 2022
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

4 participants