On Wed, Mar 15, 2006 at 11:53:54PM +0000, Roger Leigh wrote:
In both these cases, the -f switch tells ln to unlink and replace any
preexisting file, if it exists. If the file appears or disappears
during the execution of ln, this should not affect its behaviour.
I'm not convinced that's true; I don't think there's anything in the
documentation that suggests that the command is atomic.
This *is* a real problem, which we are seeing with the sbuild part of
buildd. It has (perl):
system "/bin/ln -sf $main::pkg_logfile
$conf::build_dir/current-$main::distribution";
system "/bin/ln -sf $main::pkg_logfile $conf::build_dir/current";
When buildd schedules builds concurrently, sbuild is showing the
problem intermittently.
Well, calling ln from perl via system is fugly anyway. I'd suggest using
something like:
unlink($conf::build_dir/current-$main::distribution);
if (!symlink($main::pkg_logfile, $conf::build_dir/current-$main::distribution))
{
handle_error() if (not $! =~ m/File exists/);
}
I'm not sure what you expect the end result to be if two processes try
and operate at the same time. It may be that you need a locking
mechanism for this to make sense.
Mike Stone
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]