-
Notifications
You must be signed in to change notification settings - Fork 365
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
lint: add errors about duplicated extra-files and checksums & when extra-file paths contains '..' #5561
Conversation
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.
Detection of ..
in paths needs foolproofing, but otherwise good :)
src/core/opamFilename.ml
Outdated
@@ -9,6 +9,10 @@ | |||
(* *) | |||
(**************************************************************************) | |||
|
|||
let might_escape path = | |||
List.exists (String.equal Filename.parent_dir_name) | |||
Re.(split (compile (str Filename.dir_sep)) 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 always struggle to understand Re
(and regular expressions in general) -- I understand that Filename.dir_sep is returning a string, and String.split_on_char expects a character to split on.
But since all known values of Filename.dir_sep are a single-character string, I'd go down that path.
(of course, this is just a minor thing, and please ignore if you're happy with regular expressions).
to me this looks great, thanks for your work on it; and your patience. |
src/core/opamFilename.ml
Outdated
let sep = | ||
match sep with | ||
| `Unix -> "/" | ||
| `Windows -> "\\" |
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.
are we sure all the /
in the given path have been replaced by \
at this point? If both are present then we should check for both on Windows given they are both valid path separators
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.
Updates windows with `/|' search
Should I split the PR ? it is quite big and there is several purposes (fix, new lint, update) |
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.
Should I split the PR ? it is quite big and there is several purposes (fix, new lint, update)
No i think it's fine. Although the PR title is not very descriptive and is a bit confusing.
What about:
lint: add errors about duplicated extra-files and checksums & when extra-file paths might point to a parent directory
To good PR titles would be: |
Adding test cases is a normal part of every PR so i don't think it should be part of the title. My contraction of checksums is in my opinion a compact way of talking about url and extra-source without mentioning them, and the update to W59 is pretty minor and i don't think it's worth mentioning in the title. |
e48ae8a
to
c5cca86
Compare
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.
aside from those minor typos and the remaining question about what the title of the PR should be (we can chat quickly about it at the weekly meeting), lgtm
…out url section It highlights that when no url is present, W37 is not triggered
…eral times for a given url in url section
…eral times for a given url in extra-sources section
* Shows the difference of behaviour between 'opam lint' and 'opam lint --check-upstream' * Add test cases for special cases: conf flag, url containing git url
… more tied to --check-upstream option
New lints:
Update:
More testcases:
/cc @hannesm @reynir