Re: htags fails agaisnt odd filename
Shigio YAMAGUCHI <[email protected]>
| Newsgroups | gmane.comp.gnu.global.bugs |
|---|---|
| Message-ID | <CADJmJYpVEc_LvZJfFz9B818_BbSfR0_DkuNymWnyzdrhjEnEtw@mail.gmail.com> |
Hi, I have made a patch for it. Would you please try this? Regards, Shigio 2016-02-23 13:34 GMT+09:00 KAICHO <[email protected]>: > Hi, > > This is just a small issue and it is easy to avoid by > removing/renaming the file which has odd filename. > > > What is your environment (OS)?: > CentOS 5.11(Linux x86_64) > > Which version of GLOBAL are you using?: > 6.5.2 > > What did you do? (command line) > # htags > > What did you expect from it? > exit without errors > > What was occurred? (as is) > # htags > sh: -c: line 0: unexpected EOF while looking for matching `'' > sh: -c: line 1: syntax error: unexpected end of file > htags: command failed in xargs_read(). > # > > This is caused by an file which has odd filename, includes > '\''(on Unix, probably '"' on Windows). htags fails with > the error above on the directory: > > # ls -al > total 28 > drwxr-xr-x 2 root root 4096 Feb 23 11:47 . > drwxr-xr-x 23 apache apache 20480 Feb 23 11:42 .. > -rw-r--r-- 1 root root 60 Feb 23 11:43 a'b.c > # > > To fix this, libutil/xargs.c needs to handle the > case that QUOTE is in filename, and escape them > if necessary. > > > Fortunately, gtags works fine even against these odd > filename. > > Regards, > KAICHO > > > _______________________________________________ > Bug-global mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/bug-global > -- Shigio YAMAGUCHI <[email protected]> PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3 _______________________________________________ Bug-global mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-global
xargs.patch
(application/octet-stream, 1.1 KB)
Index: libutil/xargs.c
===================================================================
RCS file: /sources/global/global/libutil/xargs.c,v
retrieving revision 1.22
diff -c -r1.22 xargs.c
*** libutil/xargs.c 22 Jun 2015 06:43:01 -0000 1.22
--- libutil/xargs.c 23 Feb 2016 06:12:42 -0000
***************
*** 27,32 ****
--- 27,33 ----
#include <limits.h>
#endif
+ #include "char.h"
#include "checkalloc.h"
#include "die.h"
#include "env.h"
***************
*** 142,152 ****
/**
* Common processing for each XARGS_XXXX type.
*/
- #ifdef _WIN32
- #define QUOTE '"'
- #else
- #define QUOTE '\''
- #endif
#define APPEND_ARGUMENT(p) {\
char *path = (p);\
length = strlen(path);\
--- 143,148 ----
***************
*** 167,175 ****
if (xp->verbose)\
xp->verbose(path + 2, xp->seqno, 0);\
strbuf_putc(comline, ' ');\
! strbuf_putc(comline, QUOTE);\
! strbuf_puts(comline, path);\
! strbuf_putc(comline, QUOTE);\
count++;\
}\
}
--- 163,169 ----
if (xp->verbose)\
xp->verbose(path + 2, xp->seqno, 0);\
strbuf_putc(comline, ' ');\
! strbuf_puts(comline, quote_shell(path));\
count++;\
}\
}