[py-svn] r16043 - in py/dist/py/path/local: . testing

hpk at codespeak.net hpk at codespeak.net
Sat Aug 13 15:23:07 CEST 2005


Author: hpk
Date: Sat Aug 13 15:23:06 2005
New Revision: 16043

Modified:
   py/dist/py/path/local/posix.py
   py/dist/py/path/local/testing/test_posix.py
Log:
don't try chown on a link when recursing 


Modified: py/dist/py/path/local/posix.py
==============================================================================
--- py/dist/py/path/local/posix.py	(original)
+++ py/dist/py/path/local/posix.py	Sat Aug 13 15:23:06 2005
@@ -52,7 +52,8 @@
         gid = getgroupid(group)
         if rec:
             for x in self.visit(rec=py.path.checker(link=0)):
-                self._callex(os.chown, str(x), uid, gid)
+                if x.check(link=0):
+                    self._callex(os.chown, str(x), uid, gid)
         self._callex(os.chown, str(self), uid, gid)
 
     def readlink(self):

Modified: py/dist/py/path/local/testing/test_posix.py
==============================================================================
--- py/dist/py/path/local/testing/test_posix.py	(original)
+++ py/dist/py/path/local/testing/test_posix.py	Sat Aug 13 15:23:06 2005
@@ -155,6 +155,16 @@
         group = self.root.group()
         self.root.chown(owner, group)
 
+    def test_chown_dangling_link(self):
+        owner = self.root.owner()
+        group = self.root.group()
+        x = self.root.join('hello')
+        x.mksymlinkto('qlwkejqwlek')
+        try:
+            self.root.chown(owner, group, rec=1)
+        finally:
+            x.remove(rec=0)
+
     def test_chown_identity_rec_mayfail(self):
         owner = self.root.owner()
         group = self.root.group()



More information about the pytest-commit mailing list