From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. Date: Tue, 20 Aug 2013 08:35:13 +0200 Organization: Emacs Helm Message-ID: <87mwoczx7i.fsf@gmail.com> References: <87y57yjcdf.fsf@gmail.com> <83haellm8y.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1376980577 14605 80.91.229.3 (20 Aug 2013 06:36:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Aug 2013 06:36:17 +0000 (UTC) Cc: 15130@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 20 08:36:18 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 1VBfY9-000772-NB for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Aug 2013 08:36:17 +0200 Original-Received: from localhost ([::1]:46235 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBfY9-0001qI-8j for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Aug 2013 02:36:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBfY0-0001pk-Iz for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2013 02:36:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBfXu-0008Mb-MO for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2013 02:36:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47506) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBfXu-0008MV-I6 for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2013 02:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VBfXt-0001st-Oh for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2013 02:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Aug 2013 06:36:01 +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.13769805367206 (code B ref 15130); Tue, 20 Aug 2013 06:36:01 +0000 Original-Received: (at 15130) by debbugs.gnu.org; 20 Aug 2013 06:35:36 +0000 Original-Received: from localhost ([127.0.0.1]:41822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VBfXR-0001s5-3I for submit@debbugs.gnu.org; Tue, 20 Aug 2013 02:35:33 -0400 Original-Received: from mail-ea0-f180.google.com ([209.85.215.180]:40599) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VBfXL-0001rn-CY for 15130@debbugs.gnu.org; Tue, 20 Aug 2013 02:35:31 -0400 Original-Received: by mail-ea0-f180.google.com with SMTP id h10so8125eaj.25 for <15130@debbugs.gnu.org>; Mon, 19 Aug 2013 23:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=bLz8DynfCg7hVBGSTwqXdKekIMR6nAHBC+ZBkGX5N/U=; b=nLiWkZkWJnGveenanTpNtDXH1ZyGB9d6AZMLp9ARDyIyIoAHEqmV8lzYYfIhDRtHLW /IaCvd3C3bgS2+fwJZL/XqZ5jG6/ssTiMaBdNsqruZnpaGpWIvcmfMMqX3g0SAjzgsNa jEUUqE77KbaHVFeR0TYAQVyIk6oVXyS9AbrHqEATa7r/aXAI0gopWU0+PYRorEPLA5Hn xZRBfEsQeqHKU/3DwrjdH3j2upC0meZ2yJZ0LaoIgNLkoFsoT1tm5LxIRc5+/FTTjMmD DvHOUMJzKZBtGTo1ITjeQ//CIyZi/s4j9AcvlVahKctMEnXBD5ZQeZJrWUP7WNUu99PI poiw== X-Received: by 10.14.220.200 with SMTP id o48mr12065eep.62.1376980526432; Mon, 19 Aug 2013 23:35:26 -0700 (PDT) Original-Received: from dell-14z ([37.161.64.96]) by mx.google.com with ESMTPSA id h52sm105501eez.3.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 19 Aug 2013 23:35:25 -0700 (PDT) In-Reply-To: <83haellm8y.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 19 Aug 2013 18:43:25 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:77533 Archived-At: Eli Zaretskii writes: >> 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 Of course, fixing that on the emacs side is not an option. > (can you tell what was your use case, btw?). If I enter in minibuffer e.g "~/.emacs.d" helm detect that ".emacs.d" is a directory, append a "/" and give completion on this directory. When I enter in minibuffer "~/.emacs.d/ " it wait for multi regexp completion, e.g I can enter then "~/.emacs.d/ i ni el" or "~/.emacs.d/ el$" to complete "init.el" or all *.el files in this directory. On Windows, as soon I enter the trailing space, the directory (which doesn't exists) "~/.emacs.d/ " is detected and the end slash is added to complete against "~/.emacs.d/ /" which is unwanted. Though hitting C- disable this feature and allow entering a space without instant completion. > So I think we will have to continue living with this idiosyncrasy of > Windows filesystems. Yes. Thanks for explanations, probably you can close this bug. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997