gitless-vcs / gitless

A simple version control system built on top of Git
https://gitless.com
MIT License
1.93k stars 106 forks source link

Stop following symlinks 216 #224

Closed docoleman closed 4 years ago

docoleman commented 4 years ago

Add a check for symlinks when we check if a path is a directory and treat the symlink as a normal file. Gitless will NOT follow the symlinks, because it could pull in the .git/ directory, files outside of the repository or, in the worst case, the entire filesystem. This follows the behavior of git. Git will commit symlinks into the repository and recreate the links on filesystems that support it when the file is downloaded.

docoleman commented 4 years ago

Huge combination of OS and Python version support... I need a matrix. Here's the best explanation I have: https://docs.python.org/3.5/library/os.html#os.symlink Python 3 supports os.symlink() on all platforms, but might throw exceptions in the implementation. In python 2, there is no method os.symlink() in the os module for Windows (https://docs.python.org/2.7/library/os.html#os.symlink). Hopefully my error handling catches all the cases now.

docoleman commented 4 years ago

Huge combination of OS and Python version support... I need a matrix. Here's the best explanation I have: https://docs.python.org/3.5/library/os.html#os.symlink Python 3 supports os.symlink() on all platforms, but might throw exceptions in the implementation. In python 2, there is no method os.symlink() in the os module for Windows (https://docs.python.org/2.7/library/os.html#os.symlink). Hopefully my error handling catches all the cases now.

Tests & CI are not running? Or I can't see any results. Anything I need to do specifically to kick those off?

spderosso commented 4 years ago

Tests & CI are not running? Or I can't see any results. Anything I need to do specifically to kick those off?

Not sure what's going on. Looks like Travis is getting confused, but I can trigger builds manually.

I changed except foo, bar, baz to except (foo, bar, baz) (commit) because that was throwing an invalid syntax error when I triggered the build manually.

See the comment I made on the symlink signature. If we change the symlink call then tests should pass on both python 2 and python 3

docoleman commented 4 years ago

Looks like tests are passing in both now. Next time I'll get them set up and running before I commit...

spderosso commented 4 years ago

Thank you for fixing this bug!

spderosso commented 4 years ago

Fixes #216