maint: fix missing spaces in message

I got an off-list report about a bad diagnostic:
Target network card mac 52:54:00:49:07:ccdoes not match source 52:54:00:49:07:b8

True to form, I've added a syntax check rule to prevent it
from recurring, and found several other offenders.

* cfg.mk (sc_require_whitespace_in_translation): New rule.
* src/conf/domain_conf.c (virDomainNetDefCheckABIStability): Add
space.
* src/esx/esx_util.c (esxUtil_ParseUri): Likewise.
* src/qemu/qemu_command.c (qemuCollectPCIAddress): Likewise.
* src/qemu/qemu_driver.c (qemuDomainSetMetadata)
(qemuDomainGetMetadata): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainChangeNetBridge): Likewise.
* src/rpc/virnettlscontext.c
(virNetTLSContextCheckCertDNWhitelist): Likewise.
* src/vmware/vmware_driver.c (vmwareDomainResume): Likewise.
* src/vbox/vbox_tmpl.c (vboxDomainGetXMLDesc, vboxAttachDrives):
Avoid false negatives.
* tools/virsh-domain.c (info_save_image_dumpxml): Reword.
Based on a report by Luwen Su.
This commit is contained in:
Eric Blake 2012-09-12 10:54:42 -06:00
parent a20f06d9d9
commit 2387aa26c1
10 changed files with 38 additions and 24 deletions

9
cfg.mk
View File

@ -597,6 +597,15 @@ sc_prohibit_useless_translation:
halt='no translations in tests or examples' \ halt='no translations in tests or examples' \
$(_sc_search_regexp) $(_sc_search_regexp)
# When splitting a diagnostic across lines, ensure that there is a space
# or \n on one side of the split.
sc_require_whitespace_in_translation:
@grep -n -A1 '"$$' $$($(VC_LIST_EXCEPT)) \
| sed -ne ':l; /"$$/ {N;b l;}; s/"\n[^"]*"/""/g; s/\\n/ /g' \
-e '/_(.*[^\ ]""[^\ ]/p' | grep . && \
{ echo '$(ME): missing whitespace at line split' 1>&2; \
exit 1; } || :
# Enforce recommended preprocessor indentation style. # Enforce recommended preprocessor indentation style.
sc_preprocessor_indentation: sc_preprocessor_indentation:
@if cppi --version >/dev/null 2>&1; then \ @if cppi --version >/dev/null 2>&1; then \

View File

@ -9846,7 +9846,8 @@ static bool virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
src->addr.pci.slot != dst->addr.pci.slot || src->addr.pci.slot != dst->addr.pci.slot ||
src->addr.pci.function != dst->addr.pci.function) { src->addr.pci.function != dst->addr.pci.function) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target device PCI address %04x:%02x:%02x.%02x does not match source %04x:%02x:%02x.%02x"), _("Target device PCI address %04x:%02x:%02x.%02x "
"does not match source %04x:%02x:%02x.%02x"),
dst->addr.pci.domain, dst->addr.pci.bus, dst->addr.pci.domain, dst->addr.pci.bus,
dst->addr.pci.slot, dst->addr.pci.function, dst->addr.pci.slot, dst->addr.pci.function,
src->addr.pci.domain, src->addr.pci.bus, src->addr.pci.domain, src->addr.pci.bus,
@ -10044,7 +10045,7 @@ static bool virDomainNetDefCheckABIStability(virDomainNetDefPtr src,
if (virMacAddrCmp(&src->mac, &dst->mac) != 0) { if (virMacAddrCmp(&src->mac, &dst->mac) != 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Target network card mac %02x:%02x:%02x:%02x:%02x:%02x" _("Target network card mac %02x:%02x:%02x:%02x:%02x:%02x"
"does not match source %02x:%02x:%02x:%02x:%02x:%02x"), " does not match source %02x:%02x:%02x:%02x:%02x:%02x"),
dst->mac.addr[0], dst->mac.addr[1], dst->mac.addr[2], dst->mac.addr[0], dst->mac.addr[1], dst->mac.addr[2],
dst->mac.addr[3], dst->mac.addr[4], dst->mac.addr[5], dst->mac.addr[3], dst->mac.addr[4], dst->mac.addr[5],
src->mac.addr[0], src->mac.addr[1], src->mac.addr[2], src->mac.addr[0], src->mac.addr[1], src->mac.addr[2],

View File

@ -2,7 +2,7 @@
/* /*
* esx_util.c: utility functions for the VMware ESX driver * esx_util.c: utility functions for the VMware ESX driver
* *
* Copyright (C) 2010-2011 Red Hat, Inc. * Copyright (C) 2010-2012 Red Hat, Inc.
* Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com> * Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com>
* Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org> * Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
* *
@ -159,8 +159,9 @@ esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
(*parsedUri)->proxy_port < 1 || (*parsedUri)->proxy_port < 1 ||
(*parsedUri)->proxy_port > 65535) { (*parsedUri)->proxy_port > 65535) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("Query parameter 'proxy' has unexpected port" _("Query parameter 'proxy' has unexpected "
"value '%s' (should be [1..65535])"), tmp); "port value '%s' (should be [1..65535])"),
tmp);
goto cleanup; goto cleanup;
} }
} }

View File

@ -1044,8 +1044,9 @@ static int qemuCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
if (virHashLookup(addrs->used, addr)) { if (virHashLookup(addrs->used, addr)) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("Attempted double use of PCI Address '%s'" _("Attempted double use of PCI Address '%s' "
"(need \"multifunction='off'\" for device on function 0)"), "(need \"multifunction='off'\" for device "
"on function 0)"),
addr); addr);
goto cleanup; goto cleanup;
} }

View File

@ -13271,7 +13271,7 @@ qemuDomainSetMetadata(virDomainPtr dom,
break; break;
case VIR_DOMAIN_METADATA_ELEMENT: case VIR_DOMAIN_METADATA_ELEMENT:
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("QEmu driver does not support modifying" _("QEmu driver does not support modifying "
"<metadata> element")); "<metadata> element"));
goto cleanup; goto cleanup;
break; break;
@ -13299,7 +13299,7 @@ qemuDomainSetMetadata(virDomainPtr dom,
break; break;
case VIR_DOMAIN_METADATA_ELEMENT: case VIR_DOMAIN_METADATA_ELEMENT:
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("QEMU driver does not support" _("QEMU driver does not support "
"<metadata> element")); "<metadata> element"));
goto cleanup; goto cleanup;
default: default:
@ -13367,7 +13367,7 @@ qemuDomainGetMetadata(virDomainPtr dom,
break; break;
case VIR_DOMAIN_METADATA_ELEMENT: case VIR_DOMAIN_METADATA_ELEMENT:
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("QEMU driver does not support" _("QEMU driver does not support "
"<metadata> element")); "<metadata> element"));
goto cleanup; goto cleanup;
break; break;

View File

@ -1278,7 +1278,7 @@ int qemuDomainChangeNetBridge(virDomainObjPtr vm,
virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0); virDomainAuditNet(vm, NULL, olddev, "attach", ret == 0);
if (ret < 0) { if (ret < 0) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("unable to recover former state by adding port" _("unable to recover former state by adding port "
"to bridge %s"), oldbridge); "to bridge %s"), oldbridge);
} }
return -1; return -1;

View File

@ -1,7 +1,7 @@
/* /*
* virnettlscontext.c: TLS encryption/x509 handling * virnettlscontext.c: TLS encryption/x509 handling
* *
* Copyright (C) 2010-2011 Red Hat, Inc. * Copyright (C) 2010-2012 Red Hat, Inc.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -393,8 +393,8 @@ virNetTLSContextCheckCertDNWhitelist(const char *dname,
virReportError(VIR_ERR_SYSTEM_ERROR, "%s", virReportError(VIR_ERR_SYSTEM_ERROR, "%s",
_("Client's Distinguished Name is not on the list " _("Client's Distinguished Name is not on the list "
"of allowed clients (tls_allowed_dn_list). Use " "of allowed clients (tls_allowed_dn_list). Use "
"'certtool -i --infile clientcert.pem' to view the" "'certtool -i --infile clientcert.pem' to view the "
"Distinguished Name field in the client certificate," "Distinguished Name field in the client certificate, "
"or run this daemon with --verbose option.")); "or run this daemon with --verbose option."));
return 0; return 0;
} }

View File

@ -3752,8 +3752,9 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) {
ret = vboxStartMachine(dom, i, machine, &iid); ret = vboxStartMachine(dom, i, machine, &iid);
} else { } else {
virReportError(VIR_ERR_OPERATION_FAILED, "%s", virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("machine is not in poweroff|saved|" _("machine is not in "
"aborted state, so couldn't start it")); "poweroff|saved|aborted state, so "
"couldn't start it"));
ret = -1; ret = -1;
} }
} }
@ -4280,8 +4281,9 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
&devicePort, &devicePort,
&deviceSlot)) { &deviceSlot)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("can't get the port/slot number of harddisk/" _("can't get the port/slot number of "
"dvd/floppy to be attached: %s, rc=%08x"), "harddisk/dvd/floppy to be attached: "
"%s, rc=%08x"),
def->disks[i]->src, (unsigned)rc); def->disks[i]->src, (unsigned)rc);
VBOX_RELEASE(medium); VBOX_RELEASE(medium);
VBOX_UTF16_FREE(mediumUUID); VBOX_UTF16_FREE(mediumUUID);
@ -4303,8 +4305,8 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
if (NS_FAILED(rc)) { if (NS_FAILED(rc)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("could not attach the file as harddisk/" _("could not attach the file as "
"dvd/floppy: %s, rc=%08x"), "harddisk/dvd/floppy: %s, rc=%08x"),
def->disks[i]->src, (unsigned)rc); def->disks[i]->src, (unsigned)rc);
} else { } else {
DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID); DEBUGIID("Attached HDD/DVD/Floppy with UUID", mediumUUID);

View File

@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
/* /*
* Copyright (C) 2011 Red Hat, Inc. * Copyright (C) 2011-2012 Red Hat, Inc.
* Copyright 2010, diateam (www.diateam.net) * Copyright 2010, diateam (www.diateam.net)
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
@ -484,7 +484,7 @@ vmwareDomainResume(virDomainPtr dom)
if (driver->type == TYPE_PLAYER) { if (driver->type == TYPE_PLAYER) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("vmplayer does not support libvirt suspend/resume" _("vmplayer does not support libvirt suspend/resume "
"(vmware pause/unpause) operation ")); "(vmware pause/unpause) operation "));
return ret; return ret;
} }

View File

@ -2945,8 +2945,8 @@ cleanup:
*/ */
static const vshCmdInfo info_save_image_dumpxml[] = { static const vshCmdInfo info_save_image_dumpxml[] = {
{"help", N_("saved state domain information in XML")}, {"help", N_("saved state domain information in XML")},
{"desc", N_("Output the domain information for a saved state file,\n" {"desc",
"as an XML dump to stdout.")}, N_("Dump XML of domain information for a saved state file to stdout.")},
{NULL, NULL} {NULL, NULL}
}; };