JakobGM / astrality

Astrality - A modular and dynamic configuration file manager
https://astrality.readthedocs.io
MIT License
98 stars 3 forks source link

Prevent recursive symlinks #33

Closed JakobGM closed 6 years ago

JakobGM commented 6 years ago

Closes #25.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 438


Files with Coverage Reduction New Missed Lines %
astrality/filewatcher.py 4 97.06%
<!-- Total: 4 -->
Totals Coverage Status
Change from base Build 434: 0.01%
Covered Lines: 3690
Relevant Lines: 3783

💛 - Coveralls
sshashank124 commented 6 years ago

If content is A and target is B, and the current set up is:

A (actual data)
B  --->  C (B symlinked to C)
C (another file)

If we execute the symlink action, I tested and it ends up with the following:

A
B  --->  A
B.bak  --->  C
C

So the question is, when dealing with existing symlinks, do we stil want to create a backup of the symlink or just "re-point" the symlink to the new content (since the actual data in C is not actually lost therefore needing a .bak)? Either way, changes look good

JakobGM commented 6 years ago

Good catch! Yes, I think taking backups of existing symlinks seems unecessary, so I added an additional conditional for taking backups.