[libvirt] [PATCH] virsh: avoid bogus description

Eric Blake eblake at redhat.com
Mon Jun 20 20:40:24 UTC 2011


https://bugzilla.redhat.com/show_bug.cgi?id=682121

Gettext reserves the empty string for internal use, and it must
not be passed through _().  We were violating this for commands
that (for whatever reason) used "" for their description.

* tools/virsh.c (vshCmddefHelp): Don't translate empty string.
Reported by Tatsuo Kawasaki.
---
 tools/virsh.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index a315f05..bdd5005 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -12113,7 +12113,8 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
         vshError(ctl, _("command '%s' doesn't exist"), cmdname);
         return false;
     } else {
-        const char *desc = _(vshCmddefGetInfo(def, "desc"));
+        /* Don't translate desc until after we know it isn't "".  */
+        const char *desc = vshCmddefGetInfo(def, "desc");
         const char *help = _(vshCmddefGetInfo(def, "help"));
         char buf[256];
         uint32_t opts_need_arg;
@@ -12167,7 +12168,7 @@ vshCmddefHelp(vshControl *ctl, const char *cmdname)
         if (desc[0]) {
             /* Print the description only if it's not empty.  */
             fputs(_("\n  DESCRIPTION\n"), stdout);
-            fprintf(stdout, "    %s\n", desc);
+            fprintf(stdout, "    %s\n", _(desc));
         }

         if (def->opts) {
-- 
1.7.4.4




More information about the libvir-list mailing list