[kate] very bad format on save with symlink

Hi,
bug or my config ?

with kate (25.04.0-1), i use ruff : format on save

I have a file test1.py :

#!/usr/bin/env python

from pathlib import Path

if __name__ == "__main__":
    print("hello")

I create symlink test2.py from test1.py (usually in ~/.local/bin/)

When I edit test1.py, and save (with auto-format), is OK
When i edit test2.py, and save (with auto-format), is KO

result:

#!/usr/bin/env python

from pathlib import Path

if __name__ == "__main__":
    print("hello")
from pathlib import Path

if __name__ == "__main__":
    print("hello")

with symlink, kate duplicate always all content except the first 2 lines :zany_face:

if i run ruff format test2.py , it’s ok
if I use in kate : client LSP → format, it’s ok no duplicate
with “shebang” or not, same error


after 3 “save” :rofl:

#!/usr/bin/env python

from pathlib import Path

if __name__ == "__main__":
    print("hello3")
from pathlib import Path

if __name__ == "__main__":
    print("hello")
from pathlib import Path

if __name__ == "__main__":
    print("hello2")
from pathlib import Path

if __name__ == "__main__":
    print("hello")
from pathlib import Path

if __name__ == "__main__":
    print("hello3")
from pathlib import Path

if __name__ == "__main__":
    print("hello")
from pathlib import Path

if __name__ == "__main__":
    print("hello2")
from pathlib import Path

if __name__ == "__main__":
    print("hello")