* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. @ 2013-08-19 8:47 Thierry Volpiatto 2013-08-19 15:43 ` Eli Zaretskii 0 siblings, 1 reply; 8+ messages in thread From: Thierry Volpiatto @ 2013-08-19 8:47 UTC (permalink / raw) To: 15130 Hi, 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? In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2013-08-19 on dell-14z Windowing system distributor `The X.Org Foundation', version 11.0.11103000 System Description: Ubuntu 12.04.2 LTS Important settings: value of $LC_MONETARY: fr_FR.UTF-8 value of $LC_NUMERIC: fr_FR.UTF-8 value of $LC_TIME: fr_FR.UTF-8 value of $LANG: fr_FR.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: recentf-mode: t TeX-PDF-mode: t winner-mode: t global-undo-tree-mode: t undo-tree-mode: t auto-image-file-mode: t eldoc-in-minibuffer-mode: t show-paren-mode: t display-time-mode: t savehist-mode: t golden-ratio-mode: t eldoc-mode: t minibuffer-depth-indicate-mode: t diff-auto-refine-mode: t helm-mode: t helm-descbinds-mode: t shell-dirtrack-mode: t helm-adaptative-mode: t helm-match-plugin-mode: t tooltip-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <up> <up> <up> <up> <up> <up> <up> <up> <f11> s c <down> <down> <return> C-y <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> C-SPC C-n C-g <down> <down> <down> <down> <down> <down> <down> <down> <down> <down> <return> M-( f i l e - d i r e c t o r y - p SPC M-" ~ / . e m a c s . d / <right> <right> C-j <up> <up> C-M-SPC M-w <down> <down> C-y <left> <left> SPC <right> <right> C-j <up> <up> <up> <up> <up> ; ; SPC G N U / L i n u x <up> <up> <up> <up> <up> <return> ; ; SPC W i n d o w s - n t M-: s y s t e m - t y p e <return> <return> <down> <down> <down> <down> <down> <left> <left> <left> <left> <backspace> l <left> <left> <backspace> <backspace> <backspace> g n u <up> <up> <up> <up> <up> <left> <left> <backspace> w <left> <left> <left> <left> C-SPC C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n M-w M-x r e p o r t <return> Recent messages: Running git pull -v git finished. Here is not Git work tree Mark set [2 times] Quit Mark set [2 times] Evaluating... Here is not Git work tree gnu/linux Mark set Load-path shadows: /usr/local/share/emacs/24.3.50/lisp/gnus/.dir-locals hides ~/elisp/magit/.dir-locals ~/elisp/auctex/lpath hides ~/elisp/emacs-wget/lpath ~/elisp/Emacs-wgrep/wgrep-ack hides ~/elisp/jenkins/emacs-wgrep/wgrep-ack ~/elisp/Emacs-wgrep/wgrep-helm hides ~/elisp/jenkins/emacs-wgrep/wgrep-helm ~/elisp/Emacs-wgrep/wgrep-test hides ~/elisp/jenkins/emacs-wgrep/wgrep-test ~/elisp/Emacs-wgrep/wgrep hides ~/elisp/jenkins/emacs-wgrep/wgrep /usr/local/share/emacs/24.3.50/lisp/emacs-lisp/tq hides ~/elisp/emms/lisp/tq ~/.emacs.d/.gnus hides ~/.emacs.d/emacs-config-laptop/.gnus Features: (shadow epa-mail emacsbug helm-command tramp-cache tramp-sh helm-bmkext cl-indent help-mode gnus-html url-cache smiley gnus-cite mail-extr gnus-async gnus-bcklg gnus-ml nndraft nnmh utf-7 nnimap utf7 nnml nnfolder parse-time netrc network-stream starttls tls gnus-agent gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp gnus-cache gnus-dired nnir gnus-sum gnus-group gnus-undo nnmail mail-source nnoo gnus-start gnus-spec gnus-int gnus-range gnus-win helm-dabbrev view recentf ido preview prv-emacs tex-buf reftex-dcr reftex-auc reftex imenu reftex-vars font-latex latex tex-style tex dbus latexenc cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs conf-mode vc-dispatcher vc-rcs sh-script smie executable vc-git naquadah-theme em-smart em-unix em-script em-prompt em-ls em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias align-let git-gutter server package winner undo-tree diff slime-xref-browser slime-banner slime-tramp slime-asdf slime-fancy slime-fontifying-fu slime-package-fu slime-references slime-scratch slime-presentations slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-repl elp image-file newsticker newst-treeview tree-widget newst-plainview newst-reader newst-ticker newst-backend xdvi-search preview-latex pcomplete-extension em-term term disp-table ehelp electric helm-ipython helm-elisp helm-eval python rx eldoc-eval whitespace paren time avoid savehist warnings emamux golden-ratio smtpmail-async smtpmail sendmail helm-async persistent-sessions config-w3m w3m doc-view jka-compr image-mode timezone w3m-hist w3m-fb bookmark-w3m w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util w3m-load boxquote markdown-mode iterator google-maps google-maps-static google-maps-geocode google-maps-base json simple-call-tree iedit-rect rect iedit iedit-lib zop-to-char smallurl mm-url gnus gnus-ems nnheader rectangle-utils ledger-config ledger esh-var esh-io esh-cmd esh-opt esh-ext esh-proc eldoc esh-groups eshell esh-module esh-mode esh-arg esh-util tv-utils async pcvs vc-cvs pcvs-parse pcvs-info pcvs-defs ewoc mb-depth ioccur cl-info slime hyperspec slime-autoloads tex-site auto-loads esh-toggle flymake no-word dired-extension emms-mpd-config emms-playlist-limit emms-volume emms-volume-amixer emms-i18n emms-history emms-score emms-stream-info emms-metaplaylist-mode emms-bookmarks emms-cue emms-mode-line-icon emms-browser sort emms-playlist-sort emms-last-played emms-player-xine emms-player-mpd tq emms-playing-time emms-lyrics emms-url hl-line emms-tag-editor emms-mark emms-mode-line emms-cache emms-info-ogginfo emms-info-mp3info emms-playlist-mode emms-player-vlc emms-player-mplayer emms-info emms-streams later-do emms-source-playlist emms-source-file emms-player-simple emms-setup emms emms-compat magit-blame magit-stgit magit-cherry magit-bisect magit-log-edit log-edit pcvs-util add-log magit-key-mode magit diff-mode magit-compat htmlize-hack htmlize muse-colors muse-docbook muse-texinfo texnfo-upd texinfo muse-latex muse-html muse-xml-common muse-wiki cus-edit cus-start cus-load muse-publish muse-project muse-protocols muse-regexps wid-edit muse muse-nested-tags muse-mode muse-autoloads org-config-thierry ob-sh cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays hol-loaddefs vc-hg org-wl org-w3m org-vm org-rmail org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp org-exp-blocks org-info org-gnus org-docview org-bibtex bibtex org-bbdb org-agenda appt diary-lib diary-loaddefs org-annotation-helper org-capture org-mks remember org-remember org-datetree addressbook-bookmark message rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev mail-utils gmm-utils mailheader firefox-protocol bookmark-firefox-handler bookmark-extensions bookmark pp init-helm-thierry helm-mode helm-ls-git helm-descbinds helm-ls-hg helm-files image-dired tramp tramp-compat tramp-loaddefs trampver shell dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen helm-tags helm-bookmark helm-adaptative helm-info helm-net browse-url xml url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util url-parse url-vars mailcap helm-plugin helm-help helm-match-plugin helm-grep wgrep-helm wgrep helm-regexp grep helm-external helm-utils dired compile helm-locate helm helm-config helm-aliases epa-file epa derived epg epg-config auth-source eieio eieio-core gnus-util mm-util mail-prsvr password-cache usage-memo w3m-wget info cl-macs gv edmacro kmacro org-crypt org byte-opt bytecomp byte-compile cconv ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys org-pcomplete pcomplete comint ansi-color ring org-list org-faces org-entities time-date noutline outline easy-mmode org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs format-spec find-func cal-menu easymenu calendar cal-loaddefs advice help-fns net-utils cl cl-loaddefs cl-lib tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-19 8:47 bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug Thierry Volpiatto @ 2013-08-19 15:43 ` Eli Zaretskii 2013-08-20 6:35 ` Thierry Volpiatto ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Eli Zaretskii @ 2013-08-19 15:43 UTC (permalink / raw) To: Thierry Volpiatto; +Cc: 15130 > From: Thierry Volpiatto <thierry.volpiatto@gmail.com> > 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-19 15:43 ` Eli Zaretskii @ 2013-08-20 6:35 ` Thierry Volpiatto 2013-08-20 6:37 ` Thierry Volpiatto 2013-08-20 11:47 ` Thierry Volpiatto 2 siblings, 0 replies; 8+ messages in thread From: Thierry Volpiatto @ 2013-08-20 6:35 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 15130 Eli Zaretskii <eliz@gnu.org> writes: >> From: Thierry Volpiatto <thierry.volpiatto@gmail.com> >> 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-<backspace> 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-19 15:43 ` Eli Zaretskii 2013-08-20 6:35 ` Thierry Volpiatto @ 2013-08-20 6:37 ` Thierry Volpiatto 2013-08-20 14:50 ` Eli Zaretskii 2013-08-20 11:47 ` Thierry Volpiatto 2 siblings, 1 reply; 8+ messages in thread From: Thierry Volpiatto @ 2013-08-20 6:37 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 15130 BTW maybe the description of this behavior can be mentioned in manual? -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-20 6:37 ` Thierry Volpiatto @ 2013-08-20 14:50 ` Eli Zaretskii 0 siblings, 0 replies; 8+ messages in thread From: Eli Zaretskii @ 2013-08-20 14:50 UTC (permalink / raw) To: Thierry Volpiatto; +Cc: 15130-done > From: Thierry Volpiatto <thierry.volpiatto@gmail.com> > Cc: 15130@debbugs.gnu.org > Date: Tue, 20 Aug 2013 08:37:50 +0200 > > BTW maybe the description of this behavior can be mentioned in manual? Done in trunk revision 113959. ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-19 15:43 ` Eli Zaretskii 2013-08-20 6:35 ` Thierry Volpiatto 2013-08-20 6:37 ` Thierry Volpiatto @ 2013-08-20 11:47 ` Thierry Volpiatto 2013-08-20 14:29 ` Eli Zaretskii 2 siblings, 1 reply; 8+ messages in thread From: Thierry Volpiatto @ 2013-08-20 11:47 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 15130 Eli Zaretskii <eliz@gnu.org> writes: > 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/' ;-) BTW, actually using: (eq t (car (file-attributes (file-name-as-directory directory)))) seems to be an option to know if we really have a directory named " ". -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-20 11:47 ` Thierry Volpiatto @ 2013-08-20 14:29 ` Eli Zaretskii 2013-08-20 14:37 ` Thierry Volpiatto 0 siblings, 1 reply; 8+ messages in thread From: Eli Zaretskii @ 2013-08-20 14:29 UTC (permalink / raw) To: Thierry Volpiatto; +Cc: 15130 > From: Thierry Volpiatto <thierry.volpiatto@gmail.com> > Cc: 15130@debbugs.gnu.org > Date: Tue, 20 Aug 2013 13:47:21 +0200 > > BTW, actually using: > > (eq t (car (file-attributes (file-name-as-directory directory)))) > > seems to be an option to know if we really have a directory named " ". I suggest to use file-accessible-directory-p instead of file-attributes, the former is much cheaper on MS-Windows. And if you are wondering why file-accessible-directory-p works where file-directory-p doesn't, then the reason is that the latter internally removes trailing slashes, so file-name-as-directory has no effect in that case. ^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug. 2013-08-20 14:29 ` Eli Zaretskii @ 2013-08-20 14:37 ` Thierry Volpiatto 0 siblings, 0 replies; 8+ messages in thread From: Thierry Volpiatto @ 2013-08-20 14:37 UTC (permalink / raw) To: Eli Zaretskii; +Cc: 15130 Eli Zaretskii <eliz@gnu.org> writes: >> From: Thierry Volpiatto <thierry.volpiatto@gmail.com> >> Cc: 15130@debbugs.gnu.org >> Date: Tue, 20 Aug 2013 13:47:21 +0200 >> >> BTW, actually using: >> >> (eq t (car (file-attributes (file-name-as-directory directory)))) >> >> seems to be an option to know if we really have a directory named " ". > > I suggest to use file-accessible-directory-p instead of > file-attributes, the former is much cheaper on MS-Windows. Great, thanks. > And if you are wondering why file-accessible-directory-p works where > file-directory-p doesn't, then the reason is that the latter > internally removes trailing slashes, so file-name-as-directory has no > effect in that case. Ok. -- Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997 ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-08-20 14:50 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-08-19 8:47 bug#15130: 24.3.50; emacs-24.3.1 on Windows; possible `file-directory-p' bug Thierry Volpiatto 2013-08-19 15:43 ` Eli Zaretskii 2013-08-20 6:35 ` Thierry Volpiatto 2013-08-20 6:37 ` Thierry Volpiatto 2013-08-20 14:50 ` Eli Zaretskii 2013-08-20 11:47 ` Thierry Volpiatto 2013-08-20 14:29 ` Eli Zaretskii 2013-08-20 14:37 ` Thierry Volpiatto
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.