Bug 547817 - cscope doesn't read cscope.files by default
Summary: cscope doesn't read cscope.files by default
Keywords:
Status: CLOSED DUPLICATE of bug 547023
Alias: None
Product: Fedora
Classification: Fedora
Component: cscope
Version: 12
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Neil Horman
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-12-15 18:48 UTC by Jeremy Fitzhardinge
Modified: 2009-12-15 20:35 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2009-12-15 20:35:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jeremy Fitzhardinge 2009-12-15 18:48:32 UTC
Description of problem:
Cscope is supposed to read the file list from cscope.files, but does not.  Instead, it tries to use the command-line options as files to be indexed.  This breaks "make cscope" in the Linux kernel source.

Version-Release number of selected component (if applicable):
cscope-15.6-6.fc12.x86_64

How reproducible:
Always

Steps to Reproduce:
1.create a list of files in cscope.files
2.run "cscope -b -f cscope.out
3.
  
Actual results:
$ cscope -b -f cscope.out
cscope: cannot find file -b
cscope: no source files found


Expected results:
Cscope should generate index.

Additional info:
$ cscope -b -f cscope.out -i cscope.files

works as expected.

I suspect this is fallout from the cscope command-line parser rewrite.

Comment 1 Neil Horman 2009-12-15 20:34:51 UTC
I have a fix for this already, in bz 547023.  When the cvs servers for fedora come back online, I'll commit the fix.  Its already committed to the upstream cscope cvs tree, if you just want to use that in the interim.  This is the patch if you're interested:

RCS file: /cvsroot/cscope/cscope/src/main.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- src/main.c	9 Dec 2009 20:29:34 -0000	1.48
+++ src/main.c	14 Dec 2009 13:51:50 -0000	1.49
@@ -67,7 +67,7 @@
 #define DFLT_INCDIR "/usr/include"
 #endif
 
-static char const rcsid[] = "$Id: main.c,v 1.48 2009/12/09 20:29:34 nhorman Exp $";
+static char const rcsid[] = "$Id: main.c,v 1.49 2009/12/14 13:51:50 nhorman Exp $";
 
 /* note: these digraph character frequencies were calculated from possible 
    printable digraphs in the cross-reference for the C compiler */
@@ -146,17 +146,15 @@
 char ** parse_options(int *argc, char **argv)
 {
 	int opt;
-	int optind;
+	int longind;
 	char path[PATHLEN + 1];     /* file path */
 	char *s;
-	int args_handled = 1;
 	int argcc = *argc;
 	
 
 	while ((opt = getopt_long(argcc, argv,
 	       "hVbcCdeF:f:I:i:kLl0:1:2:3:4:5:6:7:8:9:P:p:qRs:TUuv",
-	       lopts, &optind)) != -1) {
-		args_handled++;
+	       lopts, &longind)) != -1) {
 		switch(opt) {
 
 		case '?':
@@ -249,8 +247,8 @@
  	 * args.  Its ugly, but we need to do it so that the rest
  	 * of the main routine doesn't get all confused
  	 */
-	*argc = *argc - args_handled;
-	return &argv[*argc];
+	*argc = *argc - optind;
+	return &argv[optind];
 }
 #endif

Comment 2 Neil Horman 2009-12-15 20:35:09 UTC

*** This bug has been marked as a duplicate of bug 547023 ***


Note You need to log in before you can comment on or make changes to this bug.