>Date: Thu, 24 Apr 2008 14:48:56 +0200 >From: Henk Langeveld <hlangeveld at mailworks.org> > >Utilities > If the behavior required by POSIX.2, POSIX.2a, XPG4, SUS, or > SUSv2 conflicts with historical Solaris utility behavior, the > original Solaris version of the utility is unchanged; a new ver- > sion that is standard-conforming has been provided in > /usr/xpg4/bin. For applications wishing to take advantage of > POSIX.2, POSIX.2a, XPG4, SUS, or SUSv2 features, the PATH (sh or > ksh) or path (csh) environment variables should be set with > /usr/xpg4/bin preceding any other directories in which utilities > specified by those specifications are found, such as /bin, > /usr/bin, /usr/ucb, and /usr/ccs/bin. > >
Note that the "historical Solaris utility behavior" in the above quote refers to the way Solaris 2.0 /usr/bin/echo behaved (and still does today). The POSIX standard says "If the first operand is -n, or if any of the operands contain a <backslash> character, the results are implementation-defined." because UNIX System V (as documented by SVID3) and BSD had conflicting behaviors. (BSD treated -n as an option requesting that no terminating newline be printed and SVID treated -n as a string operand to be printed and supplied backslash escape sequences [including \c for this case].) I.e., BSD's command: echo -n "a\tbc\c" would print: ab\tc\c with no newline at the end of the line and the same command on System V's would print: -n ab c with a tab between the b and c, and no newline at the end of the line. The difference between /usr/bin/ksh and /usr/xpg4/bin/sh versus /usr/bin/ksh93 in the Nevada gate is that /usr/bin/ksh93's built-in echo always produces the System V command output, but /usr/bin/sh, /usr/bin/ksh, and /usr/xpg4/bin/sh produces the BSD output if (and only if) /usr/ucb appears in $PATH before /usr/bin. As Roland mentioned in an earlier message, this difference is one of many changes in behavior that will have to be discussed before /usr/bin/sh, /usr/bin/ksh, or /usr/bin/xpg4/bin/sh can be replaced by /usr/bin/ksh93 in a release where backwards compatibility with prior Solaris releases is an issue. - Don >bugzilla-daemon at np.grommit.com wrote: >> http://bugs.grommit.com/show_bug.cgi?id=484 >> >> >> >> >> >> ------- Comment #4 from bill.shannon at sun.com 2008-04-23 17:52 PDT ------- >> Um, I can't tell from the comments whether or not you agree that this is a >> bug >> that needs to be fixed. >> >> Anyway, "doesn't work properly" means that "echo -n foo" echoes "-n foo".