You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If an empty file is created by a command, FS.read_file returns null instead of empty Uint8Array. Empty files created by create_file doesn't have this issue.
This happens because of this line in get_data, but I don't know if it can be changed to return new Uint8Array. There is similar code in get_buffer, which also claims to @return {!Promise<Uint8Array>}.
How to reproduce: execute command touch /mnt/f in the following VM, then press read f button. Result: null is printed to js console.
<!doctype html><scriptsrc="../build/libv86.js"></script><script>onload=function(){emulator=newV86Starter({wasm_path: "../build/v86.wasm",bios: {url: "../bios/seabios.bin"},vga_bios: {url: "../bios/vgabios.bin"},bzimage: {url: "../images/buildroot-bzimage.bin"},filesystem: {},screen_container: screen_container,autostart: true});}asyncfunctionread_f(){letdata=awaitemulator.fs9p.read_file("f");console.log(data);}</script><!-- A minimal structure for the ScreenAdapter defined in browser/screen.js --><divid=screen_container><divstyle="white-space: pre; font: 14px monospace"></div><canvas></canvas></div><buttononclick="read_f()">read f</button>
The text was updated successfully, but these errors were encountered:
This happens because of this line in get_data, but I don't know if it can be changed to return new Uint8Array. There is similar code in get_buffer, which also claims to @return {!Promise}.
I don't think it can be changed to return new Uint8Array, since that would be returned for non-existing files. Rather, CreateFile should ensure that inodedata is set (similar Linux's behavious, where close(open(..., O_CREAT)) creates an empty file).
If an empty file is created by a command,
FS.read_file
returnsnull
instead of emptyUint8Array
. Empty files created bycreate_file
doesn't have this issue.This happens because of this line in
get_data
, but I don't know if it can be changed toreturn new Uint8Array
. There is similar code inget_buffer
, which also claims to@return {!Promise<Uint8Array>}
.How to reproduce: execute command
touch /mnt/f
in the following VM, then pressread f
button. Result:null
is printed to js console.The text was updated successfully, but these errors were encountered: