From: "Cédric Le Goater" <clg@redhat.com>
To: Yodel Eldar <yodel.eldar@yodel.dev>, qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Michael Tokarev" <mjt@tls.msk.ru>,
"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH 2/2] tests/vhost-user-bridge.c: Fix const qualifier build errors with recent glibc
Date: Sun, 14 Dec 2025 18:47:54 +0100 [thread overview]
Message-ID: <e08dcb25-a258-4e65-bd2c-360c8a08591c@redhat.com> (raw)
In-Reply-To: <9247eb0c-1867-497d-97d0-ad1621d6c24d@yodel.dev>
+ Thomas,
On 12/14/25 17:18, Yodel Eldar wrote:
>
>
> On 14/12/2025 02:56, Cédric Le Goater wrote:
>> Hello Yodel,
>>
>> On 12/13/25 21:15, Yodel Eldar wrote:
>>>
>>> On 13/12/2025 00:59, Cédric Le Goater wrote:
>>>> On 12/13/25 01:17, Yodel Eldar wrote:
>>>>>
>>>>> On 12/12/2025 17:33, Yodel Eldar wrote:
>>>>>> Hi, Cédric!
>>>>>>
>>>>>> On 10/12/2025 12:13, Cédric Le Goater wrote:
>>>>>>> A recent change in glibc 2.42.9000 [1] changes the return type of
>>>>>>> strstr() and other string functions to be 'const char *' when the
>>>>>>> input is a 'const char *'. This breaks the build in :
>>>>>>>
>>>>>>> ../tests/vhost-user-bridge.c: In function ‘vubr_parse_host_port’:
>>>>>>> ../tests/vhost-user-bridge.c:749:15: error: initialization discards ‘const’ qualifier from pointer target type [- Werror=discarded- qualifiers]
>>>>>>> 749 | char *p = strchr(buf, ':');
>>>>>>> | ^~~~~~
>>>>>>>
>>>>>>> Fix this by using the glib g_strsplit() routine instead of strdup().
>>>>>>>
>>>>>>> [1] https://sourceware.org/git/? p=glibc.git;a=commit;h=cd748a63ab1a7ae846175c532a3daab341c62690
>>>>>>>
>>>>>>> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
>>>>>>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>>>>>>> ---
>>>>>>> tests/vhost-user-bridge.c | 10 ++++------
>>>>>>> 1 file changed, 4 insertions(+), 6 deletions(-)
>>>>>>>
>>>>>>> diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
>>>>>>> index a5c711b1de8e9c164dd1614f4329b8e3c05d0402..ce4c3426d3938a0b54195f3e95bb1f1c3c4ae823 100644
>>>>>>> --- a/tests/vhost-user-bridge.c
>>>>>>> +++ b/tests/vhost-user-bridge.c
>>>>>>> @@ -746,14 +746,12 @@ vubr_run(VubrDev *dev)
>>>>>>> static int
>>>>>>> vubr_parse_host_port(const char **host, const char **port, const char *buf)
>>>>>>> {
>>>>>>> - char *p = strchr(buf, ':');
>>>>>>> -
>>>>>>> - if (!p) {
>>>>>>> + g_auto(GStrv) tokens = g_strsplit(buf, ":", 2);
>>>>>>> + if (!tokens[0] || !tokens[1]) {
>>>>>>> return -1;
>>>>>>> }
>>>>>>> - *p = '\0';
>>>>>>> - *host = strdup(buf);
>>>>>>> - *port = strdup(p + 1);
>>>>>>> + *host = g_steal_pointer(&tokens[0]);
>>>>>>> + *port = g_steal_pointer(&tokens[1]);
>>>>>>> return 0;
>>>>>>> }
>>>>>>
>>>>>> Thanks for addressing this before the glibc change is widely propagated
>>>>>> among distros.
>>>>>>
>>>>>> Acked-by: Yodel Eldar <yodel.eldar@yodel.dev>
>>>>>> Tested-by: Yodel Eldar <yodel.eldar@yodel.dev>
>>>>>>
>>>>>> For testing, I built and installed glibc (76 commits ahead of cd748a63a)
>>>>>> in an x86_64 Linux container and built vhost-user-bridge on top of that.
>>>>>> Ran it with:
>>>>>>
>>>>>> ./build/tests/vhost-user-bridge -H
>>>>>>
>>>>>> qemu-system-x86_64 \
>>>>>> -enable-kvm -m 4G \
>>>>>> -object memory-backend-ram,id=mem0,size=4G,share=on \
>>>>>> -numa node,memdev=mem0 -mem-prealloc \
>>>>>> -chardev socket,id=char0,path=/tmp/vubr.sock \
>>>>>> -netdev type=vhost-user,id=net0,chardev=char0,vhostforce=on \
>>>>>> -device virtio-net-pci,netdev=net0 \
>>>>>> -drive file=linux.qcow2
>>>>>>
>>>>>> and visually inspected the logged traffic.
>>>>>>
>>>>>> Thanks,
>>>>>> Yodel
>>>>>>
>>>>>
>>>>> P.S. To build vhost-user-bridge, I had to modify util/log.c as in
>>>>> the PULL submission "<20251209200537.84097-9-philmd@linaro.org>".
>>>>>
>>>>> For completion, the commands used:
>>>>>
>>>>> ../configure --enable-tools --enable-vhost-user --disable-system \
>>>>> --disable-user
>>>>>
>>>>> ninja tests/vhost-user-bridge
>>>>>
>>>>> Yodel
>>>>>
>>>>
>>>>
>>>> Thanks Yodel,
>>>>
>>>> My plan is to send a small PR as soon as QEMU 10.2 is out and ask
>>>> Michael T. to include the changes in the stable branches.
>>>>
>>>> C.
>>>>
>>>>
>>>
>>> Glad to hear it!
>>>
>>> Sorry for staggering my testing methodology over multiple emails, but I
>>> should add for clarification and completeness: to exercise your change
>>> to vubr_parse_host_port(), I passed various input into the -l and -r
>>> options of vhost-user-bridge; and, with:
>>>
>>> tcpdump -i lo -n -X udp port 5678
>>>
>>> while running:
>>>
>>> ./build/tests/vhost-user-bridge -H -l 127.0.0.1:4567 -r 127.0.0.1:5678
>>>
>>> for example,
>>>
>>> I was able to monitor the traffic (ARP requests) from port 4567 to 5678.
>>>
>>
>> Would you mind providing a test case under tests/ or tests/functional ?
>>
>> Thanks,
>>
>> C.
>>
>>
>
> Certainly, that's a great idea! Although, I'll need to get better
> acquainted with QEMU's testing framework... Would you be willing to
> answer the occasional question regarding scope, approach, conventions,
> etc. over IRC?
Sure. The #qemu channel is hosted on OFTC.
I think this test would qualify as a functional test. To run :
$ make check-functional
You could get some inspiration out of test_virtio_gpu.py I suppose.
Check source [2].
See [3] to send patches.
Thanks,
C.
[1] https://www.qemu.org/docs/master/devel/testing/main.html#functional-tests-using-python
[2] https://gitlab.com/qemu-project/qemu/-/blob/master/tests/functional/x86_64/test_virtio_gpu.py?ref_type=heads
[3] https://www.qemu.org/docs/master/devel/submitting-a-patch.html
> There's a Co-authored-by tag with your name on it if
> you so choose :-)
>
> Yodel
>
next prev parent reply other threads:[~2025-12-14 17:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 18:13 [PATCH 0/2] Fix const qualifier build errors with recent glibc Cédric Le Goater
2025-12-10 18:13 ` [PATCH 1/2] i386: " Cédric Le Goater
2025-12-10 18:39 ` Peter Maydell
2025-12-11 15:16 ` Philippe Mathieu-Daudé
2025-12-10 18:13 ` [PATCH 2/2] tests/vhost-user-bridge.c: " Cédric Le Goater
2025-12-10 18:14 ` Cédric Le Goater
2025-12-11 7:55 ` Cédric Le Goater
2025-12-12 23:33 ` Yodel Eldar
2025-12-13 0:17 ` Yodel Eldar
2025-12-13 6:59 ` Cédric Le Goater
2025-12-13 20:15 ` Yodel Eldar
2025-12-14 8:56 ` Cédric Le Goater
2025-12-14 16:18 ` Yodel Eldar
2025-12-14 17:47 ` Cédric Le Goater [this message]
2025-12-14 19:22 ` Yodel Eldar
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=e08dcb25-a258-4e65-bd2c-360c8a08591c@redhat.com \
--to=clg@redhat.com \
--cc=mjt@tls.msk.ru \
--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=yodel.eldar@yodel.dev \
/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).