-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Fix symlinks being replaced with files on save #5573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The fix itself looks ok, but I'm wondering if we really need this "write to a tempfile, delete the original and move the tempfile"-approach here at all? Just opening the original file for writing would transparently handle symbolic links AFAICS? Digging through git history shows that it used to work like that, but it was changed in upstream processing, without any comments about why this is: 2e26a2d9#diff-b6fda0bf6be0a53c0741a9b02ac16f37R1898 Digging in the Processing repo gives this commit and this bug report, which says the tempfile is to prevent truncating the file when the disk is full, which seems like a good reason. The latest version of Processing has also fixed the symlink problem similar like in this PR (though it uses @facchinm, could you update the PR to use |
Thanks for digging into Processing sources @matthijskooijman ! |
dafc628
to
6064621
Compare
@matthijskooijman , how does it look now? Functionality is ok |
|
||
try { | ||
File canon = file.getCanonicalFile(); | ||
file = canon; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can just be file = file.getCanonicalFile();
. If getCanonicalFile()
throws, the assignment will not be executed.
6064621
to
2d1f49a
Compare
✅ Build completed. Please test this code using one of the following: ⬇️ http://downloads.arduino.cc/javaide/pull_requests/arduino-PR-5573-BUILD-621-linux32.tar.xz ℹ️ The |
Fixes #5478
tested on Linux, please confirm that it works in Win and OSX before merging