On 10/15/11 2:05 AM, lolilolicon wrote: > (Sorry, forgot to CC the ML.) > > On Sat, Oct 15, 2011 at 1:30 AM, Chet Ramey <chet.ra...@case.edu> wrote: >> Thanks for the report. This looks like a problem, or an omission, with >> the effects of the `-f' option to complete, since it works as expected >> without using programmable completion or when using `-o default'. I >> will take a look. >> > > Yes, with `shopt -u progcomp' it does work as expected, unsurprisingly; > otherwise, `complete -o default ls' works, but `complete -o default -f ls' > doesn't.
Yes. The reason that an extra set of backslashes is necessary is unsurprising: because the filename is dequoted twice. Once in the programmable completion filename completion function, and once by readline's filename completion function (which the progcomp function calls). This is the bug. The programmable completion code's filename completion should simply leave the dequoting to readline, as the default completion does. > Also, I noticed the _quote_readline_by_ref() function in bash_completion[1], > which I believe deals with this sort of problems. It's really ugly IMHO, > and probably prompts for some change in bash's behavior. Maybe. Readline's completion has changed through the years, especially in the area of filename dequoting and quoting, which I'm sure accounts for some of the complexity. If someone could come up with a concrete proposal for changes, I'd be glad to discuss it. > <rant> > I really don't want to use bash_completion. For most part, what I really > need is to complete and filter filenames according to the calling command, > e.g. directories for `cd', media files for `mplayer'. I'd like to write > simple `complete' rules for these in simple bash, not having to load a host > of hacks for it to actually work. Sounds reasonable? > </rant> I'm a Unix guy from way back, and my philosphy is traditional: easy things should be easy, and hard things should be possible. I think the current bash programmable completion framework provides that. If we could have a little less ranting and a little more discussion about what needs to change to improve the current system, we'd all be better off. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/