From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Warner Losh <imp@bsdimp.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Ed Maste" <emaste@freebsd.org>, "Li-Wen Hsu" <lwhsu@freebsd.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Beraldo Leal" <bleal@redhat.com>,
"Kyle Evans" <kevans@freebsd.org>,
qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>
Subject: Re: [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD
Date: Mon, 5 Feb 2024 15:31:58 +0000 [thread overview]
Message-ID: <ZcD_bnSRD2XSLIp5@redhat.com> (raw)
In-Reply-To: <CANCZdfotNMgPadLA0o9+POcLeTN-rGoR+XkbqBHtjd+cZMy0Fg@mail.gmail.com>
On Mon, Feb 05, 2024 at 08:23:41AM -0700, Warner Losh wrote:
> On Wed, Jan 31, 2024 at 9:42 AM Daniel P. Berrangé <berrange@redhat.com>
> wrote:
>
> > On Wed, Jan 31, 2024 at 05:24:10PM +0100, Philippe Mathieu-Daudé wrote:
> > > 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.
> >
> > >
> > > On 25/1/24 20:48, Ilya Leoshkevich wrote:
> > > > 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.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 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
> > diff --git a/tests/unit/test-util-filemonitor.c
> > b/tests/unit/test-util-filemonitor.c
> > index a22de27595..c3b2006365 100644
> > --- a/tests/unit/test-util-filemonitor.c
> > +++ b/tests/unit/test-util-filemonitor.c
> > @@ -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 },
> >
>
> 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
--
|: 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 :|
next prev parent reply other threads:[~2024-02-05 15:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 19:48 [PATCH 0/3] make vm-build-freebsd fixes Ilya Leoshkevich
2024-01-25 19:48 ` [PATCH 1/3] tests/vm: Set UseDNS=no in the sshd configuration Ilya Leoshkevich
2024-01-31 12:51 ` Thomas Huth
2024-01-25 19:48 ` [PATCH 2/3] tests/vm/freebsd: Reload " Ilya Leoshkevich
2024-01-31 12:46 ` Thomas Huth
2024-01-25 19:48 ` [PATCH 3/3] meson: Disable CONFIG_NOTIFY1 on FreeBSD Ilya Leoshkevich
2024-01-31 12:50 ` Thomas Huth
2024-01-31 16:24 ` Philippe Mathieu-Daudé
2024-01-31 16:42 ` Daniel P. Berrangé
2024-02-05 15:23 ` Warner Losh
2024-02-05 15:31 ` Daniel P. Berrangé [this message]
2024-02-05 15:56 ` Ilya Leoshkevich
2024-02-05 16:02 ` Kyle Evans
2024-01-31 13:24 ` [PATCH 0/3] make vm-build-freebsd fixes Thomas Huth
2024-01-31 13:24 ` Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZcD_bnSRD2XSLIp5@redhat.com \
--to=berrange@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=bleal@redhat.com \
--cc=emaste@freebsd.org \
--cc=iii@linux.ibm.com \
--cc=imp@bsdimp.com \
--cc=kevans@freebsd.org \
--cc=lwhsu@freebsd.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=wainersm@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).