Bug 128878 - Another bug in catalyst2_rc40
Bug#: 128878 Product:  Gentoo Hosted Projects Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: catalyst@gentoo.org Reported By: liyiming@ict.ac.cn
Component: Catalyst
URL: 
Summary: Another bug in catalyst2_rc40
Keywords:  
Status Whiteboard: 
Opened: 2006-04-05 01:50 0000
Description:   Opened: 2006-04-05 01:50 0000
These are some codes in fcntl_unlock() function of catalyst_lock.py script.
Look carefully you will find that after excuting the first line and the second
line codes the rest codes will never be excuted.


1   if self.myfd == None:
2           return False
3   try:
4           if self.myfd == None:
5           self.myfd = os.open(self.lockfile, os.O_WRONLY,0660)
6           unlinkfile = 1
7           self.locking_method(self.myfd,fcntl.LOCK_UN)

------- Comment #1 From Jakub Moc (RETIRED) 2006-04-05 01:56:44 0000 -------
*** Bug 128880 has been marked as a duplicate of this bug. ***

------- Comment #2 From Alvin Lee 2006-04-05 02:56:49 0000 -------
Sorry, I do not notice that I have clicked the commit button twice!

------- Comment #3 From Chris Gianelloni (RETIRED) 2006-04-14 04:37:20 0000 -------
I cannot find this code in catalyst.  Could you instead provide a patch?

------- Comment #4 From Alvin Lee 2006-04-14 04:54:48 0000 -------
Sorry,I did not give the exact line number in catalyst_lock.py
These codes are lied in 187 line.I think these codes should be constructed as
below:

if not os.path.exists(self.lockfile):
  print "lockfile does not exist '%s'.  Skipping Unlock..." % self.lo           
  if (self.myfd != None):
      try:
          os.close(myfd)
          self.myfd=None
      except:
          pass
      return False
  else:
      return False
try:
  if self.myfd == None:
      self.myfd = os.open(self.lockfile, os.O_WRONLY,0660)
      unlinkfile = 1
      self.locking_method(self.myfd,fcntl.LOCK_UN)

------- Comment #5 From Chris Gianelloni (RETIRED) 2006-04-19 08:32:44 0000 -------
Sorry, could you please make a patch for this one.  I can't tell if you've
changed something or removed something.

Thanks

------- Comment #6 From Alvin Lee 2006-04-19 18:33:36 0000 -------
--- catalyst_lock.py.original   2006-04-19 21:44:14.000000000 +0800
+++ catalyst_lock.py.changed    2006-04-20 09:33:47.000000000 +0800
@@ -183,10 +183,7 @@
                        self.myfd=None
                     except:
                         pass
-                    return False
-        if self.myfd == None:
-           return False
-
+                return False
         try:
                 if self.myfd == None:
                     self.myfd = os.open(self.lockfile, os.O_WRONLY,0660)

this time ok?^^

------- Comment #7 From Chris Gianelloni (RETIRED) 2006-04-20 07:23:37 0000 -------
That definitely makes more sense now, thank you.

------- Comment #8 From Chris Gianelloni (RETIRED) 2006-05-25 09:30:40 0000 -------
This was apparently fixed in CVS without someone closing this bug.  Without
taking the time to verify when it was fixed, I can guarantee you that it is
fixed in 2.0_rc46, which I am about to roll.