Eric Blake
2014-09-29 15:04:00 UTC
[adding Austin Group]
"The function is named fname; the application shall ensure that it is a
name (see XBD Name) and that it is not the name of a special built-in utility."
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05
Note that this particular requirement is on "the application" (aka the
shell script defining the function) and NOT on "the implementation" (aka
bash as the shell that is tracking the function definition). There are
a number of places where there are requirements on a strictly conforming
application, where if they violate that requirement, then they have
subjected themselves to unspecified behavior, and that the shell can do
whatever it deems makes the most sense. In other words, I _don't_ read
this sentence of POSIX as requiring that 'bash -o posix' must reject
arbitrary function names, only that a shell script trying to conform to
POSIX must not attempt to define a function with such a name.
I would expect something like "It shall be an error if fname is the name
of a special built-in utility", as _that_ would be a hard requirement on
bash, not just the application. Maybe we have a bug in the POSIX spec
for a missing requirement.
Yes, it's an application requirement. Regardless, all the versions of bash
we're talking about here reject non-identifiers.
I'm still trying to find that line in the actual POSIX spec.we're talking about here reject non-identifiers.
name (see XBD Name) and that it is not the name of a special built-in utility."
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_05
shell script defining the function) and NOT on "the implementation" (aka
bash as the shell that is tracking the function definition). There are
a number of places where there are requirements on a strictly conforming
application, where if they violate that requirement, then they have
subjected themselves to unspecified behavior, and that the shell can do
whatever it deems makes the most sense. In other words, I _don't_ read
this sentence of POSIX as requiring that 'bash -o posix' must reject
arbitrary function names, only that a shell script trying to conform to
POSIX must not attempt to define a function with such a name.
I would expect something like "It shall be an error if fname is the name
of a special built-in utility", as _that_ would be a hard requirement on
bash, not just the application. Maybe we have a bug in the POSIX spec
for a missing requirement.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org