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

rustuv: Handle short writes in uv_fs_write #13133

Merged
merged 1 commit into from
Mar 26, 2014

Conversation

alexcrichton
Copy link
Member

The libuv fs wrappers are very thin wrappers around the syscalls they correspond
to, and a notable worrisome case is the write syscall. This syscall is not
guaranteed to write the entire buffer provided, so we may have to continue
calling uv_fs_write if a short write occurs.

Closes #13130

The libuv fs wrappers are very thin wrappers around the syscalls they correspond
to, and a notable worrisome case is the write syscall. This syscall is not
guaranteed to write the entire buffer provided, so we may have to continue
calling uv_fs_write if a short write occurs.

Closes rust-lang#13130
@alexcrichton
Copy link
Member Author

Note that I have not added a test because writing a >2GB file takes quite awhile. I have, however, manually verified that this program works:

extern crate green;
extern crate rustuv;

use std::io::File;

#[start]
fn start(argc: int, argv: **u8) -> int {
    green::start(argc, argv, main)
}

fn main() {
    let mut f = File::create(&Path::new("test"));

    println!("allocating");
    let mut vec = Vec::with_capacity(1 << 32);
    unsafe { vec.set_len(1 << 32); }
    println!("writing");
    println!("{}", f.write(vec.as_slice()));
    println!("closing");
    drop(f);
    println!("stat");

    let a = Path::new("test").stat().unwrap();
    assert_eq!(a.size, 1 << 32);
}

@alexcrichton
Copy link
Member Author

Now that joyent/libuv#1215 has been opened, this may want to wait for more comments there. This only handles short writes, it does not handle interrupted writes.

bors added a commit that referenced this pull request Mar 26, 2014
The libuv fs wrappers are very thin wrappers around the syscalls they correspond
to, and a notable worrisome case is the write syscall. This syscall is not
guaranteed to write the entire buffer provided, so we may have to continue
calling uv_fs_write if a short write occurs.

Closes #13130
@bors bors closed this Mar 26, 2014
@bors bors merged commit 5fddb42 into rust-lang:master Mar 26, 2014
@alexcrichton alexcrichton deleted the issue-13130 branch March 26, 2014 17:22
JohnTitor pushed a commit to JohnTitor/rust that referenced this pull request Aug 30, 2022
Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes rust-lang/rust-analyzer#13130
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 25, 2024
…=Alexendoo

Lintcheck: Cleanup of Lintcheck's CI summery

This PR makes three changes to lintcheck's job summary:
* Adds links to the *Added*, *Removed*, *Changed* sections
* Added the crate name to the warning info
* Removes empty lines from the rendered output

This is what the new output roughly looks like:

![image](https://github.com/user-attachments/assets/3faae0a6-e5ee-4e70-9d4d-d19b18dc6a3a)
![image](https://github.com/user-attachments/assets/028c3a92-98dc-4e00-b7bb-fecf9450f5b1)

[:framed_picture: Old Output :framed_picture:](https://github.com/xFrednet/rust-clippy/actions/runs/10019681444)

[:framed_picture: New Output :framed_picture:](https://github.com/xFrednet/rust-clippy/actions/runs/10019598141)

The links for the sections are a bit weird as you have to click on them twice. I believe this is a bug from GH's side. But it works reasonably well :D

---

changelog: none

r? `@Alexendoo`
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.

libgreen/rustuv cant write huge files
3 participants