bug-global
[Top][All Lists]
Advanced

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

Re: GNU global, do not resolve symlinks by default and use PWD if availa


From: Shigio YAMAGUCHI
Subject: Re: GNU global, do not resolve symlinks by default and use PWD if available
Date: Sat, 28 Jun 2014 07:46:15 +0900

Hello,
I have added new environment variable GTAGSLOGICALPATH.

Usage:
# use logical path
$ export GTAGSLOGICALPATH=
# use physical path
$ unset GTAGSLOGICALPATH

It is available in the cvs repository.
Would you please try it?
Thank you in advance.

Index: ChangeLog
===================================================================
RCS file: /sources/global/global/ChangeLog,v
retrieving revision 1.140
diff -r1.140 ChangeLog
21a22,27
> June 28 2014, Shigio YAMAGUCHI
> New environment variable GTAGSLOGICALPATH was added.
> If it is set then GLOBAL use logical path (PWD), else
> physical path. This variable is now undocumented.
Index: global/global.c
===================================================================
RCS file: /sources/global/global/global/global.c,v
retrieving revision 1.288
diff -r1.288 global.c
747,751d746
< * Logical current directory.
< * We force idutils to follow the same rule as GLOBAL.
< */
< set_env("PWD", cwd);
< /*
1201a1197
> #if _WIN32 || __DJGPP__
1202a1199,1201
> #else
> strbuf_sprintf(ib, "PWD=%s %s", quote_shell(root), lid);
> #endif
Index: globash/globash.rc
===================================================================
RCS file: /sources/global/global/globash/globash.rc,v
retrieving revision 1.32
diff -r1.32 globash.rc
219,220c219,227
< # always use -P option to ignore symbolic links.
< builtin pwd -P
---
> #
> # If GTAGSLOGICALPATH is defined we use logical path
> # else physical path. GTAGSLOGICALPATH is undocumented.
> #
> local x=${GTAGSLOGICALPATH-NODEF}
> case "$x" in
> NODEF) builtin pwd -P;;
> *) builtin pwd -L;;
> esac
Index: gozilla/gozilla.c
===================================================================
RCS file: /sources/global/global/gozilla/gozilla.c,v
retrieving revision 1.63
diff -r1.63 gozilla.c
322c322
< if (getcwd(cwd, sizeof(cwd)) == NULL)
---
> if (vgetcwd(cwd, sizeof(cwd)) == NULL)
Index: gtags/gtags.c
===================================================================
RCS file: /sources/global/global/gtags/gtags.c,v
retrieving revision 1.267
diff -r1.267 gtags.c
194c194
< if (!getcwd(cwd, MAXPATHLEN))
---
> if (!vgetcwd(cwd, MAXPATHLEN))
354,358d353
< * Logical current directory.
< * We force idutils to follow the same rule as GLOBAL.
< */
< set_env("PWD", cwd);
< /*
477a473,477
> /*
> * Since idutils stores the value of PWD in ID file, we need to
> * force idutils to follow our style.
> */
> #if _WIN32 || __DJGPP__
478a479,481
> #else
> strbuf_sprintf(sb, "PWD=%s mkid --files0-from=-", quote_shell(cwd));
> #endif
Index: htags/htags.c
===================================================================
RCS file: /sources/global/global/htags/htags.c,v
retrieving revision 1.214
diff -r1.214 htags.c
1349c1349
< if (!getcwd(cwdpath, sizeof(cwdpath)))
---
> if (!vgetcwd(cwdpath, sizeof(cwdpath)))
1645c1645
< if (!getcwd(realpath, sizeof(realpath)))
---
> if (!vgetcwd(realpath, sizeof(realpath)))
Index: libutil/getdbpath.c
===================================================================
RCS file: /sources/global/global/libutil/getdbpath.c,v
retrieving revision 1.32
diff -r1.32 getdbpath.c
214c214
< if (!getcwd(cwd, MAXPATHLEN)) {
---
> if (!vgetcwd(cwd, MAXPATHLEN)) {
232,235c232,239
< if (realpath(p, root) == NULL) {
< snprintf(msg, sizeof(msg), "cannot get real path of '%s'.", p);
< gtags_dbpath_error = msg;
< return -1;
---
> if (getenv("GTAGSLOGICALPATH")) {
> strlimcpy(root, p, sizeof(root));
> } else {
> if (realpath(p, root) == NULL) {
> snprintf(msg, sizeof(msg), "cannot get real path of '%s'.", p);
> gtags_dbpath_error = msg;
> return -1;
> }
364a369,375
> void
> dump_dbpath(void)
> {
> fprintf(stderr, "db path: %s\n", dbpath);
> fprintf(stderr, "root path: %s\n", root);
> fprintf(stderr, "current directory: %s\n", cwd);
> }
Index: libutil/getdbpath.h
===================================================================
RCS file: /sources/global/global/libutil/getdbpath.h,v
retrieving revision 1.13
diff -r1.13 getdbpath.h
33a34
> void dump_dbpath(void);
Index: libutil/logging.c
===================================================================
RCS file: /sources/global/global/libutil/logging.c,v
retrieving revision 1.4
diff -r1.4 logging.c
31a32
> #include "path.h"
119c120
< if (getcwd(buf, sizeof(buf)))
---
> if (vgetcwd(buf, sizeof(buf)))
Index: libutil/path.c
===================================================================
RCS file: /sources/global/global/libutil/path.c,v
retrieving revision 1.23
diff -r1.23 path.c
2c2,3
<  * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2008, 2011
---
>  * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2008, 2011,
>  * 2014
31a33,35
> #ifdef STDC_HEADERS
> #include <stdlib.h>
> #endif
33a38,40
> #ifdef HAVE_UNISTD_H
> #include <unistd.h>
> #endif
241a249,265
> /**
>  * get the current directory
>  */
> char *
> vgetcwd(char *buf, size_t size) {
> char *p;
> if (getenv("GTAGSLOGICALPATH")) {
> if ((p = getenv("PWD")) != NULL) {
> strlimcpy(buf, p, size);
> return buf;
> }
> }
> if (getcwd(buf, size) != NULL)
> return buf;
> return NULL;
> }
Index: libutil/path.h
===================================================================
RCS file: /sources/global/global/libutil/path.h,v
retrieving revision 1.14
diff -r1.14 path.h
2c2
<  * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2008, 2011
---
>  * Copyright (c) 1997, 1998, 1999, 2000, 2001, 2008, 2011, 2014
47a48
> char *vgetcwd(char *, size_t);

-- 
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

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