> Hi!
> 
> ----
> 
> While looking for incompatibilities between Solaris commands and ksh93's
> builtin commands I found a difference in the output of "uname -a"
> 
> The difference looks like this:
> -- snip --
> # use native Solaris "uname"
> $ /usr/bin/uname -a
> SunOS s10test001 5.10 Generic_118844-26 i86pc i386 i86pc
> $ builtin | fgrep uname
> /bin/uname
> # use ksh93 builtin "uname"
> $ export PATH=/bin:$PATH
> $ uname -a
> SunOS s10test001 5.10 Generic_118844-26 i86pc
> -- snip --
> Neither /usr/xpg4/bin/ nor /usr/xpg6/bin/ contain a "uname" variant so I
> assume there is no standard, right ?
> 
> The builtin "uname" results the following help:
> -- snip --
> uname --help  
> Usage: uname [ options ]
> OPTIONS
>   -a, --all       Equivalent to -snrvm.
>   -d, --domain    The domain name returned by getdomainname(2).
>   -f, --list      List all sysinfo(2) names and values, one per line.
>   -h, --host-id|id
>                   The host id in hex.
>   -i, --implementation|platform
>                   The hardware implementation (platform); this is
> --host-id on some systems.
>   -m, --machine   The name of the hardware type the system is running
> on.
>   -n, --nodename  The hostname or nodename.
>   -p, --processor The name of the processor instruction set
> architecture.
>   -r, --release   The release level of the operating system
> implementation.
>   -s, --os|system|sysname
>                   The operating system name. This is the default.
>   -v, --version   The operating system implementation version level.
>   -A, --everything
>                   Equivalent to -snrvmphCdtbiRX.
>   -R, --extended-release
>                   The extended release name.
>   -S, --sethost=name
>                   Set the hostname or nodename to name. No output is
> written to standard output.
> -- snip --
> 
> Calling the Solaris /usr/bin/uname command with the "-snrvm" option
> listed in the builtin commands help returns the same output then:
> -- snip --
> % /usr/bin/uname -snrvm
> SunOS s10test001 5.10 Generic_118844-26 i86pc
> -- snip --
> 
> Based on that it simply seems that the Solaris command's "-a" option is
> the equivalent to "uname -snrvmpi":
> -- snip --
> % /usr/bin/uname -snrvmpi
> SunOS s10test001 5.10 Generic_118844-26 i86pc i386 i86pc
> % /usr/bin/uname -a      
> SunOS s10test001 5.10 Generic_118844-26 i86pc i386 i86pc
> % uname -snrvmpi
> SunOS s10test001 5.10 Generic_118844-26 i86pc i386 i86pc
> -- snip --
> 
> David/Glenn:
> I have attached a patch
> ("ksh93_solaris_uname_all_output_fix001.diff.txt") which syncs the
> output of the ksh93 builtin command with the Solaris version in
> /usr/bin/ - is that change Ok for you ?
> 
> ----
> 
> Bye,
> Roland
> 
> -- 
>   __ .  . __
>  (o.\ \/ /.o) roland.mainz at nrubsig.org
>   \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
>   /O /==\ O\  TEL +49 641 7950090
>  (;O/ \/ \O;)
> Index: libcmd/common/uname.c
> ===================================================================
> --- libcmd/common/uname.c     (revision 222)
> +++ libcmd/common/uname.c     (working copy)
> @@ -43,7 +43,7 @@
>  "    \bgetconf\b(1), a pre-existing \astandard\a interface, provides"
>  "    access to the same information; do vendors read standards or just"
>  "    worry about making new ones?]"
> -"[a:all?Equivalent to \b-snrvm\b.]"
> +"[a:all?Equivalent to \b-snrvmpi\b.]"
>  "[d:domain?The domain name returned by \agetdomainname\a(2).]"
>  "[f:list?List all \bsysinfo\b(2) names and values, one per line.]"
>  "[h:host-id|id?The host id in hex.]"
> @@ -185,16 +185,16 @@
>  #define OPT_release          (1<<2)
>  #define OPT_version          (1<<3)
>  #define OPT_machine          (1<<4)
> +#define OPT_processor                (1<<5)
> +#define OPT_implementation   (1<<6)
>  
> -#define OPT_ALL                      5
> +#define OPT_ALL                      7
>  
> -#define OPT_processor                (1<<5)
> -#define OPT_hostid           (1<<6)
> -#define OPT_vendor           (1<<7)
> -#define OPT_domain           (1<<8)
> -#define OPT_machine_type     (1<<9)
> -#define OPT_base             (1<<10)
> -#define OPT_implementation   (1<<11)
> +#define OPT_hostid           (1<<7)
> +#define OPT_vendor           (1<<8)
> +#define OPT_domain           (1<<9)
> +#define OPT_machine_type     (1<<10)
> +#define OPT_base             (1<<11)
>  #define OPT_extended_release (1<<12)
>  #define OPT_extra            (1<<13)
>  
> @@ -256,7 +256,7 @@
>       {
>               switch (optget(argv, usage))
>               {
> -             case 'a':
> +             case 'a': /* -snrvmpi */
>                       flags |= OPT_all|((1L<<OPT_ALL)-1);
>                       continue;
>               case 'b':
> 
> 

The uname utility is defined by the POSIX standard which says that
-a is equivalent to mnrsv.

Since ksh93 is POSIX conforming, it cannot chaange this behavior
and still be conforming.

If solaris has a non-conforming uname that they must maintain,
then there are two options.

1.      Create a sun universe and make this the default.
        getconf UNIVERSE -- sun
        will set the UNIVERSE to sun but commands like cat and echo
        need to be patched so that att and ucb universes are also
        conforming.

2.      Do you build uname into ksh93 and put it in a PATH that
        will be used by people who want ast conformance.



David Korn
dgk at research.att.com

Reply via email to