Behavior of expr(1) and standards conformance.

Jordan K. Hubbard jkh at queasyweasel.com
Wed Mar 10 14:23:19 PST 2004


In the man page for expr(1) on FreeBSD 5.x, we see the following 
statement:

	Compatibility with previous implementations
	Unless FreeBSD 4.x compatibility is enabled, this version of expr 
adheres
	to the POSIX Utility Syntax Guidelines, which require that a leading
	argument beginning with a minus sign be considered an option to the 
program.

I believe this is wrong, however, since the only "standards docs" for 
expr(1) can find are here:

	http://www.opengroup.org/onlinepubs/007908799/xcu/expr.html

And they say nothing about allowing - arguments, Utility Syntax 
Guidelines notwithstanding
(and "guidelines" are, by definition, not necessarily universally 
binding).  More to the point,
The Open Group's UNIX conformance tests expect to be able to do stuff 
like this:

	expr -c : '\([+-]\)'

And have it return an appropriate error code (0).  Under FreeBSD's 
expr(1), this falls over on its face,
and the documentation on the compat hack added to expr seems to 
strongly imply that it's conformant
as it currently stands, the /etc/compat/FreeBSD-4-util hack being what 
one does to make it non-conformant.
I believe this is backwards.  Comments?

--
Jordan K. Hubbard
Engineering Manager, BSD technology group
Apple Computer



More information about the freebsd-standards mailing list