[libvirt] [PATCH] virsh: avoid bogus description

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

At 06/21/2011 04:40 AM, Eric Blake Write:
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 "". */
Can two prepositions use together?
+ 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) {
The other looks good to me. ACK except the comment.

On Tue, Jun 21, 2011 at 10:22:38AM +0800, Wen Congyang wrote:
At 06/21/2011 04:40 AM, Eric Blake Write:
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 "". */
Can two prepositions use together?
I believe in this case "until" is being used as a conjunction. Dave
+ 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) {
The other looks good to me.
ACK except the comment.
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 06/20/2011 08:22 PM, Wen Congyang wrote:
+++ 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 "". */
Can two prepositions use together?
As a native speaker, I didn't notice anything wrong with that use (actually, I might have inserted "that" between "know it"), but I used a shorter phrase altogether that should be easier to parse: /* Don't translate desc if it is "". */
ACK except the comment.
Now pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Dave Allan
-
Eric Blake
-
Wen Congyang