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

Add test for quoted Env variables passed with BINDGEN_EXTRA_CLANG_ARGS. #2727

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

darnuria
Copy link
Contributor

@darnuria darnuria commented Jan 22, 2024

Before the test was too broad and just tested for existence of the variable. With this test we can ensure that quoting was indeed managed.

Context: I don't know if it's mandatory to check this kind of shell quoting detail, but wandering the code due to the shlex advisory I found this case not covered so I submit a patch!

It's used here:

rg -C 5 shlex
[...[
bindgen/lib.rs
308-        Some(s) => s,
309-    };
310-
311-    // Try to parse it with shell quoting. If we fail, make it one single big argument.
312:    if let Some(strings) = shlex::split(&extra_clang_args) {
313-        return strings;
314-    }
315-    vec![extra_clang_args]
316-}

Edited: has some not commited stuff in the rg cmd

Before the test was too broad and just tested for the definition of the variable.
With this test we can ensure that quoting was indeed managed.

Signed-off-by: Axel Viala <[email protected]>
@emilio emilio merged commit ee94c43 into rust-lang:main Jan 31, 2024
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants