Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 6 Sep 2012 21:21:58 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: bash completion on OSX

On 09/06/2012 09:35 AM, magnum wrote:
> On 6 Sep, 2012, at 7:50 , Frank Dittrich <frank_dittrich@...mail.com> wrote:
>> Can you test if bash's syntax check complains about
>> --restore|--status)
>> as well (if you comment out or delete the
>> -?(-)f?(o|or|orm|orma|ormat)+(=|:)*)
>> and subsequent lines?
> 
> bash: _get_comp_words_by_ref: command not found

_get_comp_words_by_ref should be defined in /etc/bash_completion.
Since this error disappeared when you installed bash completion for git,
I'll currently not spend time investigating this problem any further.

> sed: 1: "{ s#^ *\(--[a-z-]*=\?\( ...": bad flag in substitute command: '}'
> 
> This error is run-time (happens when I press TAB). Actually, I now enabled git completion which apparently in turn enables globbing. After that, sourcing the pristine john completion file works fine, but I now get a similar run-time error:
> 
> bash-4.2$ ../run/john[TAB] sed: 1: "{ s#^ *\(--[a-z-]*=\?\( ...": bad flag in substitute command: '}'


Google apparently provided the answer:
"OS X sed doesn't like multiple commands run together using semicolons
or grouped in curly braces"
and
"If you have a sed script that consists of multiple commands, you'll
have to break them up using -e"

I have two sed commands in the bash completion script which use '{'.
One in line 139, one in line 183.
Even if I s/sed -n/sed --posix -n/ in both of these lines, bash
completion still works for me.

If OSX has a problem here, that suggests the sed command  implementaion
used for OSX is not POSIX compatible, or GNU sed has a bug (not
disabling all GNU extensions when using sed --posix).

For the first of the two sed commands mentioned above, I can easily get
rid of { and }.

To get rid of the ';', I had to split the sed scripts into several
scripts per command.

I tested my changes with and without defining
alias sed='sed --posix'

So the attached patch should work. (I also improved the grammar of the
comment regarding extended pattern matching.)
I tested it on top of

commit 745a66151edffb9e6f745d6a6cc1546ae2e236ed
Author: magnum <john.magnum@...hmail.com>
Date:   Wed Aug 22 07:30:29 2012 +0200

    RAR: fix a compiler warning on 32-bit

This is the latest 1.7.9-jumbo-6-fixes commit I have on my 32bit linux
netbook, but I guess bash completion hasn't much changed since then.


Because I didn't intend to do any john related work while on vacation,
my public git repo is also way behind the official repo, and I don't
want to spend more time on this than necessary.
That's why, currently, I don't want to send a pull request.

Please test and apply the attached patch if it works for you as well.

Frank

View attachment "0001-Make-bash-completion-work-for-OS-X.patch" of type "text/x-patch" (1838 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.