Hello, Regarding https://bugzilla.redhat.com/show_bug.cgi?id=698795 there's commit d54a9385 in git. However, open(".") does not result in errno.EACCES if the dir is not writable, it does for me only if it's not readable or not executable. Also, at least for me it'll always throw some kind of an IOError when given a dir, so the "else" block is luckily never executed -- "luckily" because it uses close(f) when it probably should be using f.close().
See attached patch. It just fixes the comment and the log entry to match what it actually seems to be doing, and fixes the else block. If the intent is to actually check for writability of cwd, I suppose something different than open(".") is needed. Thoughts? (In case anyone wonders, the undefined "close" was flagged by pyflakes and I took a look at the surrounding code after fixing that; I haven't run into an actual problem with this.)
diff --git a/yummain.py b/yummain.py index 4b1112a..12582d2 100755 --- a/yummain.py +++ b/yummain.py @@ -102,15 +102,15 @@ def main(args): return exFatal(e) # Try to open the current directory to see if we have - # read and write access. If not, chdir to / + # read and execute access. If not, chdir to / try: f = open(".") except IOError, e: if e.errno == errno.EACCES: - logger.critical(_('No read/write access in current directory, moving to /')) + logger.critical(_('No read/execute access in current directory, moving to /')) os.chdir("/") else: - close(f) + f.close() lockerr = "" while True:
_______________________________________________ Yum-devel mailing list Yum-devel@lists.baseurl.org http://lists.baseurl.org/mailman/listinfo/yum-devel