-
Notifications
You must be signed in to change notification settings - Fork 1
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
File not readable #11
Comments
I remember doing some debugging in this area when the "is_dir" check was failing in file-explorer. I think the underlying cause was the two std from static linking situation we had at that time, but I'd double check that the data structures line up between libc and the 3DS/libctru's definition. |
Hmm, it looks to be an issue only present with |
Yes, the various FileSystems don’t have full support of the normal posix functions. It looks like having the |
Hmm, some of this is a bit surprising to me, since I have been working on a change for colored test output which uses the romfs to create I wonder what's different there vs the testing you've been doing. Perhaps the file size is relevant? In my case the file being opened is only 1462 bytes. Looking at the fn _from_path(path: &Path) -> Result<TermInfo, Error> {
let file = File::open(path).map_err(Error::IoError)?;
let mut reader = BufReader::new(file);
parse(&mut reader, false).map_err(Error::MalformedTerminfo)
} |
Welp, while it is great to have support for |
I'd like to take a look at this before we close out possibility of using std. The write issue shouldn't be a problem because it could just return an error when you try to open a file for writing (read only file systems already exist). |
I am looking into making a |
Ok, looks like
This effectively means that (unless you are a god Homebrew programmer) |
I wonder if we'll need to make libctru changes. At least it seems like they're still somewhat active, as there was a recent release. |
I bumped |
@ian-h-chamberlain could you make a working romfs example for |
Interesting... I started trying to extend the Edit: I think we might also need to reconsider the path scheme (or add OS-specific helpers), since I have noticed some weird behavior with Edit: seems like RedoxOS already uses a similar scheme (and has some support in |
Guessed so. It looks like a problem with “direct reading” functions that don’t have a buffer. We should find a way to get the filesize on romfs if |
Ok, I did a little more digging, and it seems like |
|
Yeah, all the device-specific callbacks are registered here I've made a little progress, I think there is an ABI mismatch somewhere on the // C:
{
st_dev = 0,
st_ino = 0,
st_mode = 16676,
st_nlink = 4,
st_uid = 0,
st_gid = 0,
st_rdev = 0,
st_size = 24,
st_atim = {
tv_sec = 1644690556,
tv_nsec = 0
},
st_mtim = {
tv_sec = 1644690556,
tv_nsec = 0
},
st_ctim = {
tv_sec = 1644690556,
tv_nsec = 0
},
st_blksize = 512,
st_blocks = 1,
st_spare4 = {0, 0}
}
// Rust:
libc::unix::newlib::stat {
st_dev: 0,
st_ino: 0,
st_mode: 16676,
st_nlink: 4,
st_uid: 0,
st_gid: 0,
st_rdev: 24,
st_size: 1644690556,
st_atime: 0,
st_spare1: 1644690556,
st_mtime: 0,
st_spare2: 1644690556,
st_ctime: 0,
st_spare3: 512,
st_blksize: 1,
st_blocks: 0,
st_spare4: [0, 0]
} Edit: That was it! I'll post relevant PRs to libc + std shortly... |
I was testing
path
andfs
for #6.Turns out, reading files is broken: doing so will result in a failed memory allocation. Looking into it it seems an issue with
fstat
, since it returns a wrongst_size
value (always 1644524307), which the RustFile
will then try to allocate into aVec
. That'd be about 1.67 GB of memory, so the system just dies.@ian-h-chamberlain @AzureMarker
The text was updated successfully, but these errors were encountered: