Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctags_recursive.options permissions #321

Open
folofjc opened this issue Apr 28, 2022 · 6 comments
Open

ctags_recursive.options permissions #321

folofjc opened this issue Apr 28, 2022 · 6 comments

Comments

@folofjc
Copy link

folofjc commented Apr 28, 2022

Describe the bug
Clean install. When opening any file, ctags throws an error

Steps to reproduce

  1. Install vim-gutentags by cloning
  2. Open an file
  3. Get error

Share your setup

  • What OS and version of Vim are you using?
    • Ubuntu 22.04 LTS
vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Apr 25 2022 10:58:14)
Included patches: 1-4822
Compiled by pgesting@PGGC-22
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tag_any_white
+arabic            +find_in_path      +mouse_xterm       -tcl
+autocmd           +float             +multi_byte        +termguicolors
+autochdir         +folding           +multi_lang        +terminal
-autoservername    -footer            -mzscheme          +terminfo
+balloon_eval      +fork()            +netbeans_intg     +termresponse
+balloon_eval_term +gettext           +num64             +textobjects
+browse            -hangul_input      +packages          +textprop
++builtin_terms    +iconv             +path_extra        +timers
+byte_offset       +insert_expand     +perl              +title
+channel           +ipv6              +persistent_undo   +toolbar
+cindent           +job               +popupwin          +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +vim9script
+cmdline_hist      +langmap           -python            +viminfo
+cmdline_info      +libcall           +python3           +virtualedit
+comments          +linebreak         +quickfix          +visual
+conceal           +lispindent        +reltime           +visualextra
+cryptv            +listcmds          +rightleft         +vreplace
+cscope            +localmap          +ruby              +wildignore
+cursorbind        +lua               +scrollbind        +wildmenu
+cursorshape       +menu              +signs             +windows
+dialog_con_gui    +mksession         +smartindent       +writebackup
+diff              +modify_fname      -sodium            +X11
+digraphs          +mouse             -sound             -xfontset
+dnd               +mouseshape        +spell             +xim
-ebcdic            +mouse_dec         +startuptime       +xpm
+emacs_tags        -mouse_gpm         +statusline        +xsmp_interact
+eval              -mouse_jsbterm     -sun_workshop      +xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
-farsi             -mouse_sysmouse    -tag_old_static    
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
 f-b for $VIMRUNTIME: "/usr/local/share/vim/vim82"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/x86_64-linux-gnu -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lfontconfig -lfreetype -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lselinux -L/usr/lib -llua5.2 -Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.34/CORE -lperl -ldl -lm -lpthread -lcrypt -L/home/pgesting/.pyenv/versions/3.10.4/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm -lruby-3.0 -lm -L/usr/lib 
  • What version of ctags, gtags, or whatever do you have installed?
    ctags --version
Universal Ctags 5.9.0(p5.9.20220320.0), Copyright (C) 2015-2022 Universal Ctags Team
Universal Ctags is derived from Exuberant Ctags.
Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert
  Compiled: Mar 22 2022, 17:22:27
  URL: https://ctags.io/
  Optional compiled features: +wildcards, +regex, +gnulib_regex, +iconv, +option-directory, +xpath, +json, +interactive, +yaml, +packcc, +optscript
  • Are you using g:gutentags_cache_dir? Not that I know of

Post the logs

  • Run :let g:gutentags_trace = 1.
  • Reproduce the bug.
  • Run :messages and show the messages that Gutentags posted.
gutentags: Wildignore options file is up to date.
gutentags: Running: ['/home/pgesting/.vim/bundle/vim-gutentags/plat/unix/update_tags.sh', '-e', 'ctags', '-t', 'tags', '-p', '
.', '-o', '/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options', '-l', 'tags.log']
gutentags: In:      /home/pgesting/Documents/git/SBTS
gutentags: [job stdout]: 'Locking tags file...'
gutentags: [job stdout]: 'Running ctags on whole project'
gutentags: [job stdout]: 'ctags -f "tags.temp" "--options=/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options
"  "."'
gutentags: [job stderr]: 'ctags: cannot open option file "/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options
" : Permission denied'
gutentags: Finished ctags job.
gutentags: ctags job failed, returned: 1
  • Look for the tags.log file that Gutentags' script left behind, and post its contents.

Additional context
if I try to run the command myself I get the same error from the command line:

>ctags -f "tags.temp" "--options=/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options"
ctags: cannot open option file "/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options" : Permission denied
>ls -la /home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options 
-rw-rw-r-- 1 pgesting pgesting 15 Apr 25 13:02 /home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options

As you can see, the permissions on this file are 664 so anything should be able to read it

@ludovicchabant
Copy link
Owner

ludovicchabant commented May 11, 2022

Looks somehow the process running Vim doesn't have permissions to read one of the files inside the gutentags plugin (/home/pgesting/.vim/bundle/vim-gutentags/res/ctags_recursive.options), which is weird. Can you check the permissions?

Also, is that newline after the path in the logs, or is that caused by copy/pasting here in Github? I can't see how the code could ever add a newline there.

@folofjc
Copy link
Author

folofjc commented May 12, 2022

Hi @ludovicchabant The last thing I put in the "Additional Context" shows the permissions on that file, because I knew that would be important. As you can see, the persmissions are 664.

I am not sure which newline you are talking about, but it is probably a copy paste issue.

@ludovicchabant
Copy link
Owner

Right, I missed it, thanks. I have no idea why it can't read a 664 file... are you running that command as the pgesting user, or as a different user? Does setting the file to 666 fix anything?

@folofjc
Copy link
Author

folofjc commented May 13, 2022

So, I am opening vim as pgesting, and when I ran the commands myself in the commandline I am running as pgesting. Is there anyway that when the guten-tags runs the command it would be as a different user? I don't know how the plugins work that well.

@mpkopec
Copy link

mpkopec commented Sep 13, 2023

Maybe not relevant, but I get the same error, when using NeoVim as an appimage, which is sandboxed and I suspect the sandboxing to be an issue. I will try a deb install and post my findings here.

@mpkopec
Copy link

mpkopec commented Sep 13, 2023

Ok, it seems that I resolved this issue on my machine. I have done the following:

  1. removed the NeoVim installed as an AppImage and reinstalled it as per this instruction (have not helped);
  2. removed universal-ctags installed as a snap and installed it from source.

In the end the update_tags script succeeded and I suspect the snap's sandboxing mechanism of messing with reading external files from the general filesystem, but since I did touch 2 things I cannot be 100% certain which of the steps helped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants