Open scjung opened 1 year ago
Thanks for opening this bug report.
I don't think opam has the necessary code to parse commands so I've sent a message to @dbuenzli to see how we can leverage his code without pulling all the dependencies from bos
. Copying his code with the necessary acknowledgments would be a bit sad but that's an option.
@scjung https://github.com/ocaml/opam/pull/5492 should fix your issue. I can't promised it'll be merged soon but unless some other issues appear it should be merged before the final release of opam 2.2.0. In the meantime using this branch should be fine if you're ok with that.
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
Because OPAM splits OPAMFETCH value by spaces, the use-case below does not work as expected.
As you may see in the log,
"Authorization: token ..."
argument is parsed into seperate words.OPAM should tokenize OPAMFETCH value in the way shell tokenizes[1, 2], so that a quoted argument is parsed as a single string rather than separate words.
[1] https://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html [2] https://github.com/dbuenzli/bos/blob/master/src/bos_cmd.ml#L46-L112