having put more thought into this, i'm not sure if this is actually
buggy behavior, since the permissions are not actually used until after
the file is successfully opened, and they're just copied across to the
new file. i don't really see where the potential unexpected behavior
lies here. ~illiliti's point about the permissions being filtered
through umask is relevant though and can be fixed i think.
alternatively, if there is in fact a bug here, fixing this will require
an uncomfortably large refactor of fs:: and io::, since fstat would
probably want to be io::stat since it deals with file descriptors, but
it relies on fs::filestat, which can't be used by io since fs relies on
io already, so it might need to move to io::filestat which feels wrong.
there's a big tangled can of worms here that i don't want to get into tbqh.