Menu

#27 remove duplicate list due to letter case in filename

None
closed-rejected
nobody
None
5
2015-03-31
2008-03-27
Chris Lee
No

In windows platform, the filename is case in-sensitive, such that "io.h" and "IO.h" is the same file. But cscope seems to treat them as different files and will generate two file entries in the database. This will result in a symbol will match in two places and produce some inconvenience.

Below is the screen shot: All these four items are exactly the same.

http://www.flickr.com/photos/18351815@N00/2365060111/

Discussion

  • Neil Horman

    Neil Horman - 2008-03-27

    Logged In: YES
    user_id=827328
    Originator: NO

    No, you're misunderstanding this. Dos/Windows will treat io.h and IO.h as the same file in the same directory. As such there is no way for cscope to recognize one file as two different files. What you're most likely seeing is the result of different case file names in different directories (but with the same or simmilar content) getting picked up. This is working exactly as it should. If you manually search your source tree, you should find all the variants that cscope has in its list. Note also that if there isn't sufficient space to display it, cscope will truncate the path names on files.

     
  • Chris Lee

    Chris Lee - 2008-03-28

    example files for filename case problem

     
  • Chris Lee

    Chris Lee - 2008-03-28

    Logged In: YES
    user_id=2047017
    Originator: YES

    I have attached a simple example to illustrate my problem.
    I have main.c and main.h in the same directory. In main.c, I include main.h as:

    #include "main.h", cscope.out is good, only main.c and main.h are listed. However, if I change as:

    #include "MAIN.H", cscope.out will produce 3 files in it: main.c, main.h and MAIN.H
    File Added: cs.zip

     
  • Hans-Bernhard Broeker

    Logged In: YES
    user_id=27517
    Originator: NO

    > #include "MAIN.H", cscope.out will produce 3 files in it: main.c, main.h
    > and MAIN.H

    Well, as the saying goes, don't do that, then.

    cscope is a UNIX-based program, so it has some UNIX concepts deeply engrained in it. One of those is that filenames are supposed to be case-sensitive. Your source would fail to compile on Unix platforms because of this, i.e. it's a portability problem of the source at least as it one of cscope.

    We could add an --ignore-file-name-case option (implementation would rely on a case-insensitive compare in dir.c:infilelist()). But for a traditional UNIX tool like cscope, I don't think that's a good idea. When in Rome, do as the Romans do.

     
  • Chris Lee

    Chris Lee - 2008-03-31

    Logged In: YES
    user_id=2047017
    Originator: YES

    Thanks broeker, I agree with you.

    But I have to work with many other people who may not concern the letter case of filenames.
    So I have made a simple utility to trim the cscope database.
    http://code.google.com/p/cscopetrim/

     
  • Hans-Bernhard Broeker

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