-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support XDG base directory specification #2384
Conversation
|
||
return full_path; | ||
return combinePathAndFile(envval, path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should not fallback to /ctags
when the environment variable is not set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
I would like to introduce a fix for this important suggestion first.
I made a pull request for the fix. See #2385.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2384 +/- ##
=======================================
Coverage 86.25% 86.25%
=======================================
Files 176 176
Lines 35740 35738 -2
=======================================
- Hits 30828 30827 -1
+ Misses 4912 4911 -1 ☔ View full report in Codecov by Sentry. |
e0e0303
to
01951ed
Compare
01951ed
to
90ec955
Compare
… name combinePathAndFile takes two C strings. The first one PATH was used in an expression: path [strlen(path) - 1] . If PATH is an empty, this can cause a buffer overrun. This change adds a guard-condition for such processing. Inspired from the comment submitted by @itchyny in universal-ctags#2384.
Suggested by @itchyny in universal-ctags#2384. When $HOME is set but it is an empty string,
…PATH are empty Inspired from the comment submitted by @itchyny in universal-ctags#2384.
Suggested by @itchyny in universal-ctags#2384. When $HOME is set but it is an empty string,
…d file name combinePathAndFile takes two C strings. The first one PATH was used in an expression: path [strlen(path) - 1] . If PATH is an empty, this can cause a buffer overrun. This change adds a guard-condition for such processing. Inspired from the comment submitted by @itchyny in universal-ctags#2384.
…PATH are empty Inspired from the comment submitted by @itchyny in universal-ctags#2384.
So how we should do? A. this change is not compliant to the specification, therefore this pull request is just for discussion, not for merging. For A, I have no strong comment. Simply say, I don't want to take much time for this topic. I want a test case. I can give you hints for writing. Any way I would like to hear the basic direction, A or B. |
…DG base directory specification compliant
4e764b3
to
0fc197b
Compare
0fc197b
to
7f0c832
Compare
I added ~/.config/ctags fallback to follow the specification (I was just unconfident that I can write slash in .path). |
@@ -0,0 +1,12 @@ | |||
# Copyright: 2017 Masatake YAMATO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't write this script.
Thank you for adding the test case.
Does this violate the specification? or Is it acceptable in the specification? I would like you to add minimum code for satisfying the specification. |
No. It's just a note for users (including me) who is not used to the behavior of universal-ctags. I believe the current implementation is compliant to the spec. |
@@ -1,12 +1,10 @@ | |||
# Copyright: 2017 Masatake YAMATO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright notice is neeed, but is not mine.
@@ -1,11 +1,9 @@ | |||
# Copyright: 2017 Masatake YAMATO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright notice is neeed, but is not mine.
Thank you for updating. |
Looks reasonable to me. |
@majutsushi, thank you for veryfing. This pull request is mostly ready for merging. So I rearranged the commits in this pull request and made a new pull request. @itchyny, could you look into #2386? |
Merged via #2386. Thank you. |
This is a poc implementation for checking
$XDG_CONFIG_HOME
and loads the$XDG_CONFIG_HOME/ctags/*.ctags
(fixes #89). But yes, I know the current implementation is not compliant to the specification (when $XDG_CONFIG_HOME is empty or unset, it should fallback to ~/.config/ctags). Note that we still have to use the .ctags extension (can't use$XDG_CONFIG_HOME/ctags/config
) but is reasonable to split the config per languages.EDIT: Now the implementation is compliant to the XDG base directory specification (I believe).