You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not necessarily a "bug," per se, but questionable behavior, perhaps?
zfs create, zfs snapshot, and zfs bookmark are pretty lax with naming, compared to zpool create.
zpool create mandates that the first character of the pool name must be [a-zA-Z].
But each child dataset, including snapshots and bookmarks, allows a wider range of characters, including the initial character and final characters, to be in the range [a-z-A-Z0-9_:. -].
I mean sure, maybe that's your own fault if you name something so badly. Though it's easily conceivable for scripts to do things like this if input isn't trimmed properly.
Steps to reproduce (note this requires code from ece35e0 or later for relative paths):
Everything but space seems just fine as the initial character, but, if pool names have tighter restrictions, shouldn't datasets follow the same rules?
A possible argument for tightening the dataset name rules could conceivably be that it makes copy/paste from terminals error-prone, as I realized while pasting this here, for two reasons:
The spaces are unescaped in the output
Many terminals will trim trailing spaces in output lines when copying to clipboard, which would have rendered the zpool history I ran to get the above repro commands useless had I not piped it through sed (zpool history a | sed s/\ /'\\'\ /g).
My thinking, if more restrictive naming is desired, is that name components should probably at least have the requirement of the initial character not being space, and perhaps the final character, as well.
Or, counterpoint (and what I think makes more sense overall):
If naming is cool to be so lax, why are there any artificial restrictions on printable non-reserved characters for name components at all? Why, for example, are $, ,, ', +, =, etc not allowed, so long as they're legal path components for the operating system?
And, either way, why can't the rules for the pool component of the name be the same as the rest of the dataset components? If it's just a string, that seems arbitrary as well. Especially the restriction that the first character of a pool name MUST be alpha. Why not at least alphanumeric? I'm not aware of any supported kernel that wouldn't allow a mountpoint of, for example /1.
dodexahedron
changed the title
Should spaces really be allowed as the first and last characters of a name component?
Name component rules seem arbitrary and are inconsistent internally and with the OS
Mar 31, 2025
Not necessarily a "bug," per se, but questionable behavior, perhaps?
zfs create
,zfs snapshot
, andzfs bookmark
are pretty lax with naming, compared tozpool create
.zpool create
mandates that the first character of the pool name must be [a-zA-Z].But each child dataset, including snapshots and bookmarks, allows a wider range of characters, including the initial character and final characters, to be in the range [a-z-A-Z0-9_:. -].
Observe:
I mean sure, maybe that's your own fault if you name something so badly. Though it's easily conceivable for scripts to do things like this if input isn't trimmed properly.
Steps to reproduce (note this requires code from ece35e0 or later for relative paths):
Everything but space seems just fine as the initial character, but, if pool names have tighter restrictions, shouldn't datasets follow the same rules?
A possible argument for tightening the dataset name rules could conceivably be that it makes copy/paste from terminals error-prone, as I realized while pasting this here, for two reasons:
zpool history
I ran to get the above repro commands useless had I not piped it through sed (zpool history a | sed s/\ /'\\'\ /g
).My thinking, if more restrictive naming is desired, is that name components should probably at least have the requirement of the initial character not being space, and perhaps the final character, as well.
Or, counterpoint (and what I think makes more sense overall):
If naming is cool to be so lax, why are there any artificial restrictions on printable non-reserved characters for name components at all? Why, for example, are
$
,,
,'
,+
,=
, etc not allowed, so long as they're legal path components for the operating system?And, either way, why can't the rules for the pool component of the name be the same as the rest of the dataset components? If it's just a string, that seems arbitrary as well. Especially the restriction that the first character of a pool name MUST be alpha. Why not at least alphanumeric? I'm not aware of any supported kernel that wouldn't allow a mountpoint of, for example
/1
.To wit:
The text was updated successfully, but these errors were encountered: