What System V did to the poor ln command

On V7, UCB BSD 4.x, SunOS 2.x, 3.x and 4.x, the *BSDs, Linux, and anything using GNU fileutils:

; touch a b
; ln a b && echo oops
ln: b: File exists

On System V, including Solaris 8:

; touch a b
; ln a b && echo oops
oops

That's right: the System V version of ln goes to significant extra work over just calling link(2), and in the process is so unhelpful that people had to make a new utility called link to do the right thing. (Fortunately, this behavior is no longer SuS compliant, per the ln spec.)

This is one of those things that sticks in my mind, because I had the distinction of being the first person to try to run CNews on a System V machine. CNews has a lot of shell scripts and had been developed on V7 and BSD systems, so all of the shell scripts did their locking with 'ln temp LOCK'; the consequences of the locking not actually working were reasonably spectacular and quite memorable. Fortunately the machine wasn't being used by anyone else at the time.

(The authors of CNews were as appalled as I was, and promptly introduced a little newslock program and switched the shell scripts to using it, so they had behavior they could count on.)

I was reminded of this mess recently when I wrote a shell script that needed to both do locking and run on our Solaris 8 systems. I was reasonably displeased to discover that Solaris 8 still has this bit of braindamage.

These are my WanderingThoughts
(About the blog)

GettingAround
Full index of entries
Recent comments

This is part of CSpace, and is written by ChrisSiebenmann.

* * *

Atom feeds are available; see the bottom of most pages.

This is a DWiki.
(Help)

Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web

Search:
Written on 09 February 2007.
(Previous | Next)

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

Last modified: Fri Feb 9 22:24:01 2007
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.