Menu

#247 cscope: cannot find file

None
closed-rejected
nobody
None
9
2020-01-29
2009-11-04
No

Hi,
Ive just tried to use cscope and come across some strange errors. After creating a cscope.files file (using find and absolute paths) I've kicked off cscope as follows:
cscope -b
and scope has complained about almost all files (but the local system ones).

I've discovered that the "bad" files are links to other links, however, when I use the whatever command (file, file -L, ls -l, ...) on these files they seem to be correct and accessable, at least for reading.
These files are within directories mounted to a machine I'm working on as follows:
server name:/directory on /directory type nfs (rw,nosuid,soft,addr=ip address)

I've done further investigation and using the strace utility I've found out (a small snippet from a strace's output):
...
stat("FILE_NAME", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("FILE_NAME", O_RDONLY) = 6
fcntl(6, F_SETFD, FD_CLOEXEC) = 0
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fbfffe910) = -1 ENOTTY (Inappropriate ioctl for device)
fstat(6, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2a95567000
read(6, "", 32768) = 0
ioctl(6, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fbfffe8f0) = -1 ENOTTY (Inappropriate ioctl for device)
close(6) = 0
...

The pattern above repeats for all "bad" files.

So I've tried more and discovered this:
the machine I'm working on is: Linux ... 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux
the machine the device is exported from is: HP-UX ... B.11.31 U 9000/800 526386655 unlimited-user license

Could it be the problem?

Regards,
hawran

Discussion

  • hawran diskuse

    hawran diskuse - 2009-11-04
    • priority: 5 --> 7
     
  • hawran diskuse

    hawran diskuse - 2009-11-04

    Hi,
    I've just noticed that the problem is with the version I'd built myself:
    $ cscope -V
    cscope: version 15.7a

    The original version works fine:
    $ \cscope -V
    cscope: version 15.5

    What is wrong?

    Regards,
    hawran

     
  • hawran diskuse

    hawran diskuse - 2012-05-29
    • priority: 7 --> 9
     
  • hawran diskuse

    hawran diskuse - 2012-05-29

    Does anybody care?
    The version 15.7a is really crappy and not usable.

    I've prepared some further hints, 15.7a version, invoked with cscope.files with full path filenames, some info related to one reported file (from a lot of files):

    cscope output:

    cscope: cannot find file /vobs/Service_Node/GSN2/incl/ae_cdr_2.h

    strace outputs:

    $ egrep 'ae_cdr_2\.h' cscope.15.5.000.17239
    -----------------------------------------------------------------------
    access("/vobs/Service_Node/GSN2/incl/ae_cdr_2.h", R_OK) = 0
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)
    stat("/vobs/Service_Node/GSN2/incl/ae_cdr_2.h", {st_mode=S_IFREG|0555, st_size=1429, ...}) = 0
    open("/vobs/Service_Node/GSN2/incl/ae_cdr_2.h", O_RDONLY) = 6
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)

    $ egrep 'ae_cdr_2\.h' cscope.15.7a.000.738
    ---------------------------------------------------------------------
    access("/vobs/Service_Node/GSN2/incl/ae_cdr_2.h", R_OK) = 0
    lstat("/vobs/Service_Node/GSN2/incl/ae_cdr_2.h", {st_mode=S_IFLNK|0777, st_size=49, ...}) = 0
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)
    access("/usr/include/ae_cdr_2.h", R_OK) = -1 ENOENT (No such file or directory)

    $ stat /vobs/Service_Node/GSN2/incl/ae_cdr_2.h
    -----------------------------------------------------------------------------
    File: `/vobs/Service_Node/GSN2/incl/ae_cdr_2.h' -> `/vobs/Service_Node/GSN2/cdr_generation/ae_cdr_2.h'
    Size: 49 Blocks: 4 IO Block: 8192 symbolic link
    Device: fc3dh/64573d Inode: 174940 Links: 1
    Access: (0777/lrwxrwxrwx) Uid: ( 5179/vobadmin) Gid: ( 20/ games)
    Access: 1999-06-29 12:44:33.383433000 +0200
    Modify: 1999-06-29 12:44:33.383433000 +0200
    Change: 1999-06-29 12:44:33.383433000 +0200

    $ stat /vobs/Service_Node/GSN2/cdr_generation/ae_cdr_2.h
    -----------------------------------------------------------------------------------------------
    File: `/vobs/Service_Node/GSN2/cdr_generation/ae_cdr_2.h'
    Size: 1429 Blocks: 5 IO Block: 8192 regular file
    Device: fc3dh/64573d Inode: 172813 Links: 1
    Access: (0555/-r-xr-xr-x) Uid: ( 5179/vobadmin) Gid: ( 20/ games)
    Access: 2006-12-15 06:47:03.796093000 +0100
    Modify: 2006-12-15 06:47:03.796093000 +0100
    Change: 2010-08-24 11:16:39.000000000 +0200

    $ uname -a
    ------------------
    Linux .... 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux

    PS what's really interesting for me is WHY is cscope trying to find a file within the system path (/usr/include/) ...

     
  • Hans-Bernhard Broeker

    > Does anybody care?

    I might have, but language like this:

    > The version 15.7a is really crappy and not usable.

    doesn't exactly encourage spending my free time on your behalf.

     
  • hawran diskuse

    hawran diskuse - 2012-05-30

    >> The version 15.7a is really crappy and not usable.

    >doesn't exactly encourage spending my free time on your behalf.

    Nobody must.

    BTW,
    1) Submitted: hawran diskuse ( hawran-diskuse ) - 2009-11-04 07:19:58 PST
    2) Nobody asked for whatever since then.
    3) I've added further info trying to help. My free time.

     
  • Anonymous

    Anonymous - 2012-08-31

    Here is a simple patch which re-enables cscope to work with symlinks. Really you were already 99% of the way there to a fix.

    IMHO, this should be a command line option (-l) to enable including symlinks. There are many projects which use symlinks and it's perfectly valid in many cases. It's been messing me up for years trying to use the Cavium SDKs.

    Here's the patch (this is against 15.8)

    --- dir.c.orig 2010-06-28 19:16:50.000000000 -0300
    +++ dir.c 2012-08-30 21:56:44.047742152 -0300
    @@ -652,7 +652,7 @@ accessible_file(char *file)
    struct stat stats;

    if (lstat(file, &stats) == 0
    - && S_ISREG(stats.st_mode)) {
    + && (S_ISREG(stats.st_mode) || S_ISLNK(stats.st_mode))) {
    return YES;
    }
    }

     
  • Hans-Bernhard Broeker

    • status: open --> closed-rejected
    • Group: -->
     

Log in to post a comment.