-
Notifications
You must be signed in to change notification settings - Fork 372
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
Fixes: Env var & delimiters, unversionned opam file pin, doc #3404
Conversation
src/core/opamJson.ml
Outdated
@@ -27,7 +27,8 @@ let adds_esc b s = | |||
match String.get s i with | |||
| '"' -> flush b start i; adds b "\\\""; loop next next | |||
| '\\' -> flush b start i; adds b "\\\\"; loop next next | |||
| '\x00' .. '\x1F' | '\x7F' (* US-ASCII control chars *) as c -> | |||
| '\x00' .. '\x1F' | '\x7F' (* US-ASCII control chars *) | |||
| '\x80' .. '\xFF' (* Extended ASCII chars *) as c -> |
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.
You can't do this here, this will break UTF-8 output. The module assumes strings are UTF-8 encoded.
Btw. could you please make one PR per issue you fix.
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.
Awesome, thanks! I'll trust you have checked the many corner-cases :)
src/client/opamPinCommand.ml
Outdated
OpamConsole.warning | ||
"Couldn't retrieve opam file from versionned source, \ | ||
using the one found locally."; | ||
Some local |
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 am wondering if the case when both are defined and different (Some local, Some vers when local <> vers
; or maybe when not (OpamFile.OPAM.effectively_equal local vers)
) would not deserve a warning too: "not using uncommitted version of opam file xxx".
But there is already the warning about uncommitted changes, so that might be redundant.
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 really think this "fix" muddies again the semantis of git
pins and should not be merged. I don't see a clear ux benefit in doing so.
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.
@AltGr It would be complementary: on update, uncommitted changes warning is shown, in pinning, uncommitted opam changes warning is shown.
Also on #3403 I wonder if there's really anything to fix. For me it works as expected, a |
@dbuenzli there was still a consistency problem, because then we shouldn't use the non-versionned |
Then why do you use the non-versionned With this the system becomes idiosyncratic to understand. Now if I have an |
See also #3408 I really think the way this is done too complicated and should be carefully reviewed (better, documented so that one can see if one can explains the behaviour in simple words, which will inform the design). I think the confusion by @bobbypriambodo in #3403 is a confusion due to a change in defaults (and it's right to be confused by a change in defaults), I don't think it's a confusion in expectations. |
I confirm this, it did throw me off because I remembered opam v1.2 worked that way. However I do agree with @dbuenzli that the behavior is consistent and reasonable. Perhaps it only warrants a documentation and/or a warning if opam cannot find an |
Indeed, it should be added in the new documentation. For the UX part, user is alerted by messages when uncommitted changes are discarded on upgrade, when an unversioned opam file is taken on pinning, when uncommitted opam file changes are discarded, etc. |
This PR closes #3391.
OpamStd.split_delim
implementation which had the same behaviour thanOpamStd.split
. Now they respectively keep & clean empty strings from the returned list.OpamStd.Sys.split_path_variable
, permiiting to retrieve a cleaned path or no.edit:
Fix # 3398: Escape json extended ascii characters