public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: 赵伟 <qdzhaov@qq.com>
Cc: cygwin-apps@cygwin.com
Subject: Re: [PATCH setup] Fix Chinese Help Message fall in dead loop .
Date: Fri, 29 Mar 2024 16:32:31 +0000	[thread overview]
Message-ID: <dc483453-a3e5-4a1c-bd76-5ad7dbbb39e0@dronecode.org.uk> (raw)
In-Reply-To: <tencent_248972F194FB6C491C101A513392A31FAD0A@qq.com>

On 29/03/2024 01:40, 赵伟 via Cygwin-apps wrote:
> ---
>   libgetopt++/include/getopt++/DefaultFormatter.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h
> index ee2397f5..43c253a5 100644
> --- a/libgetopt++/include/getopt++/DefaultFormatter.h
> +++ b/libgetopt++/include/getopt++/DefaultFormatter.h
> @@ -64,6 +64,7 @@ class DefaultFormatter {
>          {
>            // TODO: consider using a line breaking strategy here.
>            int pos = helpmsg.substr(0,h_len).find_last_of(" ");
> +         if(!pos)break; /*In Chinese Helpmsg,may has no space,so pos ==0,and code will fall in dead loop here*/
>            theStream &lt;&lt; helpmsg.substr(0,pos)
>                      &lt;&lt; std::endl &lt;&lt; std::string (o_len, ' ');
>            helpmsg.erase (0,pos+1);
> --
> 2.43.0

Thanks very much for bug report, and the patch!

Did you actually try this?  When I tested this it didn't help, as 
std::string::substr() returns std::string::npos (numerically, -1), not 0 
when it cannot find a match.

So, I applied a slightly modified version of the patch.

Please try https://cygwin.com/setup/setup-2.931-1-g0ee13c.x86_64.exe


  parent reply	other threads:[~2024-03-29 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-29  1:40 =?gb18030?B?1dTOsA==?=
2024-03-29  3:48 ` Brian Inglis
2024-03-29 16:32 ` Jon Turney [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-29  1:35 =?gb18030?B?1dTOsA==?=

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc483453-a3e5-4a1c-bd76-5ad7dbbb39e0@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    --cc=qdzhaov@qq.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).