Bug#542430: [vim] vim try to expand files or directories that contain ~ (when using tcsh shell)

2009-11-03 Thread James Vega
On Thu, Aug 20, 2009 at 9:28 AM, James Vega james...@debian.org wrote:
 On Wed, Aug 19, 2009 at 05:55:54PM +0200, gregory hainaut wrote:
 Please find attached a patch that seems solve the problem not sure it
 is the good solution (and works in all situations). Maybe a solution
 will be to escaped ~ like '\~' before sending to the tcsh shell.

 This looks good to me.  I'll forward it upstream and see what he thinks.
 Thanks for the patch. :)

Looking into this further, this isn't actually a problem with using tcsh
or the expansion of '~'.  The problem is what that Vim isn't properly
detecting which shell you're using because you've set 'shell' to
/bin/tcsh -f instead of simply /bin/tcsh.

In src/os_unix.c

5354 else if ((len = STRLEN(p_sh)) = 3)
5355 {
5356 if (STRCMP(p_sh + len - 3, csh) == 0)
5357 shell_style = STYLE_GLOB;

Vim checks whether the last 3 characters of 'shell' are csh.  Since
that fails with your setting, Vim then uses an sh-compatible method for
expansion.  This obviously fails with tcsh.

So, the simple workaround for now is to simply set shell=/bin/tcsh.
I'll send this information to Bram so he knows about it.

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega james...@debian.org



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#542430: [vim] vim try to expand files or directories that contain ~ (when using tcsh shell)

2009-08-20 Thread James Vega
On Wed, Aug 19, 2009 at 05:55:54PM +0200, gregory hainaut wrote:
 Please find attached a patch that seems solve the problem not sure it
 is the good solution (and works in all situations). Maybe a solution
 will be to escaped ~ like '\~' before sending to the tcsh shell.

This looks good to me.  I'll forward it upstream and see what he thinks.
Thanks for the patch. :)

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega james...@debian.org


signature.asc
Description: Digital signature


Bug#542430: [vim] vim try to expand files or directories that contain ~ (when using tcsh shell)

2009-08-19 Thread gregory hainaut
Package: vim
Version: 2:7.2.245-2
Severity: normal
Tags: patch

--- Please enter the report below this line. ---

Hi,

To reproduce the bug. Just create a directory with a ~ (mkdir
-p /tmp/bad~dir). Then when you do a :chdir /tmp/bad~dir, an error
is raised E79: Cannot expand wildcards. 
As a side effect it is not possible to use a tags file in the bad~dir
or below (/tmp/bad~dir/tags) because it will no be seen by vim.

Note I have not tested all shell but the bug appears with the tsch
shell (and not zsh for example). So you must use this option set
shell=/bin/tcsh\ -f.

Please find attached a patch that seems solve the problem not sure it
is the good solution (and works in all situations). Maybe a solution
will be to escaped ~ like '\~' before sending to the tcsh shell.

Note: Tcsh debian version is 6.14.00-7 

Best Regards,
Gregory


--- System information. ---
Architecture: i386
Kernel:   Linux 2.6.30.3-ghost

Debian Release: squeeze/sid
  500 unstableftp.fr.debian.org 
1 experimentalftp.fr.debian.org 

--- Package information. ---
Depends   (Version) | Installed
===-+-
vim-common(= 2:7.2.245-2)   | 2:7.2.245-2
vim-runtime   (= 2:7.2.245-2)   | 2:7.2.245-2
libacl1   (= 2.2.11-1) | 2.2.47-3
libc6(= 2.3.4) | 2.9-25
libgpm2 (= 1.20.4) | 1.20.4-3.2
libncurses5 (= 5.6+20071006-3) | 5.7+20090803-1+b1
libselinux1 (= 2.0.85) | 2.0.85-1


Package's Recommends field is empty.

Suggests (Version) | Installed
==-+-===
ctags  | 
vim-doc| 
vim-scripts| 20090211-1





--- misc1.c	2009-08-19 12:24:24.0 +0200
+++ vim-7.2.245/src/misc1.c	2009-08-19 12:26:03.0 +0200
@@ -9199,8 +9199,9 @@ gen_expand_wildcards(num_pat, pat, num_f
 	{
 	/*
 	 * First expand environment variables, ~/ and ~user/.
+ * Only expand ~ when it is a first caracter
 	 */
-	if (vim_strpbrk(p, (char_u *)$~) != NULL)
+	if (vim_strpbrk(p, (char_u *)$) != NULL || p[0] == '~')
 	{
 		p = expand_env_save_opt(p, TRUE);
 		if (p == NULL)
@@ -9211,7 +9212,7 @@ gen_expand_wildcards(num_pat, pat, num_f
 		 * variable, use the shell to do that.  Discard previously
 		 * found file names and start all over again.
 		 */
-		else if (vim_strpbrk(p, (char_u *)$~) != NULL)
+		else if (vim_strpbrk(p, (char_u *)$) != NULL || p[0] == '~')
 		{
 		vim_free(p);
 		ga_clear_strings(ga);