Mc: Problem with --autocompletion

Created on 29 May 2020  ·  7Comments  ·  Source: minio/mc

Expected behavior

I am trying to install the autocompletion for the nixos package
https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/networking/minio-client/default.nix
I would like the client to let me specify where to write (or just dump to stdout) the autocompletion script.

Actual behavior

mc tries to write to my .bashrc that is readonly (it's generated by nix and put readonly specifically to prevent anyone tampering with it). I've tried setting HOME / USER / SHELLRC to different values but mc --autocompletion always tries to write at /home/teto

 mc --autocompletion
mc: <ERROR> Unable to install auto-completion. 1 error occurred:
    * open /home/teto/.bashrc: permission denied.

Steps to reproduce the behavior

set your ~/.bashrc readonly and run mc --autocompletion

mc --version

  • (paste output of mc --version)
mc --version
mc version DEVELOPMENT.GOGET

System information

nixos-unstable (www.nixos.org)

community wontfix working as intended

Most helpful comment

Of course I want autocompletion otherwise I wouldn't have opened this issue. Most programs just provide autocompletion files and then they get loaded. The problem here is that mc insists on writing in a specific location that is not available in my case and ignores basic environment variables like $HOME.

Unfortunately its not an mc issue @teto its the library issue which doesn't provide a way to override the HOME dir.

You can manually add autocompletion by just making an entry in .bashrc wherever it might be located

complete -C /home/harsha/mygo/bin/mc mc

Most programs just provide autocompletion files and then they get loaded.

This is a terrible approach by those programs we don't expect you to install new things,
supporting HOME dir shouldn't be a big problem for the upstream library and we may
even take the onus to fix it.

All 7 comments

@teto,

There is no way to specify the path and this restriction comes from the package, github.com/posener/complete/cmd/install.

So, marking this issue as working as intended and won't fix, hence will be closing it.
Please reopen if you disagree.

I disagree, I find it quite unusual for a package to directly edit the bashrc file. A simple workaround like overriding HOME should be enough but for some reason it was not picked up. I wont reopen though. thanks

I disagree, I find it quite unusual for a package to directly edit the bashrc file. A simple workaround like overriding HOME should be enough but for some reason it was not picked up. I wont reopen though. thanks

That is why it is a flag, clearly indicates what it is going to do, if you don't want it don't use it - autocompletion is not forced.

Of course I want autocompletion otherwise I wouldn't have opened this issue. Most programs just provide autocompletion files and then they get loaded. The problem here is that mc insists on writing in a specific location that is not available in my case and ignores basic environment variables like $HOME.

Of course I want autocompletion otherwise I wouldn't have opened this issue. Most programs just provide autocompletion files and then they get loaded. The problem here is that mc insists on writing in a specific location that is not available in my case and ignores basic environment variables like $HOME.

Unfortunately its not an mc issue @teto its the library issue which doesn't provide a way to override the HOME dir.

You can manually add autocompletion by just making an entry in .bashrc wherever it might be located

complete -C /home/harsha/mygo/bin/mc mc

Most programs just provide autocompletion files and then they get loaded.

This is a terrible approach by those programs we don't expect you to install new things,
supporting HOME dir shouldn't be a big problem for the upstream library and we may
even take the onus to fix it.

thanks the latter complete -C /home/harsha/mygo/bin/mc mc worked !

hum I've added complete -C /nix/store/vq08bmq7j36vsf98bwniiwf61753rcpm-mc-4.8.25/bin/mc mc to my ~/.bashrc but now upon pressing TAB, I get Inappropriate ioctl for device (25), not sure what changed in between.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ramosisw picture ramosisw  ·  4Comments

philipkozeny picture philipkozeny  ·  9Comments

z0rc picture z0rc  ·  7Comments

TJC picture TJC  ·  10Comments

lavvy picture lavvy  ·  15Comments