From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#10733: 24.0.93; w32 file truncation Date: Tue, 07 Feb 2012 19:35:25 +0200 Message-ID: <83bopabl7m.fsf@gnu.org> References: <20120205.143400.416428493.Takaaki.Ota@am.sony.com> <20120205.161623.484163522.Takaaki.Ota@am.sony.com> <83zkcwbo7t.fsf@gnu.org> <874nv45y9f.fsf@wanadoo.es> <87zkcw3pjf.fsf@wanadoo.es> <83vcnjc1yj.fsf@gnu.org> <87r4y74zew.fsf@wanadoo.es> <83sjinbyez.fsf@gnu.org> <87fwen4k6s.fsf@wanadoo.es> <83ipjjb89i.fsf@gnu.org> <877gzz43qz.fsf@wanadoo.es> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1328636177 15150 80.91.229.3 (7 Feb 2012 17:36:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 7 Feb 2012 17:36:17 +0000 (UTC) Cc: lekktu@gmail.com, Takaaki.Ota@am.sony.com, 10733@debbugs.gnu.org To: =?UTF-8?Q?=C3=93scar?= Fuentes Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 07 18:36:13 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ruoxf-0004tY-4y for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Feb 2012 18:36:11 +0100 Original-Received: from localhost ([::1]:51537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruoxe-0008Ct-Do for geb-bug-gnu-emacs@m.gmane.org; Tue, 07 Feb 2012 12:36:10 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:33403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruoxa-0008Cg-MQ for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2012 12:36:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RuoxZ-0005cQ-Hf for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2012 12:36:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RuoxZ-0005cL-G8 for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2012 12:36:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RuoyT-0000eS-So for bug-gnu-emacs@gnu.org; Tue, 07 Feb 2012 12:37:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Feb 2012 17:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10733 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 10733-submit@debbugs.gnu.org id=B10733.13286362112488 (code B ref 10733); Tue, 07 Feb 2012 17:37:01 +0000 Original-Received: (at 10733) by debbugs.gnu.org; 7 Feb 2012 17:36:51 +0000 Original-Received: from localhost ([127.0.0.1]:59228 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RuoyI-0000e4-Jw for submit@debbugs.gnu.org; Tue, 07 Feb 2012 12:36:51 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:45706) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RuoyG-0000dn-2F for 10733@debbugs.gnu.org; Tue, 07 Feb 2012 12:36:49 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LZ100000A14ER00@a-mtaout23.012.net.il> for 10733@debbugs.gnu.org; Tue, 07 Feb 2012 19:35:23 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([84.229.162.243]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LZ1000DTA6X83A0@a-mtaout23.012.net.il>; Tue, 07 Feb 2012 19:35:23 +0200 (IST) In-reply-to: <877gzz43qz.fsf@wanadoo.es> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56655 Archived-At: > From: =D3scar Fuentes > Cc: lekktu@gmail.com, Takaaki.Ota@am.sony.com, 10733@debbugs.gnu.= org > Date: Tue, 07 Feb 2012 06:22:12 +0100 >=20 > Eli Zaretskii writes: >=20 > >> Maybe it can be integrated in the > >>=20 > >> if (!(NILP(Vw32_get_true_file_attributes) ... > >>=20 > >> hence reusing the calls to CreateFile and GetFileInformationByHa= ndle and > >> shortening the patch, but as I don't know what > >> Vw32_get_true_file_attributes does, preferread to follow the saf= e way. > > > > You did right: w32-get-true-file-attributes can be set by the use= r to > > nil, if she wants her file ops faster. >=20 > I was thinking on something like >=20 > 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) > =09} > } > =20 > - if (!(NILP (Vw32_get_true_file_attributes) > -=09|| (EQ (Vw32_get_true_file_attributes, Qlocal) && is_slow_fs (n= ame))) > + buf->st_size =3D 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 =3D=3D 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 inl= ine. > > > > 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. >=20 > Since Emacs' fstat reimplementation is based on > GetFileInformationByHandle, and that the handle points to the linke= d > 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.)