[libvirt] [PATCH] virsh: avoid bogus description

Wen Congyang wency at cn.fujitsu.com
Tue Jun 21 02:22:38 UTC 2011


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.




More information about the libvir-list mailing list