Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!caen!uwm.edu!ux1.cso.uiuc.edu!phil From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN) Newsgroups: comp.sys.sequent Subject: mv not atomic in dynix Keywords: mv Message-ID: <1991Feb16.000101.4149@ux1.cso.uiuc.edu> Date: 16 Feb 91 00:01:01 GMT Organization: University of Illinois at Urbana Lines: 21 I discovered the following when trying to use "mv" to rename a directory in order to syncronize a shell script so that only one could operate on a set of files at one time under circumstances where more than one instance might get started at once occaisionally. The shell script runs in the background and today I had a situation where a couple of them got started in parallel. When two (or more) "mv" commands try to rename the same file OR DIRECTORY to two DIFFERENT names at the same time, the result can be two separate hard links to the same inode. In the case of directories, "ln" (or the underlying system call) will refuse to allow this to happen except if the uid is root. While the non-atomic nature of "mv" might cause some syncronizing problems with shell scripts that assume it is atomic, the fact that this can happen to directories appears to be a more serious problem. Has this been reported anywhere yet? -- --Phil Howard, KA9WGN-- | Individual CHOICE is fundamental to a free society | no matter what the particular issue is all about.