-
Notifications
You must be signed in to change notification settings - Fork 11
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
validate names helper #10
Comments
this should also greatly help us with testing, btw. |
Shouldn't we expect a much shorter path than that? The resulting path will be something like Using uuids didn't have this limitation. Maybe rolling back to use UUIDs is the safest way to guarantee compatibility with long names. What do you think? |
we're mixing concepts here. You're talking about /* from /usr/src/sys/sys/syslimits.h */
#define PATH_MAX 1024 /* max bytes in pathname */ a single component of a path underlies the restrictions of NAME_MAX /* from /usr/src/sys/sys/syslimits.h */
#define NAME_MAX 255 /* max bytes in a file name */ however!! freebsd's fstab imposes additional restrictions on a mount path's length until FreeBSD 12 is released, this will still be 88, and until then, we should equally restrict ourselves to making |
We don't know the mountpoint of the iocage root dataset, so finding a suitable max length for names will probably end up in a random guess. I'm in favor of decoupling the jail identifier and name again. It's nice to represent a jail with it's name in the filesystem, but listing jail names and paths is not a big deal with the cli list command. @skarekrow this would remove a recently introduced feature. Each jail would keep it's name though, but always use a UUID as filesystem reference. Also this allows us to permit arbitrary characters as jail name. Why shouldn't |
so, uuid, name, hostname & tags should become distinct properties again. i'm all for it. see #12. |
I don't see the point in limiting the max name, as that value will change eventually, and we're limiting for no reason at that point.
It's very hard for a user to see all the UUIDs and map them to their jails, when doing tasks like |
which brings us back to my initial proposal of having ascii-only names which are (severely;) limited in length, so we can fit them in all manner of mounts. Perhaps 16? and we can use tags for the fancy things that @gronke suggested. |
@igalic I agree with you. TLDR ; Limit names to some small value and don't do anything else until we have a database. |
almost all of our
name
arguments have the same general format:/^[a-z0-9][a-z0-9-_\.]*/i
given that many of our names are used as part of a path, we can further restrict the
*
/^[a-z0-9][a-z0-9-_\.]{0,254}/i
to FreeBSD's
NAME_MAX
(255).HOWEVER, until FreeBSD 12,
fstab
's mount paths are further restricted to 88, and not 255. Since we're supporting freebsd all the way down to 9.3, we should also limit our names.As we've seen from experience from using UUIDs as names, 32 is a length that can stretch it. I suggest only using half of that (16)
/^[a-z0-9][a-z0-9-_\.]{0,15}/i
The text was updated successfully, but these errors were encountered: