"multiple" users of a SN project & a bug report

David Taylor taylor@candd.org
Sun Jul 15 18:47:00 GMT 2001


>From looking at the code and reading some of the archives of this
mailing list, I conclude that it isn't intended for a SN project to be
allowed to be open in two or more processes simultaneously -- which is
a real shame!

For instance, I'd like to be able to

. bring up SN at work
. open a project
. go home (without closing the project)
. login to work from home
. bring up SN from home
. open the project that I have open at work

Having the second one say "it's already open for modification, you
have to open it read-only", might not be too bad.  Right now though it
totally refuses to open it.

[At least in SN 5.0; I tried the snapshot dated April 12th, but it
failed to build for me on Red Hat Linux 6.2.]

NOTE: there *IS* a bug in the function sn_is_project_busy
(snavigator/gui/misc.tcl).

Assuming we are on unix, ignore the issue of root opening the project,
and we have a real project, the remaining logic in sn_is_project_busy
reduces to roughly:

. open the project read-only; get list of users; close the project

. if no one is using the project, return ""

. if the project user is on the same machine, then
    . if the pid matches our's, return "me"
    . if the platform is "unix"
        . if the process no longer exists OR is owned by someone else,
          then return "" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< BUG

	  (you fail to distinguish between failure due to the process
           not existing [ESRCH] versus you don't have permission to send
	   the signal to that process [EPERM].)

    . else ...

. if project user matches current user, return "me"

. return "busy"

So, 

. if two users, same or different, on different machines try to open
  the same project, the second one will fail

. if the same user, tries to open the same project twice on the same
  machine, the second attempt will fail

. if different users try to open the same project on the same machine,
  the second one will succeed!

[Additionally, there appears to be a race condition present -- two
processes could open the project read-only, check whether there are
current users, see that there are none, and go ahead and re-open
it...]

Take care,

David
--
David Taylor
taylor@candd.org



More information about the Sourcenav mailing list