Compare commits

...

3 Commits

Author SHA1 Message Date
Andi Chandler aa51dcd74b Translated using Weblate (English (United Kingdom))
Currently translated at 47.1% (4913 of 10423 strings)

Translation: libvirt/libvirt
Translate-URL: https://translate.fedoraproject.org/projects/libvirt/libvirt/en_GB/

Co-authored-by: Andi Chandler <andi@gowling.com>
Signed-off-by: Andi Chandler <andi@gowling.com>
2024-05-08 15:34:27 +02:00
Daniel P. Berrangé ae6a89884a tests: fix two off-by-1 errors in read-big-pipe test
When testPipeFeeder copies the XML document into the padded buffer, it
tells virStrcpy that 'xmlsize' bytes are available. This is under
reporting size by 1 byte, and as a result it fails to copy the trailing
'\n' replacing it with '\0'. The return value of virStrcpy wasn't
checked, but was reporting this truncation.

When testPipeFeeder then sends the padded buffer down the pipe, it asks
to send 'emptyspace + xmlsize + 1' bytes, which means it sends the data,
as well as the trailing '\0' terminator.

Both bugs combined mean it is sending '\0\0' as the last bytes, instead
of '\n' which was intended. When virFileReadAll reads data from the
pipe, it ends up adding another '\0' resulting in a very NUL terminated
string ('\0\0\0'). This is all harmless, but should be fixed regardless.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-08 14:33:42 +01:00
Daniel P. Berrangé e1c32120ce tests: fix hang in virshtest 'read-big-pipe' case
The virshtest program testPipeFeeder method is doing this:

  mkfifo("test.fifo", 0600) ;

  int fd = open("test.fifo", O_RDWR);

  char buf[...];
  memset(buf, 'a', sizeof(buf));
  write(fd, buf, sizeof(buf)) == sizeof(buf));
  close(fd);

while the the 'virsh' child process then ends up doing:

  fd = open("test.fifo", O_RDONLY);
  read(fd, buf, sizeof(buf)) == sizeof(buf));
  close(fd);

The 'virsh' code hangs on open() on at least ppc64 and some other
arches. It can be provoked to hang even on x86 by reducing the size of
the buffer. It can be prevented from hanging on ppc64 by increasing the
size of the buffer.

What is happening is a result of differing page sizes, altering the
overall pipe capacity size, since pipes on linux default to 16 pages
in size and thus have architecture specific capacity when measured
in bytes.

 * On x86, testPipeFeeder opens R+W, tries to write 140kb and
   write() blocks because the pipe is full. This gives time for
   virsh to start up, and it can open the pipe for O_RDONLY
   since testPipeFeeder still has it open for write. Everything
   works as intended.

 * On ppc64,  testPipeFeeder opens R+W, tries to write 140kb
   and write() succeeds because the larger 64kb page size
   resulted in greater buffer capacity for the pipe. It thus
   quickly closes the pipe, removing the writer, and triggering
   discard of all the unread data. Now virsh starts up, tries
   to open the pipe for O_RDONLY and blocks waiting for a new
   writer to open it, which will never happen. Meson kills
   the test after 30 seconds.

   NB, every now & then, it will not block because virsh starts
   up quickly enough that testPipeFeeder has not yet closed the
   write end of the pipe, giving the illusion of correctness.

The key flaw here is that it should not have been using O_RDWR
in testPipeFeeder. Synchronization is required such that both
virsh and testPipeFeeder have their respective ends of the pipe
open before any data is sent. This is trivially arranged by
using O_WRONLY in testPipeFeeder.

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-05-08 14:33:34 +01:00
2 changed files with 38 additions and 36 deletions

View File

@ -13,7 +13,7 @@ msgstr ""
"Project-Id-Version: libvirt 6.0.0\n"
"Report-Msgid-Bugs-To: https://libvirt.org/bugs.html\n"
"POT-Creation-Date: 2024-04-26 08:00+0000\n"
"PO-Revision-Date: 2024-04-18 20:36+0000\n"
"PO-Revision-Date: 2024-05-08 11:36+0000\n"
"Last-Translator: Andi Chandler <andi@gowling.com>\n"
"Language-Team: English (United Kingdom) <https://translate.fedoraproject.org/"
"projects/libvirt/libvirt/en_GB/>\n"
@ -22,7 +22,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.4\n"
"X-Generator: Weblate 5.5.2\n"
msgid ""
"\n"
@ -466,7 +466,7 @@ msgstr " %1$s (help keyword '%2$s'):\n"
#, c-format
msgid " --%1$s <string>..."
msgstr ""
msgstr " --%1$s <string>..."
msgid " Hypervisors:"
msgstr " Hypervisors:"
@ -482,7 +482,7 @@ msgstr " Storage:"
#, c-format
msgid " [--%1$s <string>]..."
msgstr ""
msgstr " [--%1$s <string>]..."
#, c-format
msgid ""
@ -614,9 +614,9 @@ msgstr "%1$s in %2$s must be NULL"
msgid "%1$s in %2$s must be greater than zero"
msgstr "%1$s in %2$s must be greater than zero"
#, fuzzy, c-format
#, c-format
msgid "%1$s in %2$s must be zero"
msgstr "%1$s in %2$s must not be zero"
msgstr "%1$s in %2$s must be zero"
#, c-format
msgid "%1$s in %2$s must be zero or greater"
@ -638,9 +638,9 @@ msgstr "%1$s is missing 'type' property"
msgid "%1$s is not an executable"
msgstr "QEMU binary %1$s is not executable"
#, fuzzy, c-format
#, c-format
msgid "%1$s is not supported by this QEMU binary"
msgstr "discard is not supported by this QEMU binary"
msgstr "%1$s is not supported by this QEMU binary"
#, c-format
msgid "%1$s length greater than maximum: %2$d > %3$d"
@ -648,45 +648,47 @@ msgstr "%1$s length greater than maximum: %2$d > %3$d"
#, c-format
msgid "%1$s model of watchdog can go only on PCI bus"
msgstr ""
msgstr "%1$s model of watchdog can go only on PCI bus"
#, c-format
msgid "%1$s model of watchdog cannot be used with this machine type"
msgstr ""
msgstr "%1$s model of watchdog cannot be used with this machine type"
#, c-format
msgid "%1$s model of watchdog does not support configuring the address"
msgstr ""
msgstr "%1$s model of watchdog does not support configuring the address"
#, c-format
msgid "%1$s model of watchdog is allowed for s390 and s390x only"
msgstr ""
msgstr "%1$s model of watchdog is allowed for s390 and s390x only"
#, c-format
msgid "%1$s model of watchdog is only part of q35 machine"
msgstr ""
msgstr "%1$s model of watchdog is only part of q35 machine"
#, c-format
msgid ""
"%1$s model of watchdog is part of the machine and cannot have any address "
"set."
msgstr ""
"%1$s model of watchdog is part of the machine and cannot have any address "
"set."
#, c-format
msgid "%1$s model of watchdog is virtual and cannot go on any bus."
msgstr ""
msgstr "%1$s model of watchdog is virtual and cannot go on any bus."
#, c-format
msgid "%1$s module is not loaded, "
msgstr ""
msgstr "%1$s module is not loaded, "
#, fuzzy, c-format
#, c-format
msgid "%1$s namespace is not available"
msgstr "System is not available"
msgstr "%1$s namespace is not available"
#, fuzzy, c-format
#, c-format
msgid "%1$s not found in %2$s"
msgstr "disk %s not found"
msgstr "%1$s not found in %2$s"
#, c-format
msgid "%1$s not implemented on Win32"
@ -712,17 +714,17 @@ msgstr "%1$s object has invalid dynamic type"
msgid "%1$s object is missing the required '%2$s' property"
msgstr "%1$s object is missing the required '%2$s' property"
#, fuzzy, c-format
#, c-format
msgid "%1$s reply data was missing 'model'"
msgstr "qom-list reply data was missing 'name'"
msgstr "%1$s reply data was missing 'model'"
#, fuzzy, c-format
#, c-format
msgid "%1$s reply data was missing 'name'"
msgstr "qom-list reply data was missing 'name'"
msgstr "%1$s reply data was missing 'name'"
#, fuzzy, c-format
#, c-format
msgid "%1$s reply data was missing 'props'"
msgstr "qom-list reply data was missing 'name'"
msgstr "%1$s reply data was missing 'props'"
#, c-format
msgid ""
@ -752,25 +754,25 @@ msgstr ""
msgid "%1$s: %2$s"
msgstr "%1$s: %2$s"
#, fuzzy, c-format
#, c-format
msgid "%1$s: %2$s: unsupported auth %3$s"
msgstr "unsupported feature %s"
msgstr "%1$s: %2$s: unsupported auth %3$s"
#, fuzzy, c-format
#, c-format
msgid "%1$s: '%2$s' does not exist"
msgstr "'%s' does not exist"
msgstr "%1$s: '%2$s' does not exist"
#, fuzzy, c-format
msgid "%1$s: Address '%2$s' in route definition is not a network address"
msgstr "Missing IP address in static host definition for network '%s'"
#, fuzzy, c-format
#, c-format
msgid "%1$s: Bad gateway address '%2$s' in route definition"
msgstr "network '%s' has an invalid netmask or IP address in route definition"
msgstr "%1$s: Bad gateway address '%2$s' in route definition"
#, fuzzy, c-format
#, c-format
msgid "%1$s: Bad netmask address '%2$s' in route definition"
msgstr "network '%s' has an invalid netmask or IP address in route definition"
msgstr "%1$s: Bad netmask address '%2$s' in route definition"
#, fuzzy, c-format
msgid "%1$s: Bad network address '%2$s' in route definition"

View File

@ -145,15 +145,15 @@ testPipeFeeder(void *opaque)
g_autofree char *doc = g_new0(char, emptyspace + xmlsize + 1);
VIR_AUTOCLOSE fd = -1;
if ((fd = open(pipepath, O_RDWR)) < 0) {
if ((fd = open(pipepath, O_WRONLY)) < 0) {
fprintf(stderr, "\nfailed to open pipe '%s': %s\n", pipepath, g_strerror(errno));
return;
}
memset(doc, ' ', emptyspace);
virStrcpy(doc + emptyspace, xml, xmlsize);
g_assert(virStrcpy(doc + emptyspace, xml, xmlsize + 1) == 0);
if (safewrite(fd, doc, emptyspace + xmlsize + 1) < 0) {
if (safewrite(fd, doc, emptyspace + xmlsize) < 0) {
fprintf(stderr, "\nfailed to write to pipe '%s': %s\n", pipepath, g_strerror(errno));
return;
}