Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUndocumented panics in std::process on unix for strings with interior nuls #30858
Comments
This comment has been minimized.
This comment has been minimized.
talchas
commented
Jan 12, 2016
|
This also occurs with arg(), but env() in fact doesn't panic /at all/ for \0 (just silently gives you an environ you probably don't intend), because of accidents of implementation, which seems very sketchy. |
This comment has been minimized.
This comment has been minimized.
|
Given that it's possible to delay the conversion until spawning, I think that is the leas surprising thing to do. The env vars can be checked at that point as well. |
This comment has been minimized.
This comment has been minimized.
|
That would also be similar to what happens if you attempt to create a file (playground):
prints
|
kamalmarhubi
referenced this issue
Jan 12, 2016
Closed
Setting process env vars with interior nuls leads to unexpected env for child #30862
This comment has been minimized.
This comment has been minimized.
I decided the behaviour with |
This comment has been minimized.
This comment has been minimized.
|
triage: I-nominated |
rust-highfive
added
the
I-nominated
label
Jan 14, 2016
alexcrichton
added
the
T-libs
label
Jan 14, 2016
This comment has been minimized.
This comment has been minimized.
|
I've got a patch in the works for this. |
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
added a commit
to kamalmarhubi/rust
that referenced
this issue
Jan 20, 2016
kamalmarhubi
referenced this issue
Jan 20, 2016
Merged
std: Properly handle interior NULs in std::process #31056
This comment has been minimized.
This comment has been minimized.
|
triage: P-medium The libs team discussed this in triage yesterday and the conclusion was that the defer-the-error strategy is fine for |
kamalmarhubi commentedJan 12, 2016
All the strings are taken as
AsRef<OsStr>and converted toCStringwith unwrapping: https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/process.rs#L83-L85An example for
Command::new(playground):The panic should be documented, or the conversion unwrap should be delayed until a call to one of the methods that start the process so that the error can be returned in a
Result.Version: