> The FreeBSD kernel now handles such duplicate environment variables by appending suffixes, so that we end up with virtio_mmio.device, virtio_mmio.device_1, virtio_mmio.device_2, et cetera,
Was there any discussion of a cleaner alternative to this, perhaps extending the existing APIs with the ability to retrieve multiple values for one key (without breaking backwards compatibility, obviously) or concatenating the values with some sort of delimiter (colon, literal new line, ascii RS, or even null)?
I understand, that's why I was asking about an additional api (get_xx_multi, etc) that would return an array or composite string or whatever, while get_xx would continue to return just the single/latest value.
Not being able to tell whether or not foo was specified twice or foo and foo_1 were specified separately just gives me flashbacks to a bygone era of osdev and gives me security creepy-crawlies.
(also how do you handle `device=xxx device=yyy device_1=zzz`?)
If there's other users for this I'll write a getenv_multi which takes a callback function. Didn't seem like much point doing that until we want to use this somewhere else though.
We end up with device=xxx and device_1=yyy but if you mean that someone specifies device_1=zzz after that, it would show up as device_1_1=zzz. I'm inclined to file that one under "if a user is deliberately obtuse, they get what they deserve".
> We end up with device=xxx and device_1=yyy but if you mean ...
No, I meant the first example. I'm trying to think of realistic non-obtuse cases like an entirely different spec calls for name_1, name_2, etc. but for some reason a numbered key is repeated. It's mostly an academic concern though, no worries!
Thanks for the awesome work you do for the FreeBSD community, as always.
> The FreeBSD kernel now handles such duplicate environment variables by appending suffixes, so that we end up with virtio_mmio.device, virtio_mmio.device_1, virtio_mmio.device_2, et cetera,
Was there any discussion of a cleaner alternative to this, perhaps extending the existing APIs with the ability to retrieve multiple values for one key (without breaking backwards compatibility, obviously) or concatenating the values with some sort of delimiter (colon, literal new line, ascii RS, or even null)?