diff options
author | Devan Franchini <twitch153@gentoo.org> | 2015-03-24 21:09:21 -0400 |
---|---|---|
committer | Devan Franchini <twitch153@gentoo.org> | 2015-03-24 21:09:21 -0400 |
commit | 02d71289ada4baefd412c9297eccb2408dfb94a2 (patch) | |
tree | a4b595decbc178e45addc787989a2cddbedabe5e | |
parent | reposconf.py: Adds sanity checking on self.path (diff) | |
download | layman-02d71289ada4baefd412c9297eccb2408dfb94a2.tar.gz layman-02d71289ada4baefd412c9297eccb2408dfb94a2.tar.bz2 layman-02d71289ada4baefd412c9297eccb2408dfb94a2.zip |
reposconf.py: Adds check to prevent conf_path false negative
In the check_conf_path() function if the file did not previously
exist and you tried to write to the repos.conf file specified by
repos_conf it would generate a false negative declaring that
repos_conf is a directory when it should be a file. This is clearly
not the case and remedied by calling os.access () in conjunction with
os.path.isfile () prior to declaring that the target is a directory.
X-Gentoo-Bug: 538324
X-Gentoo-Bug-URL: https://bugs.gentoo.org/538324
-rw-r--r-- | layman/config_modules/reposconf/reposconf.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/layman/config_modules/reposconf/reposconf.py b/layman/config_modules/reposconf/reposconf.py index d107f05..a57c87e 100644 --- a/layman/config_modules/reposconf/reposconf.py +++ b/layman/config_modules/reposconf/reposconf.py @@ -41,7 +41,8 @@ def check_conf_path(conf_path): if not os.path.isdir(dirname): msg = '%s is not a directory when it should be.' % dirname - elif not os.path.isfile(conf_path): + elif (os.access(conf_path, os.R_OK | os.W_OK) and + not os.path.isfile(conf_path)): msg = '%s is not a file when it should be.' % conf_path if msg: |