Sunday, March 28, 2010

Path/executable() Bug

The executable() function cannot find files that are in the $PATH, where the file's path element contains a tilde.

For example, I have a /home/paul/bin/xsel executable. With my $PATH set to ~/bin:...etc, the code below prints the error message,

xsel not found in ~/bin:/home/paul/.vim/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/opt/kde3/lib/qt3/bin:/opt/kde3/bin:/usr/share/texmf/bin:.

With my path set to /home/paul/bin:...etc, the code prints

xsel found in /home/paul/bin:/home/paul/.vim/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/java/bin:/usr/lib/kde4/libexec:/usr/lib/qt/bin:/opt/kde3/lib/qt3/bin:/opt/kde3/bin:/usr/share/texmf/bin:.

if executable('xsel')
echon "xsel found"
else
echon "xsel not found"
endif
echon " in " . $PATH

When my $PATH is either of the two, I can run xsel just fine from anywhere, from the bash command line.

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Mar 11 2010 16:09:27)
Included patches: 1-394
Compiled by <volkerdi@slackware.com>
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+float +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm
-mouse_jsbterm +mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte
+multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl +postscript
+printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind
+signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse
+textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
-X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -D_FORTIFY_SOURCE=1 -D_REENTRANT -D_GNU_SOURCE -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl5/5.10.1/i486-linux-thread-multi/CORE -I/usr/include/python2.6 -pthread
Linking: gcc -Wl,-E -L/usr/local/lib -o vim -lncurses -lacl -lgpm -Wl,-E -fstack-protector -L/usr/local/lib -L/usr/lib/perl5/5.10.1/i486-linux-thread-multi/CORE -lperl -lcrypt -lutil -lc -L/usr/lib/python2.6/config -lpython2.6 -lpthread -lutil -lm -Xlinker -export-dynamic

--

.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

No comments:

Post a Comment