summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-04-07 20:30:29 +0200
committerBram Moolenaar <Bram@vim.org>2017-04-07 20:30:29 +0200
commit9585a1655ba0d34ea88574617112093a9bd4f2e9 (patch)
tree58d24678949822d284164175e6b15b62fae66148
parent395b6bab33e5ed9a0377d7f140e98fd3ab682672 (diff)
downloadvim-git-9585a1655ba0d34ea88574617112093a9bd4f2e9.tar.gz
patch 8.0.0550: cannot parse some etags format tags filev8.0.0550
Problem: Some etags format tags file use 0x01, breaking the parsing. Solution: Use 0x02 for TAG_SEP. (James McCoy, closes #1614)
-rw-r--r--src/tag.c13
-rw-r--r--src/testdir/test_taglist.vim37
-rw-r--r--src/version.c2
3 files changed, 46 insertions, 6 deletions
diff --git a/src/tag.c b/src/tag.c
index e2795b805..d6d1df272 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -2355,18 +2355,19 @@ parse_line:
}
else
{
-#define TAG_SEP 0x01
+#define TAG_SEP 0x02
size_t tag_fname_len = STRLEN(tag_fname);
#ifdef FEAT_EMACS_TAGS
size_t ebuf_len = 0;
#endif
/* Save the tag in a buffer.
- * Use 0x01 to separate fields (Can't use NUL, because the
- * hash key is terminated by NUL).
- * Emacs tag: <mtt><tag_fname><0x01><ebuf><0x01><lbuf><NUL>
- * other tag: <mtt><tag_fname><0x01><0x01><lbuf><NUL>
- * without Emacs tags: <mtt><tag_fname><0x01><lbuf><NUL>
+ * Use 0x02 to separate fields (Can't use NUL because the
+ * hash key is terminated by NUL, or Ctrl_A because that is
+ * part of some Emacs tag files -- see parse_tag_line).
+ * Emacs tag: <mtt><tag_fname><0x02><ebuf><0x02><lbuf><NUL>
+ * other tag: <mtt><tag_fname><0x02><0x02><lbuf><NUL>
+ * without Emacs tags: <mtt><tag_fname><0x02><lbuf><NUL>
* Here <mtt> is the "mtt" value plus 1 to avoid NUL.
*/
len = (int)tag_fname_len + (int)STRLEN(lbuf) + 3;
diff --git a/src/testdir/test_taglist.vim b/src/testdir/test_taglist.vim
index b89b25eae..2d1557ebd 100644
--- a/src/testdir/test_taglist.vim
+++ b/src/testdir/test_taglist.vim
@@ -19,3 +19,40 @@ func Test_taglist()
bwipe
endfunc
+func Test_taglist_native_etags()
+ if !has('emacs_tags')
+ return
+ endif
+ call writefile([
+ \ "\x0c",
+ \ "src/os_unix.c,13491",
+ \ "set_signals(\x7f1335,32699",
+ \ "reset_signals(\x7f1407,34136",
+ \ ], 'Xtags')
+
+ set tags=Xtags
+
+ call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
+ \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
+
+ call delete('Xtags')
+endfunc
+
+func Test_taglist_ctags_etags()
+ if !has('emacs_tags')
+ return
+ endif
+ call writefile([
+ \ "\x0c",
+ \ "src/os_unix.c,13491",
+ \ "set_signals(void)\x7fset_signals\x011335,32699",
+ \ "reset_signals(void)\x7freset_signals\x011407,34136",
+ \ ], 'Xtags')
+
+ set tags=Xtags
+
+ call assert_equal([['set_signals', '1335,32699'], ['reset_signals', '1407,34136']],
+ \ map(taglist('set_signals'), {i, v -> [v.name, v.cmd]}))
+
+ call delete('Xtags')
+endfunc
diff --git a/src/version.c b/src/version.c
index 1ffb6556c..aba7a80f5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 550,
+/**/
549,
/**/
548,