A Solaris 8 make bug

October 31, 2006
; cat Makefile
foo : /tmp/bar
	touch foo
; mkdir /tmp/bar
; make
touch foo
; make
`foo' is up to date.
; touch /tmp/bar/t
; make
`foo' is up to date.
; gmake
touch foo

As 'make -ndd' shows, for some reason Solaris 8's version of make decides that directories always have a timestamp of 0. It knows that they exist, because if you remove /tmp/bar it complains about it. This behavior is the same for both /usr/ccs/bin/make and /usr/xpg4/bin/make.

On a quick test, this bug appears to be gone in Solaris 9. There's a Solaris 8 make patch not applied to our systems, but the README doesn't mention anything like this bug.

(Depending on a directory is the kind of thing you do if you're building something from a bunch of files dropped into a directory, and you need to do something every time a file is added or removed.)

I note in passing that make problems that cause things to not get rebuilt are much more annoying than make problems that cause things to get rebuilt all the time.


Comments on this page:

By Dan.Astoorian at 2006-11-01 16:39:43:

As 'make -ndd' shows, for some reason Solaris 8's version of make decides that directories always have a timestamp of 0.

Of 1, actually. Incredibly, Solaris 8's make uses this value for directories intentionally as a magic number for some reason, to represent a timestamp slightly newer than (or probably more importantly, simply distinct from) a file that doesn't exist at all (time=0).

--Dan

By cks at 2006-11-01 19:55:45:

Wow, so it does (I completely missed the ':01' in make's debugging output). I suppose they may have had to do this so that a missing target that depends on a directory gets rebuilt, but that means that they did the whole directory time thing knowing what the side effects would be.

(One speculation is that they were dealing with filesystems that for some reason had extremely unreliable directory mtimes. But I don't know what filesystem would have influenced them this way; not NFS, at least.)

I wonder if there's Solaris 8 source around here, and if it might have any useful comments in the make source. (I looked briefly at the OpenSolaris site, but couldn't even find the make source in their CVS source tree. And I don't know if they have old revision history in their repository anyways.)

Written on 31 October 2006.
« An Internet rule of thumb
The downsides of remailing »

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

Last modified: Tue Oct 31 23:11:15 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.