Re:Dstat project ended due to RedHat replacing it with its o...
by mehrdadn on Thursday May 23, 2019 @10:39PM
(#19998009)
I don't think __file__ would be any different... it's not even an absolute path necessarily. That's why I said I don't think there's any secure way to do this in Python.
You're right though, I didn't see the issue was still there. The home directory should also not be there either. I think I looked at this too hastily but now I'm confused too.
Re:Dstat project ended due to RedHat replacing it with its o...
by user5994461 on Sunday May 26, 2019 @08:36AM
(#20014603)
os.path.realpath(__file__)
That will give you the absolute path of the current python script, dereferencing any symlink and the .. notation.
If so, it could be argued the bug already existed and this patch simply uses the existing behaviour...