Date: Wed, 23 May 2012 02:06:17 +0200 From: Frank Dittrich <frank_dittrich@...mail.com> To: john-dev@...ts.openwall.com Subject: Re: Fwd: bash auto-completion for john On 05/23/2012 01:16 AM, Solar Designer wrote: > I think that you should not actually invoke =LIST to determine possible > completions because they're almost always single-digit anyway and > because the list might not appear instantly. > > $ time ./john -pla=list &> /dev/null > > real 0m1.511s > user 0m0.124s > sys 0m0.964s Thanks for pointing that out. I didn't know this would take so long. I occasionally measured run time for the completion on my atom netbook (by renaming _john to __john and adding a new _john with just one statement: time __john), and I always detected run times of less than 0.2 seconds, even for the most complex logic. That's why I guessed it is not worth the effort trying to compute some intermediate results just once and buffering them in variables __john_*. The bash completion script for git does this. But if I do it, I'll probably providing wrong completions if a user switches between a locally installed jumbo version of john and a system-wide official john version and tries using bash completion for both in the same session. Not sure if this ever happens and should be supported. I guess (but didn't try it) if I try completion for different git versions in the same session, I also might getting some invalid completions. I removed the logic to try finding completions using --platform=LIST. Instead, I just list --platform=N --platform=LIST as possible completions for --platform= (only if --platform= is a valid option according to the usage output) and --device=N --device=LIST as possible completions for for --device= I should suppress this for CUDA builds, as CUDA doesn't support --device=LIST. Currently, I don't check whether it is a CUDA build, since I don't know what --list=build-info shows in this case. Instead, I use a workaround (check whether --platform= is a valid option). Frank View attachment "john.bash_completion" of type "text/plain" (18291 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.