Open shkm opened 4 years ago
I now see that this has already been handled by another PR: https://github.com/DiffSK/configobj/pull/187.
I'll leave this open, though; I'm not sure what's the better solution here. Feel free to close if the other is preferred.
FWIW I'm not a python developer so this code may have repercussions that I'm unable to diagnose.
Background
I'm doing some manual templating on config files for two programs: khal and khard, both of which use configobj. Neither program allows for interpolation in the config files, so I was required to roll my own. Essentially, I run these programs with a wrapper like this:
Sourcing
pimenv
provides a bunch of environment variables which are interpolated into the config file using envsubst with process substitution, producing a file descriptor (/dev/fd/63
).On Linux, at least,
os.path.isfile()
returnsFalse
for this descriptor, butos.path.islink()
returns True. As a result, even though the file is readable, configobj never tries to read it and throws an error.The Fix
Well, the code is pretty self-explanatory. I've tested this under both khal and khard, and found that everything works as expected now. Interestingly,
os.path.isfile()
does return True for a symlink, so this is probably quite an edge case.