Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzr: "number expected" #301

Closed
aboettger opened this issue May 26, 2014 · 8 comments
Closed

bzr: "number expected" #301

aboettger opened this issue May 26, 2014 · 8 comments
Labels
bazaar Related to Bazaar or Breezy VCS data bug

Comments

@aboettger
Copy link

terminal shows this

_lp_bzr_branch_color:15: number expected

in a bzr folder

@dolmen
Copy link
Collaborator

dolmen commented May 30, 2014

Which branch do you use? master? develop?
Which shell do you use? bash? zsh?

@aboettger
Copy link
Author

shell: zsh
branch: master

@chase
Copy link
Contributor

chase commented Jun 2, 2014

I can't say zsh gives the most descriptive errors, but this is caused by line 1066 of liquidprompt, line 15 of _lp_bzr_branch_color.

This is valid in bash, but not zsh, for two reasons:

  1. Arrays cannot be directly assigned in a local. zsh interprets parenthesis on a local assign as a glob.
  2. Words are not split as arrays in zsh unless the option sh_word_split is set.

Here is a quick patch that I made:

diff --git a/liquidprompt b/liquidprompt
index e914b49..63952b3 100755
--- a/liquidprompt
+++ b/liquidprompt
@@ -1063,7 +1063,10 @@ _lp_bzr_branch_color()
     local output
     output="$(bzr version-info --check-clean --custom --template='{branch_nick} {revno} {clean}' 2> /dev/null)"
     [[ $? -ne 0 ]] && return
-    local tuple=($output)
+    $_LP_SHELL_zsh && setopt local_options && setopt sh_word_split
+    local tuple
+    tuple=($output)
+    $_LP_SHELL_zsh && unsetopt sh_word_split
     local branch=${tuple[_LP_FIRST_INDEX+0]}
     local revno=${tuple[_LP_FIRST_INDEX+1]}
     local clean=${tuple[_LP_FIRST_INDEX+2]}

I'm not 100% sure that is valid bash, but it certainly is valid (albeit ugly) zsh.

@dolmen
Copy link
Collaborator

dolmen commented Jun 2, 2014

Please try the develop branch: it got a few bazar related changes (see #227) (and many other fixes in general), and report if the issue still occurs.

@dolmen dolmen added the Bazar label Jun 2, 2014
@chase
Copy link
Contributor

chase commented Jun 2, 2014

@dolmen, the development branch doesn't address the issue. It still has the guilty line.

@aboettger
Copy link
Author

bildschirmfoto von 2014-06-03 11 16 58

@aboettger
Copy link
Author

chase, your patch works for me:

    $_LP_SHELL_zsh && setopt local_options && setopt sh_word_split
    local tuple
    tuple=($output)
    $_LP_SHELL_zsh && unsetopt sh_word_split

dolmen pushed a commit that referenced this issue Jun 28, 2014
Fixes #301 without affecting bash functionality
@dolmen
Copy link
Collaborator

dolmen commented Jun 28, 2014

Fixed by @chase in 89a71c1

@dolmen dolmen closed this as completed Jun 28, 2014
@dolmen dolmen added the bug label Jun 30, 2014
@dolmen dolmen changed the title bzr support bzr: "number expected" Jun 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazaar Related to Bazaar or Breezy VCS data bug
Projects
None yet
Development

No branches or pull requests

3 participants