Solaris and the GNU (tools)

The ever reoccuring customer criticism in the Q&A part of my presentations is: “Your command line tools are really strange in regard of the options. Why does your ps has different options than the Linux ps. By the way: You didn´t cleaned up your operating environment as i found multiple versions of tool xyz. But i still didn´t found any GNU tools. I have to reinstall every tool on my own”. Well … i want to talk about this criticism. It comes down to the following questions: Why are the Solaris tools different to GNU. Why are there several versions of the same command in Solaris? Where are the GNU tools? The behaviour of our tool is differently to the GNU tools for examples. The standard toolset of Solaris is the SysV toolset. Of course you will find more binaries in /usr/bin and /usr/sbin than just the stuff from SysV but the basic tools (ps for example are SysV ones) are implemented with the SysV guidelines in mind. Why do we keep this tools? Why didn´t we subsituted them by GNU variants? Simple answer: Binary Compatibilty Guarantee. There may be programs out there dependent on a toolset with the same behaviour (regarding options and output) than in older versions of Solaris. One of the advantages in Solaris is the fact, that you can take a script from Solaris 7 and it will run without problems on an Opensolaris script. No changes to the script because of a different output layout or an renamed option. Our customers expect this. It´s one of our selling points. So you can´t simply change the behaviour of an existing tool. But why do we have several versions of some tools? The reason for this duplication is again really simple: We follow standards. Yes, there are official standard bodies in the Unix world ;) Sometimes the behaviour of a tool in a certain standard is different than in another standard. The man page states

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 version that is standard-conforming has been provided in /usr/xpg4/bin. If the behavior required by POSIX.1–2001 or SUSv3 conflicts with historical Solaris utility behavior, a new version that is standard-conforming has been provided in /usr/xpg4/bin or in /usr/xpg6/bin. If the behavior required by POSIX.1–2001 or SUSv3 conflicts with POSIX.2, POSIX.2a, SUS, or SUSv2, a new version that is SUSv3 standard-conforming has been provided in /usr/xpg6/bin.

When an application mandates the conformance of your system to a certain standard, you just have to set the PATH accordingly. The man page standards(5) describes the exact PATH to enable the conformance to a certain standard. In addition to the paths with the commands needed to conform with standards, there is a directory with commands called /usr/ucb. UCB? University of California Berkeley. The B in BSD. When you prefere the BSD-style of commands (good example is ps auxww instead of ps -ef) this directory will provide you those commands. The existence of this commands is largely a legacy from the time before the BSD to SysV conversion. Until 4.x the operating System was a BSD with some SysV concepts included, 5.x (better known as Solaris 2.x) is a SysV with some BSD concepts. In early years the dispute between BSD and SysV was a holy war equal to the one about the best editor. Nowadays the line between both camps gets more and more blurry. Okay, The GNU tools do not really follow any standards. So the commands in the various parts of the system doesn´t help you. They work differently, some even implement SysV and BSD command options and behaviour. As GNU/Linux is a successful operating system, the way of the GNU to implement commands is something similar to a standard.Customer is the king and so we included a large amount of freeware tools into Solaris . But where are the GNU tools now? They are seperated from other commands (same concepts as with the other toolsets). You will find them under /usr/sfw. Under this directory you will find freeware tools provided by Sun. In the case you wand a GNU make you will find it here. I will not accept any complaints about missing GNU tools when you didn´t looked in this directory before. Important to know: We renamed some of the tools to seperate them from other versions (e.g. make and gmake) You just have to include /usr/sfw in your PATH. The reason for not making this the default? The binary compatibility guarantee again. The default configuration of the operating system must enable the OS to be binary compatible to older versions of Solaris. I hope this article shed some light into this topic :)