make vm-build-freebsd fixes
cover make vm-build-freebsd fixes
Hi,
I needed to verify that my qemu-user changes didn't break BSD, and Daniel Berrange suggested vm-build-freebsd on IRC. I had several problems with it, which this series resolves.
Best regards,
Ilya
Ilya Leoshkevich (3):
tests/vm: Set UseDNS=no in the sshd configuration tests/vm/freebsd: Reload the sshd configuration
meson: Disable CONFIG_NOTIFY1 on FreeBSD
meson.build | 1 + tests/vm/basevm.py | 2 ++ tests/vm/freebsd | 2 ++ 3 files changed, 5 insertions(+)
Signature · 1 line
2.43.0
PATCH 1/3 tests/vm: Set UseDNS=no in the sshd configuration
make vm-build-freebsd sometimes fails with "Connection timed out during banner exchange". The client strace shows:
13:59:30 write(3, "SSH-2.0-OpenSSH_9.3\r\n", 21) = 21
13:59:30 getpid() = 252655
13:59:30 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}])
13:59:32 read(3, "S", 1) = 1
13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
13:59:32 read(3, "S", 1) = 1
13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}])
13:59:32 read(3, "H", 1) = 1There is a 2s delay during connection, and ConnectTimeout is set to 1. Raising it makes the issue go away, but we can do better. The server truss shows:
888: 27.811414714 socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) = 5 (0x5)
888: 27.811765030 connect(5,{ AF_INET 10.0.2.3:53 },16) = 0 (0x0)
888: 27.812166941 sendto(5,"\^Z/\^A\0\0\^A\0\0\0\0\0\0\^A2"...,39,0,NULL,0) = 39 (0x27)
888: 29.363970743 poll({ 5/POLLRDNORM },1,5000) = 1 (0x1)So the delay is due to a DNS query. Disable DNS queries in the server config.
--- tests/vm/basevm.py | 2 ++ 1 file changed, 2 insertions(+)
tests/vm/basevm.py +2 -0
@@ -423,6 +423,8 @@ def console_ssh_init(self, prompt, user, pw): def console_sshd_config(self, prompt): self.console_wait(prompt) self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n") + self.console_wait(prompt) + self.console_send("echo 'UseDNS no' >> /etc/ssh/sshd_config\n") for var in self.envvars: self.console_wait(prompt) self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)
Signature · 1 line
2.43.0
Re: [PATCH 1/3] tests/vm: Set UseDNS=no in the sshd configuration
Quoted 34 lines · Ilya Leoshkevich
make vm-build-freebsd sometimes fails with "Connection timed out during banner exchange". The client strace shows:
13:59:30 write(3, "SSH-2.0-OpenSSH_9.3\r\n", 21) = 21 13:59:30 getpid() = 252655 13:59:30 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}]) 13:59:32 read(3, "S", 1) = 1 13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}]) 13:59:32 read(3, "S", 1) = 1 13:59:32 poll([{fd=3, events=POLLIN}], 1, 3625) = 1 ([{fd=3, revents=POLLIN}]) 13:59:32 read(3, "H", 1) = 1There is a 2s delay during connection, and ConnectTimeout is set to 1. Raising it makes the issue go away, but we can do better. The server truss shows:
888: 27.811414714 socket(PF_INET,SOCK_DGRAM|SOCK_CLOEXEC,0) = 5 (0x5) 888: 27.811765030 connect(5,{ AF_INET 10.0.2.3:53 },16) = 0 (0x0) 888: 27.812166941 sendto(5,"\^Z/\^A\0\0\^A\0\0\0\0\0\0\^A2"...,39,0,NULL,0) = 39 (0x27) 888: 29.363970743 poll({ 5/POLLRDNORM },1,5000) = 1 (0x1)So the delay is due to a DNS query. Disable DNS queries in the server config.
Signed-off-by Ilya Leoshkevich <[email protected]>--- tests/vm/basevm.py | 2 ++ 1 file changed, 2 insertions(+)tests/vm/basevm.py +0
-0
tests/vm/basevm.py def console_ssh_init(self, prompt, user, pw): · line 430
Quoted 8 lines
tests/vm/basevm.py +2
-0@@ -423,6 +423,8 @@ def console_ssh_init(self, prompt, user, pw): def console_sshd_config(self, prompt): self.console_wait(prompt) self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n") + self.console_wait(prompt) + self.console_send("echo 'UseDNS no' >> /etc/ssh/sshd_config\n") for var in self.envvars: self.console_wait(prompt) self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)
PATCH 2/3 tests/vm/freebsd: Reload the sshd configuration
In reply to Ilya LeoshkevichAfter console_sshd_config(), the SSH server needs to be nudged to pick up the new configs. The scripts for the other BSD flavors already do this with a reboot, but a simple reload is sufficient.
--- tests/vm/freebsd | 2 ++ 1 file changed, 2 insertions(+)
tests/vm/freebsd +2 -0
@@ -108,6 +108,8 @@ class FreeBSDVM(basevm.BaseVM): prompt = "root@freebsd:~ #" self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) + self.console_wait(prompt) + self.console_send("service sshd reload\n") # setup virtio-blk #1 (tarfile) self.console_wait(prompt)
Signature · 1 line
2.43.0
Re: [PATCH 2/3] tests/vm/freebsd: Reload the sshd configuration
Quoted 14 lines · Ilya Leoshkevich
After
console_sshd_config(), the SSH server needs to be nudged to pick up the new configs. The scripts for the other BSD flavors already do this with a reboot, but a simple reload is sufficient.Signed-off-by Ilya Leoshkevich <[email protected]>--- tests/vm/freebsd | 2 ++ 1 file changed, 2 insertions(+)tests/vm/freebsd +0
-0
tests/vm/freebsd class FreeBSDVM(basevm.BaseVM): · line 112
Quoted 5 lines
tests/vm/freebsd +2
-0@@ -108,6 +108,8 @@ class FreeBSDVM(basevm.BaseVM): prompt = "root@freebsd:~ #" self.console_ssh_init(prompt, "root", self._config["root_pass"]) self.console_sshd_config(prompt) + self.console_wait(prompt) + self.console_send("service sshd reload\n")
Could be simplified to:
self.console_wait_send(prompt, "service sshd reload\n")
Thomas
PATCH 3/3 meson: Disable CONFIG_NOTIFY1 on FreeBSD
In reply to Ilya Leoshkevichmake vm-build-freebsd fails with:
ld: error: undefined symbol: inotify_init1
>>> referenced by filemonitor-inotify.c:183 (../src/util/filemonitor-inotify.c:183)
>>> util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive libqemuutil.a
On FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor
Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt -> /tmp/test-util-filemonitor-K13LI2/two.txt
Event id=200000000 event=2 file=one.txt
Queue event id 200000000 event 2 file one.txt
Queue event id 100000000 event 2 file two.txt
Queue event id 100000002 event 2 file two.txt
Queue event id 100000000 event 0 file two.txt
Queue event id 100000002 event 0 file two.txt
Event id=100000000 event=0 file=two.txt
Expected event 0 but got 2FreeBSD itself disables this functionality in the respective port [1]. So do it upstream too.
--- meson.build | 1 + 1 file changed, 1 insertion(+)
meson.build +1 -0
@@ -2403,6 +2403,7 @@ config_host_data.set('CONFIG_GETRANDOM', config_host_data.set('CONFIG_INOTIFY', cc.has_header_symbol('sys/inotify.h', 'inotify_init')) config_host_data.set('CONFIG_INOTIFY1', + host_os != 'freebsd' and cc.has_header_symbol('sys/inotify.h', 'inotify_init1')) config_host_data.set('CONFIG_PRCTL_PR_SET_TIMERSLACK', cc.has_header_symbol('sys/prctl.h', 'PR_SET_TIMERSLACK'))
Signature · 1 line
2.43.0
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Quoted 36 lines · Ilya Leoshkevich
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183 (../src/util/filemonitor-inotify.c:183)
>>> util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive libqemuutil.aOn FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt -> /tmp/test-util-filemonitor-K13LI2/two.txt Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2FreeBSD itself disables this functionality in the respective port [1]. So do it upstream too.
Signed-off-by Ilya Leoshkevich <[email protected]>--- meson.build | 1 + 1 file changed, 1 insertion(+)meson.build +0
-0
meson.build config_host_data.set('CONFIG_GETRANDOM', · line 2409
Quoted 7 lines
meson.build +1
-0@@ -2403,6 +2403,7 @@ config_host_data.set('CONFIG_GETRANDOM', config_host_data.set('CONFIG_INOTIFY', cc.has_header_symbol('sys/inotify.h', 'inotify_init')) config_host_data.set('CONFIG_INOTIFY1', + host_os != 'freebsd' and cc.has_header_symbol('sys/inotify.h', 'inotify_init1')) config_host_data.set('CONFIG_PRCTL_PR_SET_TIMERSLACK', cc.has_header_symbol('sys/prctl.h', 'PR_SET_TIMERSLACK'))
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
In reply to Ilya LeoshkevichHi,
Warner, do you remember what this is about?
(https://cgit.freebsd.org/ports/commit/emulators/qemu-devel/files/patch-util_meson.build?id=2ab482e2c8f51eae7ffd747685b7f181fe1b3809 isn't very verbose).
Quoted 10 lines · Ilya Leoshkevich
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183 (../src/util/filemonitor-inotify.c:183)
>>> util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive libqemuutil.aOn FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
Quoted 10 lines
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor
Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt -> /tmp/test-util-filemonitor-K13LI2/two.txt
Event id=200000000 event=2 file=one.txt
Queue event id 200000000 event 2 file one.txt
Queue event id 100000000 event 2 file two.txt
Queue event id 100000002 event 2 file two.txt
Queue event id 100000000 event 0 file two.txt
Queue event id 100000002 event 0 file two.txt
Event id=100000000 event=0 file=two.txt
Expected event 0 but got 2Wouldn't it be better to use a runtime check in qemu_file_monitor_new()?
Quoted 22 lines
FreeBSD itself disables this functionality in the respective port [1]. So do it upstream too.
Signed-off-by Ilya Leoshkevich <[email protected]>--- meson.build | 1 + 1 file changed, 1 insertion(+)meson.build +1
-0@@ -2403,6 +2403,7 @@ config_host_data.set('CONFIG_GETRANDOM', config_host_data.set('CONFIG_INOTIFY', cc.has_header_symbol('sys/inotify.h', 'inotify_init')) config_host_data.set('CONFIG_INOTIFY1', + host_os != 'freebsd' and cc.has_header_symbol('sys/inotify.h', 'inotify_init1')) config_host_data.set('CONFIG_PRCTL_PR_SET_TIMERSLACK', cc.has_header_symbol('sys/prctl.h', 'PR_SET_TIMERSLACK'))
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Quoted 6 lines · Philippe Mathieu-Daudé
Hi,
Warner, do you remember what this is about?
(https://cgit.freebsd.org/ports/commit/emulators/qemu-devel/files/patch-util_meson.build?id=2ab482e2c8f51eae7ffd747685b7f181fe1b3809
isn't very verbose).
That's simply going to workaround our incomplete feature check. We look for sys/inotify.h and if present, we assume that is in the C library. That's true on Linux, but not true on *BSD, hence the undefined symbol.
We need to augment the header file check with a linker symbol check for the C library.
If we wanted to also check for -linotify that'd make it portable to BSD, but not the behaviour difference mentioned below.
Quoted 12 lines · Ilya Leoshkevich
Quoted 10 lines
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183 (../src/util/filemonitor-inotify.c:183)
>>> util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive libqemuutil.aOn FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
Quoted 10 lines
Quoted 10 lines
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt -> /tmp/test-util-filemonitor-K13LI2/two.txt Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2
Interesting. So In the "Rename" test, the destination already exists.
BSD is thus reporting that 'two.txt' is deleted, before being (re)created Linux is only reporting 'two.txt' is created.
I don't think we can easily paper over this difference. The easiest is probably to conditionalize the test
git diff
tests/unit/test-util-filemonitor.c +8 -0
@@ -281,6 +281,14 @@ test_file_monitor_events(void) { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "one.txt", .watchid = &watch1, .eventid = QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__ + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch0, + .eventid = QFILE_MONITOR_EVENT_DELETED }, + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch2, + .eventid = QFILE_MONITOR_EVENT_DELETED }, +#endif { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "two.txt", .watchid = &watch0, .eventid = QFILE_MONITOR_EVENT_CREATED },
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Quoted 68 lines · Daniel P. Berrangé
Quoted 5 lines · Philippe Mathieu-Daudé
Hi,
Warner, do you remember what this is about?
(
Quoted 1 line
isn't very verbose).
That's simply going to workaround our incomplete feature check. We look for
sys/inotify.hand if present, we assume that is in the C library. That's true on Linux, but not true on *BSD, hence the undefined symbol.We need to augment the header file check with a linker symbol check for the C library.
If we wanted to also check for -linotify that'd make it portable to BSD, but not the behaviour difference mentioned below.
Quoted 6 lines · Ilya Leoshkevich
Quoted 4 lines
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183(
../src/util/filemonitor-inotify.c:183)Quoted 1 line
Quoted 1 line
>>>util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive
libqemuutil.aQuoted 7 lines
Quoted 7 lines
On FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt ->
/tmp/test-util-filemonitor-K13LI2/two.txtQuoted 8 lines
Quoted 8 lines
Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2
Interesting. So In the "Rename" test, the destination already exists.
BSD is thus reporting that 'two.txt' is deleted, before being (re)created Linux is only reporting 'two.txt' is created.
I don't think we can easily paper over this difference. The easiest is probably to conditionalize the test
git diff
tests/unit/test-util-filemonitor.c +1
-0@@ -281,6 +281,14 @@ test_file_monitor_events(void) { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "one.txt", .watchid = &watch1, .eventid = QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__
tests/unit/test-util-filemonitor.c test_file_monitor_events(void) · line 294
Quoted 10 lines
tests/unit/test-util-filemonitor.c +7
-0+ { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch0, + .eventid = QFILE_MONITOR_EVENT_DELETED }, + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch2, + .eventid = QFILE_MONITOR_EVENT_DELETED }, +#endif { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "two.txt", .watchid = &watch0, .eventid = QFILE_MONITOR_EVENT_CREATED },
I agree this is likely the best course of action. Has anybody filed a bug at https://bugs.freebsd.org?
Warner
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Quoted 76 lines · Warner Losh
Quoted 73 lines · Daniel P. Berrangé
Quoted 5 lines · Philippe Mathieu-Daudé
Hi,
Warner, do you remember what this is about?
(
Quoted 1 line
isn't very verbose).
That's simply going to workaround our incomplete feature check. We look for
sys/inotify.hand if present, we assume that is in the C library. That's true on Linux, but not true on *BSD, hence the undefined symbol.We need to augment the header file check with a linker symbol check for the C library.
If we wanted to also check for -linotify that'd make it portable to BSD, but not the behaviour difference mentioned below.
Quoted 6 lines · Ilya Leoshkevich
Quoted 4 lines
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183(
../src/util/filemonitor-inotify.c:183)Quoted 1 line
Quoted 1 line
>>>util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive
libqemuutil.aQuoted 7 lines
Quoted 7 lines
On FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt ->
/tmp/test-util-filemonitor-K13LI2/two.txtQuoted 8 lines
Quoted 8 lines
Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2
Interesting. So In the "Rename" test, the destination already exists.
BSD is thus reporting that 'two.txt' is deleted, before being (re)created Linux is only reporting 'two.txt' is created.
I don't think we can easily paper over this difference. The easiest is probably to conditionalize the test
git diff
tests/unit/test-util-filemonitor.c +7
-0@@ -281,6 +281,14 @@ test_file_monitor_events(void) { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "one.txt", .watchid = &watch1, .eventid = QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__ + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch0, + .eventid = QFILE_MONITOR_EVENT_DELETED }, + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch2, + .eventid = QFILE_MONITOR_EVENT_DELETED },
Quoted 8 lines
tests/unit/test-util-filemonitor.c test_file_monitor_events(void) · line 294
Quoted 5 lines
tests/unit/test-util-filemonitor.c +1
-0+#endif { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "two.txt", .watchid = &watch0, .eventid = QFILE_MONITOR_EVENT_CREATED },I agree this is likely the best course of action. Has anybody filed a bug at https://bugs.freebsd.org?
I've not, and I'm not even sure I would class it a FreeBSD bug. Other than the fact that it differs from Linux behaviour, it feels like it is reasonble semantics to emit a 'delete' event in this scenario so that an event consumer can detect replacement of an existing file.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Quoted 96 lines · Daniel P. Berrangé
Quoted 86 lines · Warner Losh
Quoted 82 lines · Daniel P. Berrangé
Quoted 5 lines · Philippe Mathieu-Daudé
Hi,
Warner, do you remember what this is about?
(
Quoted 1 line
isn't very verbose).
That's simply going to workaround our incomplete feature check. We look for
sys/inotify.hand if present, we assume that is in the C library. That's true on Linux, but not true on *BSD, hence the undefined symbol.We need to augment the header file check with a linker symbol check for the C library.
If we wanted to also check for -linotify that'd make it portable to BSD, but not the behaviour difference mentioned below.
Quoted 6 lines · Ilya Leoshkevich
Quoted 4 lines
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183(
../src/util/filemonitor-inotify.c:183)Quoted 1 line
Quoted 1 line
>>>
util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive libqemuutil.a
Quoted 11 lines
Quoted 11 lines
On FreeBSD inotify functions are defined in libinotify.so, so it might
be tempting to add it to the dependencies. Doing so, however, reveals
that this library handles rename events differently from Linux:$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util- filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt ->
/tmp/test-util-filemonitor-K13LI2/two.txtQuoted 8 lines
Quoted 8 lines
Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2
Interesting. So In the "Rename" test, the destination already exists.
BSD is thus reporting that 'two.txt' is deleted, before being (re)created
Linux is only reporting 'two.txt' is created.I don't think we can easily paper over this difference. The easiest is
probably to conditionalize the testgit diff
tests/unit/test-util-filemonitor.c +8
-0@@ -281,6 +281,14 @@ test_file_monitor_events(void) { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "one.txt", .watchid = &watch1, .eventid = QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__ + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch0, + .eventid = QFILE_MONITOR_EVENT_DELETED }, + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch2, + .eventid = QFILE_MONITOR_EVENT_DELETED }, +#endifQuoted 8 lines
tests/unit/test-util-filemonitor.c test_file_monitor_events(void) · line 294
Quoted 4 lines
tests/unit/test-util-filemonitor.c +0
-0{ .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "two.txt", .watchid = &watch0, .eventid = QFILE_MONITOR_EVENT_CREATED },I agree this is likely the best course of action. Has anybody filed a bug
at https://bugs.freebsd.org?
Quoted 7 lines
I've not, and I'm not even sure I would class it a FreeBSD bug. Other than the fact that it differs from Linux behaviour, it feels like it is reasonble semantics to emit a 'delete' event in this scenario so that an event consumer can detect replacement of an existing file.
With regards,
Daniel
Sounds reasonable; I will send a v2 with the meson adjustments and with the test fix.
Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
In reply to Daniel P. BerrangéQuoted 66 lines · Daniel P. Berrangé
Quoted 4 lines · Warner Losh
Quoted 1 line · Daniel P. Berrangé
On Wed, Jan 31, 2024 at 05:24:10PM +0100, Philippe Mathieu-Daudé wrote:
[... snip ...]
Quoted 51 lines
Quoted 51 lines
Quoted 5 lines · Ilya Leoshkevich
Quoted 4 lines
make vm-build-freebsd fails with:
ld: error: undefined symbol:
inotify_init1
>>> referenced by filemonitor-inotify.c:183(
../src/util/filemonitor-inotify.c:183)Quoted 1 line
Quoted 1 line
>>>util_filemonitor-inotify.c.o:(qemu_file_monitor_new) in archive
libqemuutil.aQuoted 7 lines
Quoted 7 lines
On FreeBSD inotify functions are defined in libinotify.so, so it might be tempting to add it to the dependencies. Doing so, however, reveals that this library handles rename events differently from Linux:
$ FILEMONITOR_DEBUG=1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt ->
/tmp/test-util-filemonitor-K13LI2/two.txtQuoted 8 lines
Quoted 8 lines
Event id=200000000 event=2 file=one.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=100000000 event=0 file=two.txt Expected event 0 but got 2
Interesting. So In the "Rename" test, the destination already exists.
BSD is thus reporting that 'two.txt' is deleted, before being (re)created Linux is only reporting 'two.txt' is created.
I don't think we can easily paper over this difference. The easiest is probably to conditionalize the test
git diff
tests/unit/test-util-filemonitor.c +7
-0@@ -281,6 +281,14 @@ test_file_monitor_events(void) { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "one.txt", .watchid = &watch1, .eventid = QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__ + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch0, + .eventid = QFILE_MONITOR_EVENT_DELETED }, + { .type = QFILE_MONITOR_TEST_OP_EVENT, + .filesrc = "two.txt", .watchid = &watch2, + .eventid = QFILE_MONITOR_EVENT_DELETED },Quoted 8 lines
tests/unit/test-util-filemonitor.c test_file_monitor_events(void) · line 294
Quoted 5 lines
tests/unit/test-util-filemonitor.c +1
-0+#endif { .type = QFILE_MONITOR_TEST_OP_EVENT, .filesrc = "two.txt", .watchid = &watch0, .eventid = QFILE_MONITOR_EVENT_CREATED },I agree this is likely the best course of action. Has anybody filed a bug at https://bugs.freebsd.org?
Quoted 5 lines
I've not, and I'm not even sure I would class it a FreeBSD bug. Other than the fact that it differs from Linux behaviour, it feels like it is reasonble semantics to emit a 'delete' event in this scenario so that an event consumer can detect replacement of an existing file.
FWIW, +1... unless we miss the follow-up notification that it's been created, I'd personally put it into the WONTFIX bucket pretty quickly.
Barring some kind of NOTE_COVER (bad name) that can be emitted if a file is simply replaced by another, a directory being reported as shortened then extended is a valid and useful representation of the situation (even if not completely accurate) to avoid consumers missing the action entirely.
Thanks,
Kyle Evans
Quoted 14 lines · Ilya Leoshkevich
Hi,
I needed to verify that my qemu-user changes didn't break BSD, and Daniel Berrange suggested vm-build-freebsd on IRC. I had several problems with it, which this series resolves.
Best regards,
IlyaIlya Leoshkevich (3):
tests/vm: Set UseDNS=no in the sshd configuration tests/vm/freebsd: Reload the sshd configuration
meson: DisableCONFIG_NOTIFY1on FreeBSD
Quoted 4 lines
meson.build | 1 + tests/vm/basevm.py | 2 ++ tests/vm/freebsd | 2 ++ 3 files changed, 5 insertions(+)
I can take the patches through my tree (and fix the second patch to use console_wait_send() if you don't mind).
Thomas
Quoted 20 lines · Thomas Huth
Quoted 14 lines · Ilya Leoshkevich
Hi,
I needed to verify that my qemu-user changes didn't break BSD, and Daniel Berrange suggested vm-build-freebsd on IRC. I had several problems with it, which this series resolves.
Best regards,
IlyaIlya Leoshkevich (3):
tests/vm: Set UseDNS=no in the sshd configuration tests/vm/freebsd: Reload the sshd configuration
meson: DisableCONFIG_NOTIFY1on FreeBSDQuoted 4 lines
meson.build | 1 +
tests/vm/basevm.py| 2 ++
tests/vm/freebsd | 2 ++3 files changed, 5 insertions(+)
Quoted 8 lines
Tested-by Thomas Huth <[email protected]>I can take the patches through my tree (and fix the second patch to use
console_wait_send()if you don't mind).Thomas
Sure, that sounds good to me. Thanks!