Skip to content

isort should not change the uid/gid when writing a file #1638

@taxonomic-blackfish

Description

@taxonomic-blackfish

If isort is run against a file, it will change the owner of the file to the uid/gid of the user running the command rather than the original owner of the file. It would be useful to attempt to retain original permissions. This is of particular concern when running dockerized dev containers with formatting tools installed that may run as a user other that of the host machine.

For comparison, the tool black does not appear to have this issue when run in the same contexts.

Example:

# stat -c %u:%g ./foo.py
1000:1000
# isort ./foo.py
Fixing /src/foo.py
# stat -c %u:%g ./foo.py
0:0

The expected result is the final stat returns 1000:1000.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions