Re: does numeric only name of jails not allowed (bug?)
Date: Fri, 08 Aug 2025 17:24:32 UTC
On 8/6/25 09:37, Anthony Pankov wrote:
> Dear freebsd-hackers.
>
> It seems there is no sign that numeric only name is prohibited:
>
> "
> The jail name. This is an arbitrary string that identifies a
> jail (except it may not contain a ďż˝.ďż˝).
> "
>
> But
> # head jail-47777.conf
> ...
> 47777 {
> host.hostname = "${name}";
> ...
>
> # jail -c 47777
> jail: 47777: host.hostname: variable "name" not found
>
> If I add letter prefix, say w47777, it worked.
>
> Because of strange error "variable "name" not found" it seems like a bug. Does it?
>
This is an artifact of how numeric names work. When you use a purely
numeric name, it's taken as both the jid and the name. jail(8) has some
logic up-front that will set one or the other variable based on the
name, but it omits the other.
I have this almost fixed in 15.0, but trying your example I've found a
bug in it -- setting the name, we need to use the string_param() of the
KP_JID param as the `value`; the current use of KP_JID's cfparam for `p`
to add_param() will adopt the name of KP_JID, which is a peculiarity
that I wasn't aware of.
Thanks,
Kyle Evans