From: Jeff King Date: Fri, 28 Sep 2012 15:46:16 GMT Subject: Re: [POC PATCH 5/5] completion: avoid compgen to fix expansion issues in __gitcomp_nl() Message-ID: <20120928154615.GA24933@sigill.intra.peff.net> In-Reply-To: <20120928150852.GA13081@goldbirke> On Fri, Sep 28, 2012 at 05:08:52PM +0200, SZEDER Gábor wrote: > On Fri, Sep 28, 2012 at 12:09:35PM +0200, SZEDER Gábor wrote: > > __gitcomp_nl () > > { > > local IFS=$'\n' > > - COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}")) > > + COMPREPLY=($(echo "$1" |sed -n "/^${3-$cur}/ { > > $cur can be a path, so it can contain /, which then breaks this sed > expression. Here's a fixup: Worse than that, can't $cur contain arbitrary regex characters that will be interpreted by sed? -Peff