#606
Error messages replace virtual /tmp paths with <path>, and write errors always say "No such file or directory"
just-bash version
3.6.0
Reproduction
nl /tmp/t/missing.txttee /ro/f.txt <<< hi
sed -i 's/x/y/' /ro/f.txtHow you run it
The first script runs with new Bash({ files: { "/tmp/t/n.txt": "n\n" } }).
The second runs on a filesystem whose /ro refuses writes the way a read-only mount does:
import { Bash, InMemoryFs } from "just-bash";
class ReadOnlyBranch extends InMemoryFs {
async writeFile(path, ...rest) {
if (path.startsWith("/ro/")) {
throw Object.assign(new Error(`EROFS: read-only file system, open '${path}'`), { code: "EROFS" });
}
return super.writeFile(path, ...rest);
}
}
const bash = new Bash({ fs: new ReadOnlyBranch({ "/ro/f.txt": "x\n" }) });Expected behavior
nl: /tmp/t/missing.txt: No such file or directoryhi
tee: /ro/f.txt: Read-only file systemand an error from sed -i that says the file system is read-only.
Actual behavior
nl: ENOENT: no such file or directory, open '<path>'hi
tee: /ro/f.txt: No such file or directory
sed: /ro/f.txt: No such file or directoryTwo things here:
<path>. It comes from the host-path sanitizer. That makes sense forOverlayFs/ReadWriteFs, where a message could leak a real host path. WithInMemoryFsor a customIFileSystem, though,/tmp/t/missing.txtis the script's own virtual path, and hiding it makes the message useless. Maybe sanitize only paths that come from a host-backed filesystem, or let embedders turn it off?- Write errors. This is the write-side version of #570:
teeandsed -iprint "No such file or directory" whatever the error was, so a read-only file looks like a missing one.
Environment
- Runtime (Node, Bun, browser, CLI): Node
- Runtime version: 26.8.2
- Operating system: macOS 15
- Bundler or framework, when relevant: none
Activity
0No activity yet.