Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16895
| X-Received | by 2002:a05:620a:2603:b0:72e:f333:8cc8 with SMTP id z3-20020a05620a260300b0072ef3338cc8mr160996qko.10.1676485540294; Wed, 15 Feb 2023 10:25:40 -0800 (PST) |
|---|---|
| X-Received | by 2002:a05:6870:6487:b0:16a:acc6:ccf6 with SMTP id cz7-20020a056870648700b0016aacc6ccf6mr466013oab.282.1676485539886; Wed, 15 Feb 2023 10:25:39 -0800 (PST) |
| Path | csiph.com!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail |
| Newsgroups | gnu.bash.bug |
| Date | Wed, 15 Feb 2023 10:25:39 -0800 (PST) |
| In-Reply-To | <30605fd8-1b9c-4071-a08f-fdd64257d26dn@googlegroups.com> |
| Injection-Info | google-groups.googlegroups.com; posting-host=5.182.110.182; posting-account=1QxalAoAAADvCk-YgIWuWGP1Fl6szJEU |
| NNTP-Posting-Host | 5.182.110.182 |
| References | <30605fd8-1b9c-4071-a08f-fdd64257d26dn@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <a728d774-a0f2-4517-9fa9-eeeaaf7f68efn@googlegroups.com> (permalink) |
| Subject | Re: Bash completion fails if command results from alias expansion |
| From | GODSWILL DUKE <dukegodswill2022@gmail.com> |
| Injection-Date | Wed, 15 Feb 2023 18:25:40 +0000 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | quoted-printable |
| X-Received-Bytes | 4000 |
| Xref | csiph.com gnu.bash.bug:16895 |
Show key headers only | View raw
On Tuesday, June 14, 2022 at 3:22:59 AM UTC-7, Tasos Papastylianou wrote:
> Dear bash maintainers.
>
> I posted this at the SuperUser stackexchange forum (here: https://superuser.com/q/1725872/717607), so please see that post too if you like (especially if it generates separate conversaion, which it has not so far) but I thought I might as well ask straight from the horses mouth and submit this as a bug after all.
>
> There are several posts online (e.g. https://superuser.com/q/436314/717607) suggesting workarounds for bash completing aliases whose commands have established completions defined.
>
> However, in the bash manual (i.e. man bash, currently using GNU bash, version 5.0.17), section Programmable Completion, it states that:
>
> > If there is no default compspec, bash attempts alias expansion on the command word as a final resort, and attempts to find a compspec for the command word from any successful expansion.
>
> In other words one would have expected this to work:
>
> function foobar () { echo "Hello from foobar"; }
> function _foobar () { COMPREPLY=( foo bar baz ); } && complete -F _foobar foobar
> alias foo='foobar'
>
> Typing `foobar[TAB][TAB]` autocompletes as expected.
>
> However, typing `foo[TAB][TAB]` does not work, and shows a default completion instead.
>
> Given the linked posts suggesting workarounds, I don't think it's just me doing something wrong here. But then what does the quote from the bash manual actually refer to then? Am I misunderstanding the quote from the manual? Or is bash simply not doing what is says it should have been doing here? (i.e. is this simply a bug?)
>
> I note a nearly identical question was asked in the bash bug tracker back in 2011 (with yet another nice workaround: https://groups.google.com/g/gnu.bash.bug/c/gENuqpAUTUg/m/JpHbe7KmpGgJ), but the phrasing of that question implies that this was not mentioned in the manual back then, and I haven't seen any sign of addressing this issue on the official group page since.
>
> Also, I've checked the changelogs up to the latest version of Bash, as announced here, but it doesn't seem to me this has been addressed.
>
> I don't know if "completion of alias expanded commands" is a good idea or not, that's a matter for debate among the maintainers (I'm of a split mind myself!); but if it *is* intended behaviour, then I'm reporting it as a bug, since it doesn't actually work as documented; and if it is not desired behaviour, then perhaps that statement about completion of alias-expanded commands should be removed from the bash man page.
>
> Best,
> Tasos
hello
Back to gnu.bash.bug | Previous | Next — Previous in thread | Find similar
Bash completion fails if command results from alias expansion Tasos Papastylianou <tpapastylianou@gmail.com> - 2022-06-14 03:22 -0700 Re: Bash completion fails if command results from alias expansion GODSWILL DUKE <dukegodswill2022@gmail.com> - 2023-02-15 10:25 -0800
csiph-web