GNU bug report logs - #10733
24.0.93; w32 file truncation

Previous Next

Package: emacs;

Reported by: "Ota, Takaaki" <Takaaki.Ota <at> am.sony.com>

Date: Sun, 5 Feb 2012 22:36:02 UTC

Severity: normal

Found in version 24.0.93

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #85 received at 10733-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: ofv <at> wanadoo.es, lekktu <at> gmail.com, Takaaki.Ota <at> am.sony.com
Cc: 10733-done <at> debbugs.gnu.org
Subject: Re: bug#10733: 24.0.93; w32 file truncation
Date: Fri, 03 Aug 2012 13:59:45 +0300
> Date: Tue, 07 Feb 2012 19:35:25 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: lekktu <at> gmail.com, Takaaki.Ota <at> am.sony.com, 10733 <at> debbugs.gnu.org
> 
> > From: Óscar Fuentes <ofv <at> wanadoo.es>
> > Cc: lekktu <at> gmail.com,  Takaaki.Ota <at> am.sony.com,  10733 <at> debbugs.gnu.org
> > Date: Tue, 07 Feb 2012 06:22:12 +0100
> > 
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> > 
> > >> Maybe it can be integrated in the
> > >> 
> > >> if (!(NILP(Vw32_get_true_file_attributes) ...
> > >> 
> > >> hence reusing the calls to CreateFile and GetFileInformationByHandle and
> > >> shortening the patch, but as I don't know what
> > >> Vw32_get_true_file_attributes does, preferread to follow the safe way.
> > >
> > > You did right: w32-get-true-file-attributes can be set by the user to
> > > nil, if she wants her file ops faster.
> > 
> > I was thinking on something like
> > 
> > diff --git a/src/w32.c b/src/w32.c
> > index 3d3d334..418be63 100644
> > --- a/src/w32.c
> > +++ b/src/w32.c
> > @@ -3447,8 +3447,12 @@ stat (const char * path, struct stat * buf)
> >  	}
> >      }
> >  
> > -  if (!(NILP (Vw32_get_true_file_attributes)
> > -	|| (EQ (Vw32_get_true_file_attributes, Qlocal) && is_slow_fs (name)))
> > +  buf->st_size = 0;
> > +
> > +  if ((!(NILP (Vw32_get_true_file_attributes)
> > +         || (EQ (Vw32_get_true_file_attributes, Qlocal) && is_slow_fs (name)))
> > +       || ((wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) &&
> > +           (wfd.dwReserved0 == IO_REPARSE_TAG_SYMLINK)))
> 
> Then what made you hesitate?  This approach looks fine to me.
> 
> > >> if is-symlink?
> > >>   use fstat
> > >> fi
> > >
> > > Since fstat is also reimplemented, I'd rather do what it does inline.
> > >
> > > For that, we need to know which other attributes are reported
> > > different.  Or maybe just test for the reparse point up front and do
> > > all the work for the target instead.
> > 
> > Since Emacs' fstat reimplementation is based on
> > GetFileInformationByHandle, and that the handle points to the linked
> > file (CreateFile follows the link unless told otherwise), we should be
> > safe delegating all work to `fstat' when a symlink is detected on `stat'
> > (the executable bit must be setted on `stat', but that's no problem.)
> 
> Please compare w32.c's `fstat' with `stat', and you will see that the
> former does much less than the latter, even with information that can
> be gotten by the handle.  To go the way you suggest, we need first to
> make `fstat' a proper subset of `stat'.  (I never had time to do it,
> and since `fstat' is used much less that `stat' in Emacs, more
> important jobs came first.)

Since trunk revision 109416 adds full support for symlinks on
MS-Windows platforms, and fixes this bug as a side effect, I'm closing
this bug.





This bug report was last modified 12 years and 358 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.