You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Rock Sun <da...@gmail.com> on 2008/11/12 05:43:19 UTC

[PATCH] bug fix for df command error when view conflicts interactively

When we set locale as zh_CN.GBK and view conflict differences interactively
with '(df) diff-full' command. We will get a errors like below:

svn: Valid UTF-8 data
(hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73 65 09)
followed by invalid UTF-8 sequence
(hex: d0 c7 c6 da)

I find the invalid sequence is a date string in Chinese. So I view the
source code , I find
the original code has not transform the date string into UTF-8  before
pass it to other
string. So when we want to transform it into local encoding as  UTF-8,
we get the
errors.

I contribute the patch just to encode the date string as UTF-8 before
it passed to
other strings.


Index: libsvn_diff/diff_file.c
===================================================================
--- libsvn_diff/diff_file.c     (revision 34024)
+++ libsvn_diff/diff_file.c     (working copy)
@@ -1116,6 +1116,8 @@
   apr_time_exp_t exploded_time;
   char time_buffer[64];
   apr_size_t time_len;
+  const char *utf8_timestr;
+

   SVN_ERR(svn_io_stat(&file_info, path, APR_FINFO_MTIME, pool));
   apr_time_exp_lt(&exploded_time, file_info.mtime);
@@ -1123,8 +1125,10 @@
   apr_strftime(time_buffer, &time_len, sizeof(time_buffer) - 1,
                "%a %b %e %H:%M:%S %Y", &exploded_time);

-  *header = apr_psprintf(pool, "%s\t%s", path, time_buffer);
+  SVN_ERR(svn_utf_cstring_to_utf8(&utf8_timestr, time_buffer, pool));

+  *header = apr_psprintf(pool, "%s\t%s", path, utf8_timestr);
+
   return SVN_NO_ERROR;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Julian Foad <ju...@btopenworld.com>.
On Fri, 2008-11-14 at 21:03 +0100, Arfrever Frehtes Taifersar Arahesis
wrote:
> 2008-11-13 14:13:00 Julian Foad napisał(a):
> > On Wed, 2008-11-12 at 13:43 +0800, Rock Sun wrote:
> > > When we set locale as zh_CN.GBK and view conflict differences interactively
> > > with '(df) diff-full' command. We will get a errors like below:
> > > 
> > > svn: Valid UTF-8 data
> > > (hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73 65 09)
> > > followed by invalid UTF-8 sequence
> > > (hex: d0 c7 c6 da)
> > > 
> > > I find the invalid sequence is a date string in Chinese. So I view the
> > > source code , I find
> > > the original code has not transform the date string into UTF-8  before
> > > pass it to other
> > > string. So when we want to transform it into local encoding as  UTF-8,
> > > we get the
> > > errors.
> > > 
> > > I contribute the patch just to encode the date string as UTF-8 before
> > > it passed to
> > > other strings.
> > 
> > Rock Sun,
> > 
> > Thank you very much for this patch. I reviewed, partially tested (in
> > English and French locales, and in zh_CN.GBK verified that it outputs
> > something not an error), and committed it in r34171.
> > 
> > This will be fixed in Subversion 1.6.0. I have also nominated it for
> > back-port to 1.5.x, so it may be in the next 1.5.x release.
> 
> You haven't nominated it yet :) .

Ahhh. Thanks for noticing and telling me. Nominated in r34202 (after a
false start in r34200/34201).

- Julian



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Arfrever Frehtes Taifersar Arahesis <ar...@gmail.com>.
2008-11-13 14:13:00 Julian Foad napisał(a):
> On Wed, 2008-11-12 at 13:43 +0800, Rock Sun wrote:
> > When we set locale as zh_CN.GBK and view conflict differences interactively
> > with '(df) diff-full' command. We will get a errors like below:
> > 
> > svn: Valid UTF-8 data
> > (hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73 65 09)
> > followed by invalid UTF-8 sequence
> > (hex: d0 c7 c6 da)
> > 
> > I find the invalid sequence is a date string in Chinese. So I view the
> > source code , I find
> > the original code has not transform the date string into UTF-8  before
> > pass it to other
> > string. So when we want to transform it into local encoding as  UTF-8,
> > we get the
> > errors.
> > 
> > I contribute the patch just to encode the date string as UTF-8 before
> > it passed to
> > other strings.
> 
> Rock Sun,
> 
> Thank you very much for this patch. I reviewed, partially tested (in
> English and French locales, and in zh_CN.GBK verified that it outputs
> something not an error), and committed it in r34171.
> 
> This will be fixed in Subversion 1.6.0. I have also nominated it for
> back-port to 1.5.x, so it may be in the next 1.5.x release.

You haven't nominated it yet :) .

-- 
Arfrever Frehtes Taifersar Arahesis

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Rock Sun <da...@gmail.com>.
julian:

Thank you very much.

2008/11/13 Julian Foad <ju...@btopenworld.com>

> On Wed, 2008-11-12 at 13:43 +0800, Rock Sun wrote:
> > When we set locale as zh_CN.GBK and view conflict differences
> interactively
> > with '(df) diff-full' command. We will get a errors like below:
> >
> > svn: Valid UTF-8 data
> > (hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73
> 65 09)
> > followed by invalid UTF-8 sequence
> > (hex: d0 c7 c6 da)
> >
> > I find the invalid sequence is a date string in Chinese. So I view the
> > source code , I find
> > the original code has not transform the date string into UTF-8  before
> > pass it to other
> > string. So when we want to transform it into local encoding as  UTF-8,
> > we get the
> > errors.
> >
> > I contribute the patch just to encode the date string as UTF-8 before
> > it passed to
> > other strings.
>
> Rock Sun,
>
> Thank you very much for this patch. I reviewed, partially tested (in
> English and French locales, and in zh_CN.GBK verified that it outputs
> something not an error), and committed it in r34171.
>
> This will be fixed in Subversion 1.6.0. I have also nominated it for
> back-port to 1.5.x, so it may be in the next 1.5.x release.
>
>
>
>


-- 
My Blog: http://rocksun.cn/
My Site: http://www.subversion.org.cn

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Julian Foad <ju...@btopenworld.com>.
On Wed, 2008-11-12 at 13:43 +0800, Rock Sun wrote:
> When we set locale as zh_CN.GBK and view conflict differences interactively
> with '(df) diff-full' command. We will get a errors like below:
> 
> svn: Valid UTF-8 data
> (hex: 65 78 74 2d 62 61 73 65 2f 61 2e 74 78 74 2e 73 76 6e 2d 62 61 73 65 09)
> followed by invalid UTF-8 sequence
> (hex: d0 c7 c6 da)
> 
> I find the invalid sequence is a date string in Chinese. So I view the
> source code , I find
> the original code has not transform the date string into UTF-8  before
> pass it to other
> string. So when we want to transform it into local encoding as  UTF-8,
> we get the
> errors.
> 
> I contribute the patch just to encode the date string as UTF-8 before
> it passed to
> other strings.

Rock Sun,

Thank you very much for this patch. I reviewed, partially tested (in
English and French locales, and in zh_CN.GBK verified that it outputs
something not an error), and committed it in r34171.

This will be fixed in Subversion 1.6.0. I have also nominated it for
back-port to 1.5.x, so it may be in the next 1.5.x release.

- Julian

> 
> Index: libsvn_diff/diff_file.c
> ===================================================================
> --- libsvn_diff/diff_file.c     (revision 34024)
> +++ libsvn_diff/diff_file.c     (working copy)
> @@ -1116,6 +1116,8 @@
>    apr_time_exp_t exploded_time;
>    char time_buffer[64];
>    apr_size_t time_len;
> +  const char *utf8_timestr;
> +
> 
>    SVN_ERR(svn_io_stat(&file_info, path, APR_FINFO_MTIME, pool));
>    apr_time_exp_lt(&exploded_time, file_info.mtime);
> @@ -1123,8 +1125,10 @@
>    apr_strftime(time_buffer, &time_len, sizeof(time_buffer) - 1,
>                 "%a %b %e %H:%M:%S %Y", &exploded_time);
> 
> -  *header = apr_psprintf(pool, "%s\t%s", path, time_buffer);
> +  SVN_ERR(svn_utf_cstring_to_utf8(&utf8_timestr, time_buffer, pool));
> 
> +  *header = apr_psprintf(pool, "%s\t%s", path, utf8_timestr);
> +
>    return SVN_NO_ERROR;
>  }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Rock Sun <da...@gmail.com>.
2008/11/13 Daniel Shahaf <d....@daniel.shahaf.name>

> Rock Sun wrote on Thu, 13 Nov 2008 at 13:51 +0800:
> > Sorry, I have send six mails in user and dev list,
> > but I could not get any response. Why?
> >
>
> Because no one has had time to look at it yet (most work goes to
> stabilizing 1.6 right now).  The patch itself looks good.  (I can't tell
> if it's the correct fix without reading the context, though, since I'm a
> little suspicious at encoding just one part of one string.)


I think it is a bug should be fixed as quickly as possible.

>
>
> Also, the submission didn't follow all the guidelines in
> hacking.html#patches (e.g., wasn't generated from the wc root,
> no log message) -- please watch for these next time.
>

Sorry, I also changed something else, so I make this patch not from
the root. Ok, I will fill the log message next time.

>
> Thanks for the patch,
>
> Daniel
>

Thanks.



>
> >
> >
> >
>



-- 
My Blog: http://rocksun.cn/
My Site: http://www.subversion.org.cn

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Rock Sun wrote on Thu, 13 Nov 2008 at 13:51 +0800:
> Sorry, I have send six mails in user and dev list,
> but I could not get any response. Why?
> 

Because no one has had time to look at it yet (most work goes to 
stabilizing 1.6 right now).  The patch itself looks good.  (I can't tell 
if it's the correct fix without reading the context, though, since I'm a 
little suspicious at encoding just one part of one string.)

Also, the submission didn't follow all the guidelines in 
hacking.html#patches (e.g., wasn't generated from the wc root,
no log message) -- please watch for these next time.

Thanks for the patch,

Daniel

> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] bug fix for df command error when view conflicts interactively

Posted by Rock Sun <da...@gmail.com>.
Sorry, I have send six mails in user and dev list,
but I could not get any response. Why?



-- 
My Blog: http://rocksun.cn/
My Site: http://www.subversion.org.cn