bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch for global and libutil] when root dir is "/"


From: Frédéric Maitre
Subject: [patch for global and libutil] when root dir is "/"
Date: Thu, 4 Jan 2007 16:41:11 +0000 (GMT)

Hi,

I found two bugs when the root dir is "/".
The first one is in gtags : when generating tags from the dir "/", with a list 
of files with a command like this :
cd /
gtags -f - -v < /tmp/filelist
All the files are rejected and said to be "out of source tree". A patch for 
this may be :

--- libutil/find.c.save 2007-01-04 11:57:09.000000000 +0100
+++ libutil/find.c      2007-01-04 12:04:43.000000000 +0100
@@ -452,7 +452,7 @@
                if (ip == NULL)
                        die("cannot open '%s'.", filename);
        }
-       snprintf(rootdir, sizeof(rootdir), "%s/", root);
+       snprintf(rootdir, sizeof(rootdir), "%s%s", root, (root[strlen(root)-1] 
== '/' ? "" : "/"));
 
        /*
         * prepare regular expressions.

The second one is in global : after generating tags from dir "/", a local 
search fails with a command like :
cd /dir1/dir2
global -gl anything

A patch for this may be :

--- global/global.c.save        2007-01-04 13:00:10.000000000 +0100
+++ global/global.c     2007-01-04 13:03:43.000000000 +0100
@@ -397,7 +397,7 @@
         * make local prefix.
         */
        if (lflag) {
-               char    *p = cwd + strlen(root);
+               char    *p = cwd + (strlen(root) == 1 ? 0 : strlen(root));
                STRBUF  *sb = strbuf_open(0);
                /*
                 * getdbpath() assure follows.

The tests and the patches were done in version 5.2.

Regards,
Frédéric Maitre




__________________________________________________
Do You Yahoo!?
En finir avec le spam? Yahoo! Mail vous offre la meilleure protection possible 
contre les messages non sollicités 
http://mail.yahoo.fr Yahoo! Mail




reply via email to

[Prev in Thread] Current Thread [Next in Thread]