Hello Oswald, On Tue, 2005-03-29 at 22:37 +0200, Oswald Buddenhagen wrote: > On Tue, Mar 29, 2005 at 05:46:33PM +0200, Jindrich Novy wrote: > > On Tue, 2005-03-29 at 11:07 +0300, Andrew V. Samoilov wrote: > > > There is a data loss possible if file is edited with external editor over > > > VFS. > > > > I have similar experience even with mcedit without VFS -> data loss when > > disk quota is exceeded, the edited file is truncated to zero size. I had > > these problems with mc-4.5.51 so I'm not sure if it's still a problem > > with recent mc. > > > i've had this just yesterday ... good luck it was no important file. > this happens with the quick save mode ... it must, given the way it > works. not sure it can be fixed properly at all without just switching > to another mode. oh, well, it could be fixed to not lose data, but the > resulting file would be a bit inconsistent. >
Seems like mc still tests presence of a file on local filesystem in rather brutal way when quick-saving: if (!vfs_file_is_local (filename) || (fd = mc_open (filename, O_WRONLY | O_BINARY)) == -1) what actually truncates the filename to zero size. The proposed patch modifies the opening mode to O_RDONLY so that we shouldn't lose any data at this point. Furthermore I noticed ctype.h is #included redundantly twice in edit_cmd.c. This fixes the second patch. Jindrich -- Jindrich Novy <[EMAIL PROTECTED]>, http://people.redhat.com/jnovy/
--- mc/edit/editcmd.c.dontrewrite 2005-03-17 22:18:23.000000000 +0100 +++ mc/edit/editcmd.c 2005-03-30 09:28:25.076282176 +0200 @@ -240,7 +240,7 @@ edit_save_file (WEdit *edit, const char } if (!vfs_file_is_local (filename) || - (fd = mc_open (filename, O_WRONLY | O_BINARY)) == -1) { + (fd = mc_open (filename, O_RDONLY | O_BINARY)) == -1) { /* * The file does not exists yet, so no safe save or * backup are necessary.
--- mc/edit/editcmd.c.ctype 2005-03-17 22:18:23.000000000 +0100 +++ mc/edit/editcmd.c 2005-03-30 10:05:48.983156480 +0200 @@ -24,7 +24,6 @@ /* #define PIPE_BLOCKS_SO_READ_BYTE_BY_BYTE */ #include <config.h> -#include <ctype.h> #include <stdio.h> #include <stdarg.h>
_______________________________________________ Mc-devel mailing list http://mail.gnome.org/mailman/listinfo/mc-devel