editorconfig / editorconfig-core-c

EditorConfig core library written in C (for use by plugins supporting EditorConfig parsing)
http://editorconfig.org
Other
302 stars 59 forks source link

Unexpected behavior on trailing slash #78

Open TheDaemoness opened 2 years ago

TheDaemoness commented 2 years ago

My intuition is that paths with trailing slashes should be treated the same as paths without them. I've written my EditorConfig core in Rust (which, at the time of writing, passes the full core test suite) to have this behavior.

This does not match EditorConfig Core C's behavior.

$ cat .editorconfig
root = true

[foo]
matched=true
$ editorconfig --version
EditorConfig C Core Version 0.12.5
$ editorconfig $PWD/foo
matched=true
$ editorconfig $PWD/foo/
$ ec4rs-parse $PWD/foo
matched=true
$ ec4rs-parse $PWD/foo/
matched=true
cxw42 commented 2 years ago

That is an interesting one. I recall that the C core assumes its inputs are fully canonicalized, which I don't think $PWD/foo/ is. I can't find a clear statement on the subject, but I did find some data: