libnfs icon indicating copy to clipboard operation
libnfs copied to clipboard

nfs_read() is broken due to commits 0290481 and d9c53cd

Open ITotalJustice opened this issue 3 months ago • 3 comments

prior to those commits, calling nfs_read in a loop with nfs_get_readmax as the max read size would function as expected. However, something broke in those commits where calling a read with nfs_get_readmax will return the wrong data. I noticed that doing const auto read_max = nfs_get_readmax() - 1; seems to fix it. So it seems that using nfs_get_readmax or greater triggers the bug. The result returned by nfs_read is correct however, indicating it has read the data.

I had a quick look and managed to fix it here https://github.com/ITotalJustice/libnfs/commit/e7013f3d532ef068f0e1913e81324c33602ca5a6. However this only fixes reading <= nfs_get_readmax(), so reads greater than that will still return garbage. I haven't looked into this yet.

ITotalJustice avatar Sep 03 '25 12:09 ITotalJustice

Thanks. I will try to fix this in the next few days.

sahlberg avatar Sep 15 '25 22:09 sahlberg

I am having difficulty to reprodue on current master. Can you show me a small snippet of the code you use when reading to trigger this?

sahlberg avatar Sep 18 '25 22:09 sahlberg

Do you have a small reproducer? I can not reproduce the issue here and reading >> nfs_get_readmax() returns the correct data in my tests.

sahlberg avatar Oct 01 '25 08:10 sahlberg