Open eds-collabora opened 12 months ago
if it's any help, your example script works fine for me when run from /scratch
(default working directory) but breaks when ran from /build
(mounted directory):
$ fakemachine -v $(pwd):/build
Running /bin/bash using kvm backend
bash-5.2# pwd
/scratch
bash-5.2# python3 /build/test.py
bash-5.2# cd /build/
bash-5.2# python3 test.py
Traceback (most recent call last):
File "/build/test.py", line 6, in <module>
os.ftruncate(tmp_obj.fileno(), 1024)
FileNotFoundError: [Errno 2] No such file or directory
Yeah the problem seems to be that the 9pfs doesn't seem to support truncating an unlinked file; from strace:
openat(AT_FDCWD, "/t/tmpty_rb8zv", O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW|O_CLOEXEC, 0600) = 3
unlink("/t/tmpty_rb8zv") = 0
ioctl(3, FIOCLEX) = 0
newfstatat(3, "", {st_mode=S_IFREG|0600, st_size=0, ...}, AT_EMPTY_PATH) = 0
ioctl(3, TCGETS, 0x7ffd6d4abfd0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_CUR) = 0
ftruncate(3, 1024) = -1 ENOENT (No such file or directory)
Which is annoying but not much fakemaching can do about it; Which is why it fails in the mounted directory (9pfs) but works on e.g. /scratch
fwiw doing a ugly hacky test with virtiofs shows some performance improvements and does fix this issue (see an ugly first hack in e74e487ab2e7f91cfcb066817c9afc8ed85b9a5c )
The failing stacktrace in
bmaptool create
starts withos.ftruncate
which fails with "No such file or directory".Here's a python script which reproduces the issue:
Put this script somewhere (mine is in my home directory). From there, to reproduce:
The output I see in fakemachine:
In the docker container I get no output:
Nor on the actual bare metal machine: