-
Notifications
You must be signed in to change notification settings - Fork 824
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(wasi) Allow the =
sign in the environment variable value.
#1762
Conversation
Having `a=b` means that the environment variable key is `a`, and its value is `b`. Having `a=b=c` means that the key is `a` and its value is `b=c`. It's OK to get this, e.g. within a CGI context where values can hold strings such as `sec-ch-ua: "Chromium;v=86"` etc. See wasmerio#1708 for a longer explanation.
bors try |
Should |
Yeah, the validation step happens in the |
Maybe |
tryBuild succeeded: |
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.
Looks good! I think we can probably make a new test rather than removing one though
Since `env` contains a nul byte, it's better to get a lossy version of it. Moreover, it removes one more `unwrap`.
This patch keeps the env's key and value separate until the `build()` method is called. It allows to apply different validations resp. for the key and the value: Both must not contain a nul byte, but only the key cannot contain an equal sign. This patch also updates the test cases accordingly. Finally this patch updates the `envs` and `args` methods to reuse respectively `env` and `arg` to avoid code repetition.
The last patch keeps the env's key and value separate until the This patch also updates the test cases accordingly. Finally this patch updates the |
bors r+ |
1762: fix(wasi) Allow the `=` sign in the environment variable value. r=Hywan a=Hywan # Description Having `a=b` means that the environment variable key is `a`, and its value is `b`. Having `a=b=c` means that the key is `a` and its value is `b=c`. It's OK to get this, e.g. within a CGI context where values can hold strings such as `sec-ch-ua: "Chromium;v=86"` etc. See #1708 for a longer explanation. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Fixes #1708. Co-authored-by: Ivan Enderlin <[email protected]>
bors r- |
Canceled. |
bors r+ |
Build succeeded: |
2042: feat(cli) Improve environment variables parsing r=Hywan a=Hywan # Description This PR fixes #2028. In #1762 we have already improved environment variables syntax, but the same work must be done in the CLI crate. The following environment variables are considered incorrect: * `A`, no equal sign, * `A=`, value is missing, * `=A`, key is missing. The following environment variables are considered correct: * `A=B` with `A` for the name and `B` for the value, * `A=B=C` with `A` for the name and `B=C` for the value. The environment variable is trimmed before being parsed with [`str::trim`](https://doc.rust-lang.org/std/primitive.str.html#method.trim). This PR also adds tests for the `parse_envvar` function, which was missing. # Review - [x] Add a short description of the the change to the CHANGELOG.md file 2044: feat(c-api) Do not build C headers if the env var `DOCS_RS` exists r=Hywan a=Hywan # Description Fix #1954. According to https://docs.rs/about/builds, the `DOCS_RS` environment variable is set when the documentation is built from docs.rs. In this case, we must not build the C headers because it generates such error (see #1954 to learn more): > Unable to copy the generated C bindings: `Os { code: 30, kind: Other, message: "Read-only file system" }` # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Ivan Enderlin <[email protected]>
Description
Having
a=b
means that the environment variable key isa
, and itsvalue is
b
.Having
a=b=c
means that the key isa
and its value isb=c
.It's OK to get this, e.g. within a CGI context where values can hold
strings such as
sec-ch-ua: "Chromium;v=86"
etc. See#1708 for a longer
explanation.
Review
Fixes #1708.