[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Global blocks for a few sec under MS Windows
From: |
Hideki IWAMOTO |
Subject: |
Re: Global blocks for a few sec under MS Windows |
Date: |
Sat, 27 Nov 2010 13:58:26 +0900 |
Hi.
The bug you reported was fixed in the CVS repository. Thank you.
http://cvs.savannah.gnu.org/viewvc/global/libutil/getdbpath.c?root=global&r1=1.27&r2=1.28
On Thu, 25 Nov 2010 20:30:07 +0900, Whity Pig wrote...
> Hello, everyone.
>
>
> Under MS Windows and Cygwin, global blocks for a few seconds if there
> is no GTAGS on the path from the current directory to the root
> directory.
>
>
> The following is what I did.
>
> % /usr/bin/time global foo
> global: GTAGS not found.
> Command exited with non-zero status 3
> 0.03user 0.03system 0:09.04elapsed 0%CPU (0avgtext+0avgdata
> 353792maxresident)k
> 0inputs+0outputs (1380major+0minor)pagefaults 0swaps
>
>
> This is probably because global does stat(2) with an argument of
> "//GTAGS" when it comes to the root directory.
>
>
> In MS Windows, path names prefixed with "//" mean someplace on the
> network, though I don't know for sure. Anyway, global stops for about
> 10 seconds on my environment, presumably because of searching for tag
> on the network TWO times.
>
> I think the problem is in libutil/getdbpath.c, around line 150.
> The below is the diff I created, maybe botched up(--;
>
>
> % diff -u getdbpath.c.org getdbpath.c
> --- getdbpath.c.org 2010-08-30 21:19:04.000000000 +0900
> +++ getdbpath.c 2010-11-25 20:19:18.987375000 +0900
> @@ -147,7 +147,13 @@
> if (makeobjdir == NULL)
> setupvariables(verbose);
>
> - snprintf(path, sizeof(path), "%s/%s", candidate, dbname(GTAGS));
> + if ((strnlen(candidate, MAXPATHLEN) == 1) && (*candidate == '/')) {
> + snprintf(path, sizeof(path), "%s%s", candidate, dbname(GTAGS));
> + }
> + else {
> + snprintf(path, sizeof(path), "%s/%s", candidate, dbname(GTAGS));
> + }
> +
> if (verbose)
> fprintf(stderr, "checking %s\n", path);
> if (test("fr", path)) {
> @@ -156,8 +162,16 @@
> snprintf(dbpath, size, "%s", candidate);
> return 1;
> }
> - snprintf(path, sizeof(path),
> - "%s/%s/%s", candidate, makeobjdir, dbname(GTAGS));
> +
> + if ((strnlen(candidate, MAXPATHLEN) == 1) && (*candidate == '/')) {
> + snprintf(path, sizeof(path),
> + "%s%s/%s", candidate,
> makeobjdir, dbname(GTAGS));
> + }
> + else {
> + snprintf(path, sizeof(path),
> + "%s/%s/%s", candidate,
> makeobjdir, dbname(GTAGS));
> + }
> +
> if (verbose)
> fprintf(stderr, "checking %s\n", path);
> if (test("fr", path)) {
> @@ -167,8 +181,14 @@
> return 1;
> }
> #if !defined(_WIN32) && !defined(__DJGPP__)
> - snprintf(path, sizeof(path),
> - "%s%s/%s", makeobjdirprefix, candidate, dbname(GTAGS));
> + if ((strnlen(candidate, MAXPATHLEN) == 1) && (*candidate == '/')) {
> + snprintf(path, sizeof(path),
> + "%s%s/%s", candidate,
> makeobjdir, dbname(GTAGS));
> + }
> + else {
> + snprintf(path, sizeof(path),
> + "%s/%s/%s", candidate,
> makeobjdir, dbname(GTAGS));
> + }
> if (verbose)
> fprintf(stderr, "checking %s\n", path);
> if (test("fr", path)) {
>
>
> My environment:
> Global version: 5.9.2
> Cygwin 1.7.7
> Windows XP SP3
>
>
> Best regards,
> whitypig
>
>
> --
> whitypig <address@hidden>
>
>
> _______________________________________________
> Bug-global mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-global
----
Hideki IWAMOTO address@hidden