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#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. Date: Mon, 19 Aug 2013 18:43:25 +0300 Message-ID: <83haellm8y.fsf@gnu.org> References: <87y57yjcdf.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1376927001 20323 80.91.229.3 (19 Aug 2013 15:43:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Aug 2013 15:43:21 +0000 (UTC) Cc: 15130@debbugs.gnu.org To: Thierry Volpiatto Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 19 17:43:21 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 1VBRc0-0002WL-UF for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2013 17:43:21 +0200 Original-Received: from localhost ([::1]:43722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBRc0-00045B-IY for geb-bug-gnu-emacs@m.gmane.org; Mon, 19 Aug 2013 11:43:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52348) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBRbq-00041X-V8 for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2013 11:43:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBRbj-0007uC-M9 for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2013 11:43:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46298) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBRbj-0007u5-Ik for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2013 11:43:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VBRbj-0006jB-29 for bug-gnu-emacs@gnu.org; Mon, 19 Aug 2013 11:43:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Aug 2013 15:43:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15130 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15130-submit@debbugs.gnu.org id=B15130.137692697825839 (code B ref 15130); Mon, 19 Aug 2013 15:43:03 +0000 Original-Received: (at 15130) by debbugs.gnu.org; 19 Aug 2013 15:42:58 +0000 Original-Received: from localhost ([127.0.0.1]:40613 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VBRbe-0006ig-0m for submit@debbugs.gnu.org; Mon, 19 Aug 2013 11:42:58 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:65149) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VBRbb-0006iO-Sj for 15130@debbugs.gnu.org; Mon, 19 Aug 2013 11:42:56 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0MRS00000BL6XV00@a-mtaout20.012.net.il> for 15130@debbugs.gnu.org; Mon, 19 Aug 2013 18:42:45 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MRS000YCBN9MJ60@a-mtaout20.012.net.il>; Mon, 19 Aug 2013 18:42:45 +0300 (IDT) In-reply-to: <87y57yjcdf.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.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:77514 Archived-At: > From: Thierry Volpiatto > Date: Mon, 19 Aug 2013 10:47:24 +0200 > > On windows `file-directory-p' returns t on a path with a space added at > end. > > ;; windows-nt > (file-directory-p "c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/") > t > (file-directory-p "c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/ ") > t > ;; gnu/linux > (file-directory-p "~/.emacs.d/") > t > (file-directory-p "~/.emacs.d/ ") > nil > > Is it wanted? It's wanted only if you really have a directory named " " under 'c:/Program Files/emacs-24.3-bin-i386/emacs-24.3/site-lisp/' ;-) Seriously, though: this is not Emacs's fault. There's no code in Emacs that removes that space from the name; we simply hand the (expanded) file name to the Windows API that returns file attributes, and if the returned attributes say it's a directory, we return t. More generally, all Win32 APIs ignore trailing whitespace in file names. OTOH, it _is_ possible to create file names such as "/foo/ " on Windows (by using a file-name syntax that bypasses the Win32 file-name normalization layer), so rejecting file names such as the one you show is not an option. On the third hand, converting every file name to that syntax internally, so that we bypass the normalization, is a large job, whose risks are unknown, at least to me, and whose gains are quite small, since use cases where you trip upon such problems are very rare (can you tell what was your use case, btw?). So I think we will have to continue living with this idiosyncrasy of Windows filesystems.