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

bash completion bug #1066

Closed
jfoug opened this issue Mar 2, 2015 · 11 comments
Closed

bash completion bug #1066

jfoug opened this issue Mar 2, 2015 · 11 comments
Labels
invalid Issue created in error, misunderstanding, etc.

Comments

@jfoug
Copy link
Collaborator

jfoug commented Mar 2, 2015

When I start my bash shell, I get this:

bash: /JtR/bleed/run/john.bash_completion: line 565: syntax error near unexpected token `('
bash: /JtR/bleed/run/john.bash_completion: line 565: `      --show=?([Ll]|[Ll][Ee]|[Ll][Ee][Ff]|[Ll][Ee][Ff][Tt]))'

ubuntu-64 in a VM. To install jtr bash completion, I simply added . /JtR/bleed/run/john.bash_completion to my ~/.bashrc file

@frank-dittrich
Copy link
Collaborator

What does shopt -p extglob print on your ubuntu system?
On my fedora 20 system I get

(bleeding-jumbo)run $ shopt -p extglob
shopt -s extglob

If you get shopt -u extglob instead, you need to enable extended pattern matching features by running shopt -s extglob before you source john.bash_completion.

@frank-dittrich
Copy link
Collaborator

See also section "Prerequisites" of doc/README.bash-completion:

        Prerequisites

The bash completion for john requires bash version >= 4,
and extended pattern matching features enabled.
If the command
        shopt -p extglob
prints
        shopt -s extglob
then the extended pattern matching features are enabled.
If this command
prints
        shopt -u extglob
then they are disabled.

@frank-dittrich
Copy link
Collaborator

May be I should add a comment similar to the one in john.bash_completion's lines 12-20 closer to the source code lines which cause the problems when extended pattern matching is disabled, i.e., line 565.

@jfoug
Copy link
Collaborator Author

jfoug commented Mar 3, 2015

Extended patterns are turned on, AND I am running 4.3.11(1) bash (with the recent patches).

$ shopt -p extglob
shopt -s extglob


$ bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

@frank-dittrich
Copy link
Collaborator

The only explanation is that shopt -s extglob is processed after you sourced john.bash_completion.
Can you put the line

shopt -p extglob

immediately before

. /your_path/john.bash_completion

into your ~/.bashrc file?

I have

shopt -u extglob
shopt -p extglob
. /home/fd/git/JtR/run/john.bash_completion

in my ~/.bashrc now, and I get

[fd@f20xs ~]$ bash
shopt -u extglob
bash: /home/fd/git/JtR/run/john.bash_completion: line 565: syntax error near unexpected token `('
bash: /home/fd/git/JtR/run/john.bash_completion: line 565: `        --show=?([Ll]|[Ll][Ee]|[Ll][Ee][Ff]|[Ll][Ee][Ff][Tt]))'

when I start a new shell or xterm.

@frank-dittrich
Copy link
Collaborator

I just tested this with ubuntu 14.10.

Adding

. /home/fd/git/JtR/run/john.bash_completion

at the end of my /home/fd/.bashrc file works for me.
After opening a new terminal, bash completion just works for john.

@magnumripper
Copy link
Member

I get a very similar error on Super. It has bash 4.1.2

$ shopt -p extglob
shopt -p extglob
shopt -u extglob
printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"

@magnumripper
Copy link
Member

I tried enbling extglob on Super and then source JtR bash completion.

$ ../run/john --t<TAB>bash: _get_comp_words_by_ref: command not found

@frank-dittrich
Copy link
Collaborator

looks like bash completion is not installed on super.
Neither /etc/bash_completion nor /usr/share/bash-completion/bash_completion exist.

@frank-dittrich
Copy link
Collaborator

On well it should work.

@jfoug jfoug added the invalid Issue created in error, misunderstanding, etc. label Mar 3, 2015
@jfoug
Copy link
Collaborator Author

jfoug commented Mar 3, 2015

I put the load line at the bottom of the .bashrc and it is working fine. Gonna mark this as PEBCAK and close it.

@jfoug jfoug closed this as completed Mar 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid Issue created in error, misunderstanding, etc.
Projects
None yet
Development

No branches or pull requests

3 participants