Bug 252421 - devel/arcanist: Request to include Bash completion files in the default package
Summary: devel/arcanist: Request to include Bash completion files in the default package
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Michael Gmelin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-04 21:22 UTC by Mateusz Piotrowski
Modified: 2021-01-15 11:23 UTC (History)
0 users

See Also:
grembo: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mateusz Piotrowski freebsd_committer 2021-01-04 21:22:19 UTC

    
Comment 1 Michael Gmelin freebsd_committer 2021-01-06 12:46:27 UTC
Hi 0mp,

There's no patch attached I could approve, so I'm not 100% sure what you want to change.

Bash completions are installed by the package (devel/arcanist-lib) and located in /usr/local/lib/php/arcanist/resources/shell/bash-completion.

So entering (or adding to your ~/.profile) this

  source /usr/local/lib/php/arcanist/resources/shell/bash-completion

should do the trick.

So are you requesting that the devel/arcanist package to add a symlink like the one below automatically?

  ln -s ../../lib/php/arcanist/resources/shell/bash-completion \
    /usr/local/etc/bash_completion.d/arcanist

(devel/git has an example for this)

Shouldn't be hard to do and I could do this myself of course.
Comment 2 Michael Gmelin freebsd_committer 2021-01-09 14:42:32 UTC
(In reply to Mateusz Piotrowski from comment #0)

Note that the port already links bash completions in /usr/local/share/bash-completion/completions/arc, is this sufficient for your needs, or would you also like it to be linked in /usr/local/etc/bash_completion.d?

Actually, you were the one adding this feature in back in 2018:

https://svnweb.freebsd.org/ports?view=revision&revision=474969

Enable Bash completion.

Arcanist is shipped with a Bash completion script. The script isn't installed
in the directories of the bash-completion library so it's never activated.

This patch creates a symbolic link to the script in the directories of the
bash-completion library so that the library is able to pick up the completion
script for arc when a user requests a command completion for the first time.

Reviewed by:	grembo (maintainer), mat (mentor)
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16345
Comment 3 Mateusz Piotrowski freebsd_committer 2021-01-12 12:31:52 UTC
(In reply to Michael Gmelin from comment #2)

Hi, sorry for not replying earlier.

The problem with the current status of the arc bash completion is that it does not actually work.

If you take a look at /usr/local/share/bash-completion/completions/arc, you'll see that it is just a shell script which tries to generate the bash completion file dynamically. It failes because it tries to paths owned by root. In fact, if you try to execute is directly, you'll see the error message:

```
$ bash /usr/local/share/bash-completion/completions/arc
/usr/local/share/bash-completion/completions/arc: line 11: /usr/local/lib/php/arcanist/support/shell/rules/bash-rules.sh: No such file or directory
```

I think that a solution to this problem would be to generate the actual bash completion file during build.

I can try to write a patch for that, but first I'd like to know if it makes any sense. Sorry for not providing all the details earlier.
Comment 4 Michael Gmelin freebsd_committer 2021-01-12 18:50:47 UTC
(In reply to Mateusz Piotrowski from comment #3)

Ah, I actually remember fixing this script a while ago in https://svnweb.freebsd.org/ports?view=revision&revision=535310

but I didn't test it with an unprivileged user (which of course makes it fail due to missing write permissions).

Running it once as root fixes the issue of course, which is something that could be covered by pkg-message. I'm following your proposed solution though and will implement a fix shortly.

Maybe you could give it a shot once committed (I tested it locally already, just to make sure it really scratches your itch).
Comment 5 commit-hook freebsd_committer 2021-01-12 19:10:03 UTC
A commit references this bug:

Author: grembo
Date: Tue Jan 12 19:09:04 UTC 2021
New revision: 561370
URL: https://svnweb.freebsd.org/changeset/ports/561370

Log:
  Generate bash completion rules on install.

  So it won't have to be done by root manually/implicitly.

  PR:		252421
  Reported by:	0mp

Changes:
  head/devel/arcanist-lib/Makefile
  head/devel/arcanist-lib/pkg-plist
Comment 6 Michael Gmelin freebsd_committer 2021-01-13 21:10:45 UTC
Closing this, please let me know in case the fix doesn't work for you.
Comment 7 Mateusz Piotrowski freebsd_committer 2021-01-15 11:23:01 UTC
Thanks a lot, I've just installed the lastest port and it works like a charm.