lvv / git-prompt

bash prompt with GIT, SVN and HG modules
http://volnitsky.com/project/git-prompt
327 stars 97 forks source link

Syntax error expression in bash-completion repo #12

Closed juanpabloaj closed 12 years ago

juanpabloaj commented 13 years ago

I have cloned the bash-completion repository.

when I move the dir repository I get

 $ cd bash-completion
 bash: eval: line 68: syntax error in conditional expression
 bash: eval: line 68: syntax error near `untracked_files[${#untracked_files[@]}]=""test/"'
 bash: eval: line 68: `          [[ " ${untracked_files[*]} ${modified_files[*]} ${added_files[*]} " =~ " "test/ " ]] || untracked_files[${#untracked_files[@]}]=""test/"'
lvv commented 13 years ago

I assume you meant "when I cd into dir repository". I can not reproduce this. What version of bash and git you are using? (run bash --version, git --version). Do you have this error in other repos with untracked files?

juanpabloaj commented 13 years ago
$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
Copyright (C) 2007 Free Software Foundation, Inc.
$ git --version
 git version 1.7.5

$ git clone git://git.debian.org/git/bash-completion/bash-completion.git
$ cd bash-completion/
-bash: eval: line 65: syntax error in conditional expression
-bash: eval: line 65: syntax error near `untracked_files[${#untracked_files[@]}]=""test/"'
-bash: eval: line 65: `         [[ " ${untracked_files[*]} ${modified_files[*]} ${added_files[*]} " =~ " "test/ " ]] || untracked_files[${#untracked_files[@]}]=""test/"'
juanpabloaj commented 13 years ago

I update bash

 $ bash --version
 GNU bash, versión 4.2.10(2)-release (i386-apple-darwin10.7.0)

And I get the same output

$ cd bash-completion/
-bash: eval: line 65: syntax error in conditional expression
-bash: eval: line 65: syntax error near `untracked_files[${#untracked_files[@]}]=""test/"'
-bash: eval: line 65: `         [[ " ${untracked_files[*]} ${modified_files[*]} ${added_files[*]} " =~ " "test/ " ]] || untracked_files[${#untracked_files[@]}]=""test/"'
lvv commented 13 years ago

I was able to reproduce this error after doing:

mkdir '"test' # note double quote touch '"test/uuu'

Do you have test directory with leading double-quote?

juanpabloaj commented 13 years ago

@lvv see this

  $ git status
  # On branch master
  # Untracked files:
  #   (use "git add <file>..." to include in what will be committed)
  #
  #       "test/fixtures/_filedir/ae\314\201/"

and this

bash-completion/test/fixtures/_filedir$ ls
a b  a"b  a$b  a&b  a'b  ab  ae??  ext
lvv commented 13 years ago

This is real bug. Git-prompt can not handle files with quotes. I'll think how to fix this.

lvv commented 12 years ago

a599ae8 -- fixed: filesnames with spaces, quotes and other special chars