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#13807: updated version to avoid MS-Windows vs non-MS-Windows clashes Date: Tue, 05 Mar 2013 20:38:02 +0200 Message-ID: <834ngp3d6d.fsf@gnu.org> References: <512A98D5.7080000@cs.ucla.edu> <512D3508.1000906@cs.ucla.edu> <83txoxwq0p.fsf@gnu.org> <51326459.4030001@cs.ucla.edu> <83vc99tsbm.fsf@gnu.org> <51327F29.5000600@cs.ucla.edu> <83ppzgtp2c.fsf@gnu.org> <5133E313.5040701@cs.ucla.edu> <83ip57t8h3.fsf@gnu.org> <5135579C.400@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1362508726 21403 80.91.229.3 (5 Mar 2013 18:38:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Mar 2013 18:38:46 +0000 (UTC) Cc: 13807@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 05 19:39:07 2013 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 1UCwlX-0005Nq-0Q for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Mar 2013 19:39:07 +0100 Original-Received: from localhost ([::1]:35411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwlB-0005JW-EG for geb-bug-gnu-emacs@m.gmane.org; Tue, 05 Mar 2013 13:38:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwl8-0005IE-Dw for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2013 13:38:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCwl7-0006UO-CL for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2013 13:38:42 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56912) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCwl7-0006UA-8l for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2013 13:38:41 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UCwlS-00009M-3t for bug-gnu-emacs@gnu.org; Tue, 05 Mar 2013 13:39:02 -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, 05 Mar 2013 18:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13807 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 13807-submit@debbugs.gnu.org id=B13807.1362508720544 (code B ref 13807); Tue, 05 Mar 2013 18:39:02 +0000 Original-Received: (at 13807) by debbugs.gnu.org; 5 Mar 2013 18:38:40 +0000 Original-Received: from localhost ([127.0.0.1]:32788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCwl4-00008h-0K for submit@debbugs.gnu.org; Tue, 05 Mar 2013 13:38:38 -0500 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:63125) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UCwl0-00008R-KF for 13807@debbugs.gnu.org; Tue, 05 Mar 2013 13:38:36 -0500 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MJ700M00AFI1500@a-mtaout20.012.net.il> for 13807@debbugs.gnu.org; Tue, 05 Mar 2013 20:38:06 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MJ700LK5AFHW830@a-mtaout20.012.net.il>; Tue, 05 Mar 2013 20:38:06 +0200 (IST) In-reply-to: <5135579C.400@cs.ucla.edu> 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.x 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:72125 Archived-At: > Date: Mon, 04 Mar 2013 18:25:32 -0800 > From: Paul Eggert > CC: monnier@iro.umontreal.ca, 13807@debbugs.gnu.org > > > This will need a no-op emulation of fchmod for Windows (since a file > > created here will be world-writable anyway). > > OK, thanks. Also, older POSIXish hosts that lack mkstemp won't need > the fchmod either. I added the following to try to address these two points. > Revised complete patch attached, relative to trunk bzr 111938. Thanks, I have 2 more nits. > + while ((nbytes = readlinkat (AT_FDCWD, lfname, lfinfo, MAX_LFINFO + 1)) < 0 > + && errno == EINVAL) > { > - lfinfo[nbytes] = '\0'; > - return build_string (lfinfo); > + int fd = emacs_open (lfname, O_RDONLY | O_BINARY | O_NOFOLLOW, 0); > + if (0 <= fd) > + { > + ptrdiff_t read_bytes = emacs_read (fd, lfinfo, MAX_LFINFO + 1); > + int read_errno = errno; > + if (emacs_close (fd) != 0) > + return -1; > + errno = read_errno; > + return read_bytes; > + } > + > + if (errno != ELOOP) > + return -1; We will need to define away O_NOFOLLOW and ELOOP, to get this to compile on Windows. I think the right place for the former is nt/inc/unistd.h, near O_NOCTTY, and for the latter nt/inc/ms-w32.h, where ENOTSUP is defined. Other than that, I think this is OK. Thanks.