-
Notifications
You must be signed in to change notification settings - Fork 165
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
Make cached bundle files readonly #55
Make cached bundle files readonly #55
Conversation
- After moving new cache files to their final destination, set their permissions to have `readonly` set `true`. - This uses `fs::set_permissions` rather than the suggested ``fs::File::set_permissions`, because the latter would require the final file to be open. We cannot change the permissions on the tempfile in this way, because `mkstemp::TempFile` doesn't have the same `set_permissions` method. Close tectonic-typesetting#14
Looks great, thanks! Just a couple of requests:
In case of an error, the resulting output would then look like:
Or whatever. Without the chaining the user just gets "NFS error" (or whatever) which is harder to interpret.
Thanks. |
@pkgw I've worked on this, but I'm a bit hung up on the error chaining. (This is my first meaningful foray into Rust -- I'm somewhat out at sea.) In other places in the codebase where I see I can't seem to turn the result of a let mut perms = match fs::metadata(&final_path) {
Ok(p) => p,
Err(e) => {
return OpenResult::Err(
Err(e.into()).chain_err(
|| format!("could not read metadata of cache file {}",
final_path.display())
));
}
}
.permissions();
Can you give some guidance? Also, it looks like |
First of all, thanks for taking the plunge with working with Rust! I think it's a great language, but there is definitely a learning curve. I think that I just gave you the wrong advice at first. Does it work if you try If that doesn't work, let's just forget it — skip the |
I've been wanting to take some time to learn Rust for a while, but hadn't found a reason, so this project is really doing me some good! That doesn't work either, and gives me
It doesn't look like |
The message "the type of this value must be known in this context" makes me think that code might actually be correct, but that Rust's type inference needs help. This can usually be accomplished by using a temporary variable with an explicitly specified type ... but that's just getting ugly. I'll merge now and maybe worry about this later. Some of these operations might be easier if I got rid of the OpenResult type ... I've been thinking that maybe |
Refactor xetex_aatfont's dependencies
permissions to have
readonly
settrue
.fs::set_permissions
rather than the suggested``fs::File::set_permissions
, because the latter would require the final file to be open. We cannot change the permissions on the tempfile in this way, because
mkstemp::TempFile` doesn't have the same`set_permissions` method.
Close #14