[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gtags and symbolic links
From: |
Petr Uzel |
Subject: |
gtags and symbolic links |
Date: |
Wed, 13 May 2009 17:33:44 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
Hi list,
I have some questions and maybe some suggestions about global treatment of
symbolic links.
I know there was some discussion about this [1] some time ago, but in my
opinion some issues still remain.
First of all, I'm thinking about implementing the nofollow option for gtags, as
proposed on [2]. My question is, how exactly should this behave: should that
only omit symbolic links that point to a directory or should that ignore
symbolic links completely (e.g. ./foo.c pointing to ./bar.c) ?
When thinking about it and looking into the code, I don't quite understand the
following part of find_read_traverse() (libutil/find.c):
522 for (;;) {
523 while (curp->p < curp->end) {
524 char type = *(curp->p);
525 const char *unit = curp->p + 1;
526
527 curp->p += strlen(curp->p) + 1;
528
529 /*
530 * Skip files described in the skip list.
531 */
532 /* makepath() returns unsafe module local area. */
533 strlimcpy(path, makepath(dir, unit, NULL), sizeof(path));
534 if (type == 'd')
535 strcat(path, "/");
536 if (skipthisfile(path))
537 continue;
538 if (type == 'f') {
539 /*
540 * Skip the following:
541 * o directory
542 * o file which does not exist
543 * o dead symbolic link
544 */
545 if (!test("f", path)) {
546 if (test("d", path))
547 warning("'%s' is a directory. (Ignored)", path);
548 else
549 warning("'%s' not found. (Ignored)", path);
550 continue;
551 }
552 /*
553 * GLOBAL cannot treat path which includes blanks.
554 * It will be improved in the future.
555 */
556 if (locatestring(path, " ", MATCH_FIRST)) {
557 warning("'%s' ignored, because it includes blank.", &path[2]);
558 continue;
559 }
<SNIP>
To be specific, what's the purpose of lines 539-551? If I'm not mistaken, the
test at line 545 can never succeed because it is the opposite of the test at
line 538.
Next, is there any benefit of determining the type of a file in getdirs()
function (I mean prefixing the filename with f,d) instead of determining the
type directly in the find_read_traverse() function?
And finally: what actually made me start thinking about this is fact that gtags
can not treat recursive links, like in [3]. This actually makes it difficult to
use gtags on directories created by quilt setup, because quilt creates exactly
this type of directory structure (for a good reason). This could be worked
around by the nofollow option, but IMHO the recursive link detection should be
done also in default mode - what do you think?
Thanks in advance,
[1] http://lists.gnu.org/archive/html/bug-global/2008-01/msg00000.html
[2] http://www.gnu.org/software/global/plans.html
[3] http://lists.gnu.org/archive/html/bug-global/2008-01/msg00001.html
--
Best regards / s pozdravem
Petr Uzel, Packages maintainer
---------------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: address@hidden
Lihovarská 1060/12 tel: +420 284 028 964
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz
- gtags and symbolic links,
Petr Uzel <=