Public interfaces and Solaris 9 patchadd exit codes

April 15, 2006

A commenter on an earlier entry noted that patchadd's exit codes are apparently not documented because they're considered an internal implementation detail that might change at some point. Unfortunately this is bogus logic.

There's a simple rule: once you explicitly expose something to users, it ceases to be an internal implementation detail in practice no matter what you want (and no matter what you may claim in documentation, although Sun does not explicitly claim this in the patchadd manpage).

Solaris 9 manifestly exposes patchadd's exit codes, since they are reported as is by things like the Solaris 9 recommended patch cluster installation script, as I found out. If Sun wanted system administrators to remain blithely ignorant of patchadd's fine details, all of the higher level tools should have hidden them; as it is, we won't be very happy if Sun were to turn, eg, 'return code 2' from something harmless to something that indicated a real problem.

I consider exposing things to people different from exposing them to programs. It's very hard to hide internal details from programs that go poking, but it's a quite different thing to shove those details under people's noses. And once you do the latter, you lose grounds to complain about programs using the information too. (In effect the programs have stopped being nosy parkers and have become our agents.)

(Disclaimer: I don't know if Sun really considers Solaris 9 patchadd exit codes to be just an implementation detail. The manpage doesn't document them, but then it doesn't say that they're private. Besides, it just makes a convenient example; the attitude is unfortunately somewhat generic.)


Comments on this page:

From 24.98.83.96 at 2006-04-15 18:47:42:

All of teh exit codes are documented in /usr/lib/patch/patchadd, and can be viewed with your favorite pager or editor:

$ less /usr/lib/patch/patchadd

[ ..... ]

  1. Exit Codes:
  2. 0 No error
  3. 1 Usage error
  4. 2 Attempt to apply a patch that's already been applied
  5. 3 Effective UID is not root
  6. 4 Attempt to save original files failed

[ ..... ]

/usr/bin/patcch is a binary wrapper for /usr/lib/patch/patchadd, which is a korn shell script that does all of the major lifting (which I find bizarre).

- Ryan http://daemons.net/~matty

From 24.98.83.96 at 2006-04-15 18:50:35:

Ack -- my previous comment should have said:

"/usr/sbin/patchadd is a binary wrapper for /usr/lib/patch/patchadd, which is a korn shell script that does all of the major lifting"

I will try to type slower next time. :)

By cks at 2006-04-15 19:27:25:

In Solaris 9 (and I suspect any prior versions with patchadd, although I try not to make assumptions when it comes to Sun), /usr/sbin/patchadd is a very large direct Korn shell script. I have to wonder why Solaris 10 turned it into a binary front end (unfortunately I don't have a Solaris 10 machine to poke at it).

Now that I've looked at Solaris 9 patchadd, I've got to say that it's kind of scary; 5,699 lines and 132K is an awfully big shell script. Somone in Sun must have really liked the Korn shell (or perhaps they just didn't have any officially approved better language to write it in; I suppose the pickings are somewhat slim if you rule out Perl and Python and so on).

Written on 15 April 2006.
« Why del has to be a Python builtin
The problem of the growth of syndication feeds »

Page tools: View Source, View Normal, Add Comment.
Search:
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Apr 15 03:12:47 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.