Skip to content
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

Fix parsing of OPAMFETCH (support quotes / proper POSIX shell syntax) #5492

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kit-ty-kate
Copy link
Member

Fixes #5490

@scjung
Copy link

scjung commented Mar 27, 2023

It works! Thanks for the fix 👍

Processing  1/3: [coreutil.1.70: http]
+ /usr/local/bin/wget "--header" "Authorization: token >>>redacted<<" "https://github.com/>>redacted<</coreutil/archive/refs/tags/v1.70.tar.gz" "-O" "/Users/mukka/.opam/5.0/.opam-switch/sources/coreutil.1.70/v1.70.tar.gz.part"
- --2023-03-27 09:18:43--  https://github.com/>>redacted<</coreutil/archive/refs/tags/v1.70.tar.gz
- Resolving github.com (github.com)... 20.200.245.247
- Connecting to github.com (github.com)|20.200.245.247|:443... connected.
- HTTP request sent, awaiting response... 302 Found

@@ -260,6 +260,12 @@ module List : sig
val fold_left_map: ('s -> 'a -> ('s * 'b)) -> 's -> 'a list -> 's * 'b list
end

module Char : sig

val is_whitespace : char -> bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about rather following what is being proposed upstream. That way, in a few years, you can likely simply delete the code. In other words:

module Char : sig 
  include Stdlib.Char
  module Ascii : sig 
    val is_white : char -> bool
  end
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I knew about the PR but I didn't use the same interface at the time for several reasons:

  • the two definitions are different (e.g. \v and \f are not handled by the opam definition but are with the stdlib one)
  • it wasn't merged at the time and we have a dedicated module for compatibility functions (https://github.com/ocaml/opam/blob/master/src/core/opamCompat.ml) so it would've felt a bit weird to have a yet-to-be-part-of-the-stdlib function in it
  • OpamStd isn't meant to be a mirror of the stdlib in terms of naming, OpamCompat is

Now that it has been merged i can think about it again although i personally feel like it would be better to wait for the release of 5.4 to change the function. In the meantime i'm happy to add a TODO comment to remind ourselves to change it when 5.4 is released.

@kit-ty-kate kit-ty-kate force-pushed the opamfetch-proper-cmd branch from 1e862b7 to 491fc0c Compare January 6, 2025 14:04
(* *)
(**************************************************************************)

val of_string : string -> string list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new module should be in its own commit.

(* *)
(**************************************************************************)

(* NOTE: Inspired from @dbuenzli's astring library *)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it worth adding an url ?

(* *)
(**************************************************************************)

val of_string : string -> string list
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to add a new module instead of adding it in OpamStd?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tokenize OPAMFETCH value properly, not splitting by whitespaces
4 participants