Community
Participate
Working Groups
When saving a source file there are extra characters saved at the end of the file. This only happens if i have deleted lets say 10 characters. The last 10 characters of the file are repeated. Ex: std::cout << "Hello World\n"; std::cout << "Hello again\n"; } Saving this works, but if i remove the blank lines and save the file it is saved as: std::cout << "Hello World\n"; std::cout << "Hello again\n"; } } I'm using samba to access my projects on a file server. If i create a local project on my desktop i can't create the same bug.
Created attachment 64563 [details] Fixed version of LocalFile.java This is a proposed fix for the issue described in this bug report. I would have attached a patch file, but the corporate firewall I'm behind prevents access to Eclipse's CVS repository.
I've also encountered this bug while saving files from Eclipse running under Windows XP to a Samba share on a SunOS box. I'm guessing that this issue stems from some peculiarity in the Samba setup here, or it would be much more widely reported. Anyway, what seems to be happening is that when a FileOutputStream is opened on an existing file on the Samba share, the file contents aren't cleared as they should be. Any bytes subsequently written to the stream will overwrite bytes in the existing file. If the file being saved is smaller than the file on disk, there won't be enough bytes to entirely overwrite the file on disk, so the end of the old file will remain. See the java file I've attached to this bug report for a proposed fix.
Seems to be a Platform issue. Changing Product/Component.
Campbell: Your version of LocalFile seems to be based on an older version. When I compare against current HEAD I see many changes. What version of LocalFile did you start with? Can list the methods that you changed?
(In reply to comment #4) Hi John, Yes, sorry about that - as mentioned in the attachment comment, I'm currently unable to access CVS due to draconian corporate firewall rules. I started with the version of LocalFile that comes with Eclipse SDK 3.2.2 (i.e. org.eclipse.core.filesystem_1.0.0.v20060603). I've changed the method openOutputStream(int, IProgressMonitor), and added safeClose(OutputStream). Would it be better if I waited until I can get CVS access?
No, I can figure it out now that I know what version it's based on. I'm not sure this trick is going to work on all platforms and with all VMs - it will need some more testing.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.