From: SourceForge.net <no...@so...> - 2004-04-30 15:00:42
|
Bugs item #656286, was opened at 2002-12-19 14:24 Message generated for change (Settings changed) made by broeker You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104664&aid=656286&group_id=4664 Category: C lexer/parser Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Gaurav Gupta (ggupta98) Assigned to: Hans-Bernhard Broeker (broeker) Summary: Unreadable files in cscope.files break scanning Initial Comment: I'm running a Red Hat linux 7.2 (kernel 2.4.7) on intel platform. I've downloaded and installed the cscope 15.4 using the instruction given in INSTALL file (by executing configure --with-flex, make and make install). I've then made a list of source code files at the top directory the cacope is required to start browsing files (I've used "find ./ -name *.[ch] -print > cscope.in ). I've then gone ahead to execute "cscope -i cscope.in" and got "Building cross-reference...input in flex scanner failed" error. I don't know how to get rid of this problem, can some one help, please? ---------------------------------------------------------------------- >Comment By: Hans-Bernhard Broeker (broeker) Date: 2004-04-30 17:00 Message: Logged In: YES user_id=27517 crossref() uses stat() and S_ISREG now. Closed as fixed. ---------------------------------------------------------------------- Comment By: Hans-Bernhard Broeker (broeker) Date: 2003-04-29 14:26 Message: Logged In: YES user_id=27517 Ouch. And I was thinking everybody would be using 'find -type f' to generate cscope.files lists anyway. Thanks for keeping with me to dig into this. This seems to behave different between Solaris and Digital Unix, though. Here, the fopen() of a directory succeeds, and cscope will actually try to parse the contents of the binary representation of the directory.... It hangs in an endless loop later, though ;-( I guess I should protect this fopen() by a call to lstat() and S_ISREG(), then. ---------------------------------------------------------------------- Comment By: Henry Gessau (henry44) Date: 2003-04-28 19:51 Message: Logged In: YES user_id=765259 OK, thanks, I found the problem. One of the "files" was actually a *directory* called foo.c. Zero-length files seem to be ignored just fine. I tweaked my find script to ensure that only regular files are listed, but you might want to consider adding a check in the cscope sources for proper file type before passing to the lexer. ---------------------------------------------------------------------- Comment By: Hans-Bernhard Broeker (broeker) Date: 2003-04-28 18:32 Message: Logged In: YES user_id=27517 For a quick start, you could remove these files from (a copy of) the cscope.files list itself, and see whether that fixes it. If you want to do this from inside the cscope sources, the place to do that would be near the start of crossref.c:crossref(). As to running in gdb: the breakpoint you would put either at exit(), or at yy_fatal_error. Then just display the backtrace and see what the argument to crossref() was. ---------------------------------------------------------------------- Comment By: Henry Gessau (henry44) Date: 2003-04-28 18:10 Message: Logged In: YES user_id=765259 Yes, I do have several zero-length .c and .h files. They are actually used in the build of the software I am analyzing. Can you give me a pointer to where in the sources I could skip over these files (not call the lexer on them)? Just as an experiment. I can run cscope under GDB. Where would I put the breakpoint and what variable(s) would I look at to find which file is the culprit? ---------------------------------------------------------------------- Comment By: Hans-Bernhard Broeker (broeker) Date: 2003-04-28 17:48 Message: Logged In: YES user_id=27517 One major problem with this debug approach might turn out to be that 12.9 is a proprietary version of the program --- i.e. there's no way anybody can know why it worked, if all the open-source ones don't. It almost certainly won't be using flex, either. It's rather unlikely that the reason for this problem can be found in the cscope sources at all. More important tests would be: 1) Does changing from flex to lex change anything? 2) Are there any strange files in that selection you know of? E.g. zero-length files? Are they known to all be actually used parts of a successful build of the software you're analysing? It may be necessary to run cscope in a debugger and set a breakpoint exit() to find out which of those 17k files is causing it to bail out. IIRC, the only way I ever managed to generate that flex error message was with non-existing files, dead symlinks or similar broken entries in the cscope.files. ---------------------------------------------------------------------- Comment By: Henry Gessau (henry44) Date: 2003-04-28 17:00 Message: Logged In: YES user_id=765259 Yes, I am absolutely sure that "xargs wc" didn't produce any error message about unreadable files. I have verified that I am using flex version 2.5.4. I tested cscope 15.3 and 12.9 on the same set of input files. Results: 15.3 encounters the same error, 12.9 processes all files without complaint. Time permitting, I will download and build the interim versions to find where it broke. ---------------------------------------------------------------------- Comment By: Hans-Bernhard Broeker (broeker) Date: 2003-04-27 16:03 Message: Logged In: YES user_id=27517 Unfortunately, I don't think exiting gracefully is an option --- the program is killed from inside the flex-generated code, not from cscope's own sources. It's flex's internal function yy_fatal_error() that calls exit(EXIT_FAILURE). Are you sure that your ":xargs wc" run didn't produce any error message about unreadable files? One further caveat: make sure you really have a recent "real" flex installed and are using that, not Sun's predefined ancient pre-installed thing also called flex. ---------------------------------------------------------------------- Comment By: Henry Gessau (henry44) Date: 2003-04-26 00:00 Message: Logged In: YES user_id=765259 I just ran cscope 12.9 on the same set of files and it worked fine. Suggestion: cscope should not stop when it cannot handle a file. It should print an error and proceed to the next file. ---------------------------------------------------------------------- Comment By: Henry Gessau (henry44) Date: 2003-04-25 23:53 Message: Logged In: YES user_id=765259 I get this same error on Solaris 2.6 using cscope 15.4. In my case I cannot use cscope -R because the files are all over the place. xargs wc < cscope.files This told me nothing. It counted all the words in all 17,163 files. ---------------------------------------------------------------------- Comment By: Gaurav Gupta (ggupta98) Date: 2002-12-20 08:05 Message: Logged In: YES user_id=672368 Thanks broeker, The culprit files have been identified by "xargs wc < cscope.in" run. I've removed those files from the cscope.in and cross-references build was succeeded. ---------------------------------------------------------------------- Comment By: Hans-Bernhard Broeker (broeker) Date: 2002-12-19 14:59 Message: Logged In: YES user_id=27517 The error message means that flex couldn't read one of the files found in the list. To test which that was, you may want to inspect that cscope.in file, or just give it a dry run: xargs wc < cscope.in Anyway, using 'find' in this particular way isn't really useful. You could just as well have run cscope -R and been doen with it. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104664&aid=656286&group_id=4664 |