[Bash-completion-devel] _expand, scp and quoting

Ville Skyttä ville.skytta at iki.fi
Thu Jan 29 19:00:24 UTC 2009


On Wednesday 28 January 2009, David Paleino wrote:
> On Sat, 24 Jan 2009 21:52:45 +0200, Ville Skyttä wrote:
>
> > I don't think the above change is actually wrong but it has broken at
> > least "scp ~/<TAB>" completion.  This is because the "ls" in _scp ends up
> > being run as
> >
> >     ls -aF1d '~/*' 2>/dev/null
> >
> > ...and obviously ls '~/*' practically never matches anything because of
> > the single quotes bash inserted.  Before the above change there were no
> > quoting problems because ~ was expanded to /home/foo which bash didn't
> > need to enclose in single quotes.  We'd want the ls to be run without the
> > quotes, like
> >
> >     ls -aF1d ~/* 2>/dev/null
> >
> > ...but I don't know how to get bash to do that.  Ideas?
>
> Line 84, contrib/ssh -- but I suppose you already know that.

Yes, that's one of the many things I've tried, to no avail.  This is on Fedora 
9, bash 3.2.33(1)-release

> > On the other hand, I wonder what's the point of the ls -aF1d and sed
> > spaghetti when completing _local_ files for scp in the first place. 
> > Wouldn't _filedir do just fine?
>
> Yes, or at least I believe so. I'd wait for others to comment on this as
> well.

Will wait a bit more, but my patience is getting thinner and thinner every 
time I hit this issue ;)

> The fact is (I can't remember it right now, studying for exams and 
> can't recall if it's doable or not -- and that's why I can't decipher what
> that sed hack is doing either): can we reliably find whether it's a local
> path?

Do we need to?  Line 69 already checks for ":" in the argument and goes remote 
if found.



More information about the Bash-completion-devel mailing list