You are not logged in.

#1 2022-06-04 00:13:56

Salkay
Member
Registered: 2014-05-22
Posts: 580

[SOLVED] vimdoc.hook error

I've tried installing a few vim plugins, e.g. vim-ctrlp from the official repos, vim-vimtex, vim-delimitmate-git, vim-csv from the AUR. In all cases, vimdoc.hook produced an error.

$ sudo pacman -S vim-ctrlp
...
:: Processing package changes...
(1/1) installing vim-ctrlp                                                           [################################################] 100%
Optional dependencies for vim-ctrlp
    ctags: for searching tags [installed]
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Updating Vim help tags...
error: command failed to execute correctly

I looked at the hook file at /usr/share/libalpm/hooks/vimdoc.hook, and ran the command manually.

sudo bash -c '/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"'

but this did not produce an error.

EDIT: bug submitted

Last edited by Salkay (2022-07-24 06:05:30)

Offline

#2 2022-06-04 10:24:50

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 10,837
Website

Re: [SOLVED] vimdoc.hook error

Mod note: moving to Pacman/upgrade issues.


Sakura:-
Mobo: MSI MEG B550 UNIFY // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2022-07-23 12:20:45

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

FWIW the bug was closed, since it was unable to be reproduced. I'm still hitting it though, so any input is appreciated.

Offline

#4 2022-07-23 12:57:38

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Maybe use pacman's '--debug' flag and post that output...


Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#5 2022-07-23 13:09:41

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

Thanks @dogknowsnx. Nothing much more I'm afraid. Presumably  --debug wouldn't produce more output from the hooks?

$ sudo pacman --debug -S --asdeps vim-ctrlp
...
:: Running post-transaction hooks...
...
(2/2) Updating Vim help tags...
debug: executing "/usr/bin/vim" under chroot "/"
debug: call to waitpid succeeded
error: command failed to execute correctly
debug: unregistering database 'local'
debug: freeing package cache for repository 'local'
debug: unregistering database 'core'
debug: freeing package cache for repository 'core'
debug: unregistering database 'extra'
debug: freeing package cache for repository 'extra'
debug: unregistering database 'community'
debug: freeing package cache for repository 'community'
debug: unregistering database 'multilib'
$

Offline

#6 2022-07-23 13:17:21

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Try

# pacman -Syu vim-runtime

Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#7 2022-07-23 13:24:15

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

@dogknowsnx did you mean to reinstall vim-runtime? I just tried, but vim-runtime doesn't actually trigger vimdoc.hook. After reinstallation I tried to install vim-ctrlp again, and I hit the same problem.

Offline

#8 2022-07-23 13:45:25

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Yes, because  '/usr/share/libalpm/hooks/vimdoc.hook' is owned by 'vim-runtime'. No idea what the issue might be atm...

Last edited by dogknowsnx (2022-07-23 13:46:51)


Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#9 2022-07-23 14:17:48

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

Thanks for your help anyway. Hopefully someone else has some insight.

Offline

#10 2022-07-23 14:32:20

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Please post the contents of '/usr/share/libalpm/hooks/vimdoc.hook'

cat /usr/share/libalpm/hooks/vimdoc.hook

Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#11 2022-07-23 14:45:37

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

dogknowsnx wrote:

Please post the contents of '/usr/share/libalpm/hooks/vimdoc.hook'

It's totally unmodified. It's identical to upstream.

Last edited by Salkay (2022-07-23 14:46:05)

Offline

#12 2022-07-23 14:48:59

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

I'm asking because you said you tested the hook manually issuing

Exec = /usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"

...

EDIT: The above command should open an interactive vim instance, and '--cmd ":q" would be skipped, hence the error message (when run from a pacman hook, since pacman doesn't get an exit 0 from it)... Maybe the presumably modified old '/usr/share/libalpm/hooks/vimdoc.hook' was still cached during the session where you reinstalled 'vim-runtime' and tried to install 'vim-ctrlp' (EDIT#2: 'sudo' alone would already have caused the hook to fail, anyway...) - do you still get the error after a logout/reboot?

Last edited by dogknowsnx (2022-07-24 07:02:20)


Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#13 2022-07-24 06:05:12

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

Thanks again @dogknowsnx. I appreciate your help, but I'm confused on so many levels.

dogknowsnx wrote:

I'm asking because you said you tested the hook manually issuing

sudo bash -c '/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"'

Yes, that's correct. That's the same command as in the hook.

dogknowsnx wrote:

EDIT: The above command should open an interactive vim instance, and '--cmd ":q" would be skipped,

No, that command does not open up an interactive vim session. Firstly it's silent because of the -s part, but then the :q part quits vim anyway. I can run it manually and confirm that it quits, i.e.

$ sudo vim -es
:helptags /usr/share/vim/vimfiles/doc
:q
$
dogknowsnx wrote:

hence the error message (when run from a pacman hook, since pacman doesn't get an exit 0 from it)...

Ahhh! Yes, this is correct. I'm quite sure my sudo bash -c code is fine, but I do indeed get a non-zero code after running it.

dogknowsnx wrote:

Maybe the presumably modified old '/usr/share/libalpm/hooks/vimdoc.hook'

It was not modified on my system and never was.

dogknowsnx wrote:

was still cached during the session where you reinstalled 'vim-runtime' and tried to install 'vim-ctrlp'

I don't think this makes sense. Hooks are not cached.

dogknowsnx wrote:

(EDIT#2: 'sudo' alone would already have caused the hook to fail, anyway...) - do you still get the error after a logout/reboot?

This doesn't seem to make sense either. I need to run vim with root permissions, otherwise I can't run the command. For example, if I try and run the command with a non-root user.

E152: Cannot open /usr/share/vim/vimfiles/doc/tags for writing

However, you've put me onto the right path with the non-zero exit code. After more investigation, I think I've worked out the issue. Firstly, if I run the vim instance without the silent -s option it is more informative, i.e. sudo vim-e. I then run :helptags /usr/share/vim/vimfiles/doc, and can see the following issue.

::helptags /usr/share/vim/vimfiles/doc
E154: Duplicate tag "lazy" in file /usr/share/vim/vimfiles/doc/diffchar.txt
E154: Duplicate tag "quick" in file /usr/share/vim/vimfiles/doc/diffchar.txt

Looks like it's a bug with the vim-diffchar package, which has now been fixed upstream.

Thanks again for putting me on the right direction.

Offline

#14 2022-07-24 06:52:49

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Thanks for the "feedback". I could only make assumptions based on the scarce debug output, your false claims and your not disclosing all aur vim packages that you've installed.

You prepended 'sudo (bash -c)' to the command from the hook when testing it - the command actually doesn't need root on a regular arch system (also see the upstream link you posted). To be clear, this is the exec array from the hook:

/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"

which is not the same as

sudo bash -c '/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"'

that you claim is the command from the hook...

Anyway. it doesn't matter since 'vim-diffchar' is an aur package (hence not part of a regular arch system)...

Last edited by dogknowsnx (2022-07-24 08:20:11)


Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#15 2022-07-24 08:28:51

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

Sorry, I don't mean to offend you, and I hope it wasn't taken as such. I'm not sure which claims were false. I also disclosed none of my vim packages at all!

dogknowsnx wrote:

You prepended 'sudo (bash -c)' to the command from the hook when testing it - the command actually doesn't need root on a regular arch system (also see the upstream link you posted). To be clear, this is the exec array from the hook:

/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"

which is not the same as

sudo bash -c '/usr/bin/vim -es --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q"'

that you claim is the command from the hook...

My understanding (and again I could be wrong) is that pacman hooks are essentially run as a root user. Hence, if I were to run the first command as a non-root user it would be different from running is from the hook. Which is indeed what I saw with it causing permission errors.

Anyway apologies again if I have offended. Thank you again for your help.

Offline

#16 2022-07-24 08:44:13

dogknowsnx
Member
Registered: 2021-04-12
Posts: 335

Re: [SOLVED] vimdoc.hook error

Afaiu executing a root command from a hook is like executing it from inside a script, and one would need to provide credentials for it, which coincides with a modified hook I just tested.

Anyway, glad you were able to figure it out - no hard feelings, have a nice day.


Wayland.

"We are eternal, all this pain is an illusion" - Maynard James Keenan

Offline

#17 2022-07-24 09:21:02

Salkay
Member
Registered: 2014-05-22
Posts: 580

Re: [SOLVED] vimdoc.hook error

dogknowsnx wrote:

Anyway, glad you were able to figure it out - no hard feelings, have a nice day.

You too! Honestly, I wouldn't have worked it out without your help, so I'm sincerely sorry if it came across the wrong way. Thank you again.

Offline

Board footer

Powered by FluxBB