]> git.lizzy.rs Git - rust.git/commit
auto merge of #18870 : barosl/rust/os-ioresult, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 18 Nov 2014 21:56:58 +0000 (21:56 +0000)
committerbors <bors@rust-lang.org>
Tue, 18 Nov 2014 21:56:58 +0000 (21:56 +0000)
commit1628b98183bfec13e9407a905324dda047c3a550
tree5ee54e294253ede9ded10057e7d85f49142f259f
parentc8d6e3b2c2a780eff92299da5d1c02e081617088
parentb5286af703e33bd36744fe4cd5bb24f71dbb524e
auto merge of #18870 : barosl/rust/os-ioresult, r=alexcrichton

Make old-fashioned functions in the `std::os` module utilize `IoResult`.

I'm still investigating the possibility to include more functions in this pull request. Currently, it covers `getcwd()`, `make_absolute()`, and `change_dir()`. The issues covered by this PR are #16946 and #16315.

A few concerns:

- Should we provide `OsError` in distinction from `IoError`? I'm saying this because in Python, those two are distinguished. One advantage that we keep using `IoError` is that we can make the error cascade down other functions whose return type also includes `IoError`. An example of such functions is `std::io::TempDir::new_in()`, which uses `os::make_absolute()` as well as returns `IoResult<TempDir>`.
- `os::getcwd()` uses an internal buffer whose size is 2048 bytes, which is passed to `getcwd(3)`. There is no upper limitation of file paths in the POSIX standard, but typically it is set to 4096 bytes such as in Linux. Should we increase the buffer size? One thing that makes me nervous is that the size of 2048 bytes already seems a bit excessive, thinking that in normal cases, there would be no filenames that even exceeds 512 bytes.

Fixes #16946.
Fixes #16315.

Any ideas are welcomed. Thanks!