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: Fri, 03 Aug 2012 13:59:45 +0300 Message-ID: <83pq78b5r2.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> <83bopabl7m.fsf@gnu.org> 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 1343991646 10690 80.91.229.3 (3 Aug 2012 11:00:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 3 Aug 2012 11:00:46 +0000 (UTC) Cc: 10733-done@debbugs.gnu.org To: ofv@wanadoo.es, lekktu@gmail.com, Takaaki.Ota@am.sony.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 03 13:00:44 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SxFcZ-0003XO-PI for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Aug 2012 13:00:44 +0200 Original-Received: from localhost ([::1]:46411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFcY-00051U-Q8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Aug 2012 07:00:42 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFcQ-00050L-L4 for bug-gnu-emacs@gnu.org; Fri, 03 Aug 2012 07:00:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxFcK-0007rT-5U for bug-gnu-emacs@gnu.org; Fri, 03 Aug 2012 07:00:34 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxFcK-0007rP-2Q for bug-gnu-emacs@gnu.org; Fri, 03 Aug 2012 07:00:28 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SxFje-0004K0-SN for bug-gnu-emacs@gnu.org; Fri, 03 Aug 2012 07:08:03 -0400 Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Aug 2012 11:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 10733 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 10733@debbugs.gnu.org, eliz@gnu.org Original-Received: via spool by 10733-done@debbugs.gnu.org id=D10733.134399207916600 (code D ref 10733); Fri, 03 Aug 2012 11:08:01 +0000 Original-Received: (at 10733-done) by debbugs.gnu.org; 3 Aug 2012 11:07:59 +0000 Original-Received: from localhost ([127.0.0.1]:58386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SxFjZ-0004Jf-H6 for submit@debbugs.gnu.org; Fri, 03 Aug 2012 07:07:58 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:63001) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SxFjW-0004JV-1v for 10733-done@debbugs.gnu.org; Fri, 03 Aug 2012 07:07:55 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0M8600J00EIOMX00@a-mtaout21.012.net.il> for 10733-done@debbugs.gnu.org; Fri, 03 Aug 2012 13:59:51 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M8600JQFEJRCLC0@a-mtaout21.012.net.il>; Fri, 03 Aug 2012 13:59:51 +0300 (IDT) In-reply-to: <83bopabl7m.fsf@gnu.org> 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:62790 Archived-At: > Date: Tue, 07 Feb 2012 19:35:25 +0200 > From: Eli Zaretskii > Cc: lekktu@gmail.com, Takaaki.Ota@am.sony.com, 10733@debbugs.gnu.or= g >=20 > > From: =D3scar Fuentes > > Cc: lekktu@gmail.com, Takaaki.Ota@am.sony.com, 10733@debbugs.gn= u.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 GetFileInformationBy= Handle and > > >> shortening the patch, but as I don't know what > > >> Vw32_get_true_file_attributes does, preferread to follow the s= afe way. > > > > > > You did right: w32-get-true-file-attributes can be set by the u= ser 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 = (name))) > > + buf->st_size =3D 0; > > + > > + if ((!(NILP (Vw32_get_true_file_attributes) > > + || (EQ (Vw32_get_true_file_attributes, Qlocal) && is_sl= ow_fs (name))) > > + || ((wfd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)= && > > + (wfd.dwReserved0 =3D=3D IO_REPARSE_TAG_SYMLINK))) >=20 > Then what made you hesitate? This approach looks fine to me. >=20 > > >> if is-symlink? > > >> use fstat > > >> fi > > > > > > Since fstat is also reimplemented, I'd rather do what it does i= nline. > > > > > > For that, we need to know which other attributes are reported > > > different. Or maybe just test for the reparse point up front a= nd do > > > all the work for the target instead. > >=20 > > Since Emacs' fstat reimplementation is based on > > GetFileInformationByHandle, and that the handle points to the lin= ked > > file (CreateFile follows the link unless told otherwise), we shou= ld 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 probl= em.) >=20 > Please compare w32.c's `fstat' with `stat', and you will see that t= he > former does much less than the latter, even with information that c= an > 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 closin= g this bug.