[Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

eryk sun eryksun at gmail.com
Tue May 14 19:18:02 EDT 2019


On 5/14/19, Steven D'Aprano <steve at pearwood.info> wrote:
>
> On posix systems, you should be able to use chattr +i to make the file
> immutable, so that the attacker cannot remove or replace it.

Minor point of clarification. File attributes, and APIs to access
them, are not in the POSIX standard. chattr is a Linux command that
wraps the filesystem IOCTLs for getting and setting file attributes.
There's no chattr system call, so thus far it's not supported in
Python's os module. BSD and macOS have chflags, which supports both
system- and user-immutable file attributes. Python supports it as
os.chflags.


More information about the Python-ideas mailing list