E563 when trying to add cscope database

793 views
Skip to first unread message

Ben Fritz

unread,
Sep 16, 2009, 12:03:32 AM9/16/09
to vim_use, sergey...@gmail.com
I'm running gvim 7.2.245 on Windows XP (the "cream" build).

I was recently assigned a new project at work and decided to give
cscope a try to more readily find my way around the new code base.

I downloaded the latest cscope native Windws build from the google
code page that has replaced (and is linked from) http://iamphet.nm.ru/cscope/index.html
(mentioned in :help cscope near the bottom).

From the cmd.exe prompt, I can successfully navigate the code using:

cscope.exe -f C:/Temp/projname.cscope.out -i C:/Temp/
projname.cscope.files

But when I then try to use it within Vim with the following command:

cscope add C:/Temp/projname.cscope.out -i C:/Temp/
projname.cscope.files

I get:

E563: stat(C:/Temp/projname.cscope.out) error: 2

and no cscope connection is made.

C:/Temp/projname.cscope.files contains a list, one per line, of
absolute paths to every file in the project (generated via script of
course).

I have cscopeprg set to the absolute path to my cscope executable, and
cscopeverbose turned on.

If I don't try to specify a file list with -i, I am able to connect to
and use cscope as long as I call the cscope add command from a
directory containing code, but with the project code in several
different directories, this will not work very well for me.

I could find no mention of this or any other error code in :help
cscope, :help E563, or the cscope man page accessed online at
http://cscope.sourceforge.net/cscope_man_page.html.

What am I doing wrong? Since cscope works OK by itself, my only
thought is that I must be using the Vim interface incorrectly, but I
cannot see anything wrong with the commands I issued.

John Beckett

unread,
Sep 16, 2009, 7:46:27 AM9/16/09
to vim...@googlegroups.com
Ben Fritz wrote:
> From the cmd.exe prompt, I can successfully navigate the code using:
> cscope.exe -f C:/Temp/projname.cscope.out -i C:/Temp/
> projname.cscope.files
>
> But when I then try to use it within Vim with the following command:
> cscope add C:/Temp/projname.cscope.out -i C:/Temp/
> projname.cscope.files
>
> I get:
> E563: stat(C:/Temp/projname.cscope.out) error: 2

It looks like a severe problem so I will blurt out some thoughts
despite not having used Cscope for a few years (and not really
having a clue).

I think the '2' is error ENOENT
No such file or directory.
A component of a specified pathname did not exist,
or the pathname was an empty string.

so I guess that cscope (or Vim?) thinks that file
C:/Temp/projname.cscope.out does not exist.

I wonder what cscope does with a path like C:/Temp/whatever
(will the forward slashes work?).

You might fiddle with setting verbose levels in Vim to see if
more info is displayed.

You say you can navigate the code using cscope.exe, so I assume
you have used -b to build the database. I wonder what directory
that database is in. I would be inclined to make a new directory
and put a few test source files in it, then try all your
commands while working in that directory (so there is no need
for a path to anything). I would make sure the directory path is
short with no spaces just for safety, and I would copy
cscope.exe and sort.exe into that directory so there is no risk
of any dodgy files coming first in the PATH.

My old notes include a cryptic message that I obtained file
env.exe from unxtools and put it early in my PATH. It sets the
environment for a spawned program and is used by the 2004
version of Cscope I last used (to call sort.exe?). By the way,
unxtools is obsolete; if I were looking now I would go to
http://gnuwin32.sourceforge.net/

John

Ben Fritz

unread,
Sep 16, 2009, 10:31:03 AM9/16/09
to vim_use


On Sep 16, 6:46 am, "John Beckett" <johnb.beck...@gmail.com> wrote:
>
> It looks like a severe problem so I will blurt out some thoughts
> despite not having used Cscope for a few years (and not really
> having a clue).
>
> I think the '2' is error ENOENT
>     No such file or directory.
>     A component of a specified pathname did not exist,
>     or the pathname was an empty string.
>
> so I guess that cscope (or Vim?) thinks that file
> C:/Temp/projname.cscope.out does not exist.

:echo filereadable('C:/Temp/projname.cscope.out') displays 1 in Vim.

>
> I wonder what cscope does with a path like C:/Temp/whatever
> (will the forward slashes work?).

The forward slashes seem to work, they do from cmd.exe anyway.

Just to try it though, I tried connecting in gvim launched with -N -u
NONE so that 'shellslash' and anything else I may have set do not
apply.

Same error.

>
> You might fiddle with setting verbose levels in Vim to see if
> more info is displayed.
>

Nothing more shows with 'verbose' set to 20. Just the E563.

> You say you can navigate the code using cscope.exe, so I assume
> you have used -b to build the database.

I did, using "cscope -b -f projname.cscope.out -i
projname.cscope.files". Is this correct?

Actually, first I tried it without the -b, which (I think) built the
database but also went into the cscope interface.

While we're on this note, does Vim rebuild the database, or provide a
command to do so, or will I need to periodically regenerate it like
with ctags?

> I wonder what directory
> that database is in. I would be inclined to make a new directory
> and put a few test source files in it, then try all your
> commands while working in that directory (so there is no need
> for a path to anything). I would make sure the directory path is
> short with no spaces just for safety, and I would copy
> cscope.exe and sort.exe into that directory so there is no risk
> of any dodgy files coming first in the PATH.

Good idea! I tried it but unfortunately nothing changed. Thinking that
maybe it didn't like the absolute paths in the .files file, I modified
it to make the paths relative. This did not work either.

>
> My old notes include a cryptic message that I obtained file
> env.exe from unxtools and put it early in my PATH. It sets the
> environment for a spawned program and is used by the 2004
> version of Cscope I last used (to call sort.exe?). By the way,
> unxtools is obsolete; if I were looking now I would go tohttp://gnuwin32.sourceforge.net/
>

Hmm, I don't see a mention of this anywhere else. I doubt this is an
issue since cscope.exe by itself works fine.

Is there a way to see the exact cscope command that Vim uses with
"cscope add"? Perhaps I should try THAT in cmd.exe to see if I get
more information.

Ben Fritz

unread,
Sep 16, 2009, 10:38:50 AM9/16/09
to vim_use


On Sep 15, 11:03 pm, Ben Fritz <fritzophre...@gmail.com> wrote:
> But when I then try to use it within Vim with the following command:
>
> cscope add C:/Temp/projname.cscope.out -i C:/Temp/
> projname.cscope.files
>
> I get:
>
> E563: stat(C:/Temp/projname.cscope.out) error: 2
>
> and no cscope connection is made.
>
> C:/Temp/projname.cscope.files contains a list, one per line, of
> absolute paths to every file in the project (generated via script of
> course).
>
> I have cscopeprg set to the absolute path to my cscope executable, and
> cscopeverbose turned on.
>
> If I don't try to specify a file list with -i, I am able to connect to
> and use cscope as long as I call the cscope add command from a
> directory containing code, but with the project code in several
> different directories, this will not work very well for me.
>

Perhaps I don't need the -i at all when using "cscope add" within Vim?
After building the database with cscope.exe, all that information is
in the database file. The text "taken from a version of the cscope man
page" contained in :help cscope-intro says:

> On a subsequent call, cscope
> rebuilds the database only if a source file has changed or the list of
> source files is different.

Does this apply only to cscope.exe, but not to cscope called through
Vim? If Vim never rebuilds the database, there is probably no need for
the -i flag at all.

This should probably be mentioned in the help if it's the case.

Ben Fritz

unread,
Sep 16, 2009, 11:25:08 AM9/16/09
to vim_use


On Sep 16, 9:38 am, Ben Fritz <fritzophre...@gmail.com> wrote:
>
> Perhaps I don't need the -i at all when using "cscope add" within Vim?
> After building the database with cscope.exe, all that information is
> in the database file. The text "taken from a version of the cscope man
> page" contained in :help cscope-intro says:
>
> > On a subsequent call, cscope
> > rebuilds the database only if a source file has changed or the list of
> > source files is different.
>
> Does this apply only to cscope.exe, but not to cscope called through
> Vim? If Vim never rebuilds the database, there is probably no need for
> the -i flag at all.
>
> This should probably be mentioned in the help if it's the case.- Hide quoted text -
>

This does seem to be the case.

Here's something like what I eventually ended up with to aid my
connecting to the database:

command! -bar CsProjname
\ source $HOME/cscope_win32/projname.setup.vim |
\ exe 'silent !'.&cscopeprg." -b ".expand(
\ "-f $HOME/cscope_win32/projname.cscope.out ".
\ "-i $HOME/cscope_win32/projname.cscope.files") |
\ exe "cscope add ".
\ expand("$HOME/cscope_win32/projname.cscope.out")

projname.setup.vim just uses glob(), split(), filter(), and writefile
() to get a list of files in the project.

The expand() calls are important for some reason...not sure why.

Christian Brabandt

unread,
Sep 16, 2009, 11:35:58 AM9/16/09
to vim...@googlegroups.com
Hi Ben!

On Mi, 16 Sep 2009, Ben Fritz wrote:

> \ source $HOME/cscope_win32/projname.setup.vim |
> \ exe 'silent !'.&cscopeprg." -b ".expand(
> \ "-f $HOME/cscope_win32/projname.cscope.out ".
> \ "-i $HOME/cscope_win32/projname.cscope.files") |
> \ exe "cscope add ".
> \ expand("$HOME/cscope_win32/projname.cscope.out")

[…]


> The expand() calls are important for some reason...not sure why.

because otherwise environment variables won't be resolved.

regards,
Christian
--
It is too bad that the speed of light hasn't kept pace with the
changes in CPU speed and network bandwidth. -- <wie...@porcupine.org>

Ben Fritz

unread,
Sep 16, 2009, 11:59:21 AM9/16/09
to vim_use


On Sep 16, 10:35 am, Christian Brabandt <cbli...@256bit.org> wrote:
> > The expand() calls are important for some reason...not sure why.
>
> because otherwise environment variables won't be resolved.
>

Right...that's why I put them there. I meant, I'm not sure why the
environment variables aren't being resolved.

I'm sure the reason is documented somewhere, it was just unexpected.

The main problem I was having was including the -i flag in my ':cscope
add' commands. The custom command given above is the final result
after getting it working while manually typing each command.

Does anyone know why the -i flag would cause the E563 I was having?
The simple test case John suggested, with EVERYTHING in the same
directory, failed when using -i but not when leaving it off.
Reply all
Reply to author
Forward
0 new messages