You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by plasma <pl...@ms9.hinet.net> on 2005/02/22 15:18:44 UTC

Unable to rename a directory from English to T.Chinese

Hi all,

This problem was reported from a user, and I confirmed it.

The recipe:

  svnadmin create --fs-type fsfs SVN_ROOT
  svn co file://`pwd`/SVN_ROOT foo
  cd foo
  touch BugReport
  svn add BugReport
  svn commit -m "A new file"
  svn mv BugReport 'Bug及建議'
  svn commit -m "Rename a file to TC name"  # Works fine.
  svn rm 'Bug及建議'
  svn commit -m "Remove a TC-named file"
  svn up
  svn mkdir BugReport
  svn commit -m "A new directory"
  svn mv BugReport 'Bug及建議'  # Rename a directory to TC name.  It barks.

If a file's name is English, and renamed to Big5, it works just fine.
If do the same operation to a directory, it fails:

  plasma@plasmanb:~/tmp/xyz/foo(0)> svn mv BugReport 'Bug及建議'
  subversion/libsvn_subr/utf.c:363: (apr_err=22)
  svn: Can't recode string

And there are two directories in the WC:

  plasma@plasmanb:~/tmp/xyz/foo(1)> ll
  total 6
  drwxrwxr-x    7 plasma   plasma        512  2 22 23:14 .svn
  drwxrwxr-x    3 plasma   plasma        512  2 22 23:14 Bug及建議
  drwxrwxr-x    3 plasma   plasma        512  2 22 23:14 BugReport

Since renaming a file works fine, I think it's a bug in Subversion.

My platform is FreeBSD, and the one who reported this problem uses
Linux.  Both of us use Subversion 1.1.3.  And locale settings from my
FreeBSD box:

  plasma@plasmanb:~/tmp/xyz/foo(0)> env | grep LC
  LC_TIME=zh_TW.Big5
  LC_CTYPE=zh_TW.Big5
  LC_MESSAGES=zh_TW.Big5
  LC_ALL=zh_TW.Big5

Below is backtrace from gdb:

plasma@plasmanb:~/tmp/xyz/foo(0)> gdb svn
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) directory ~/tmp/1.1.x
Source directories searched: /home/plasma/tmp/1.1.x:$cdir:$cwd
(gdb) b utf.c:363
No source file named utf.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (utf.c:363) pending.
(gdb) run mv BugReport 'Bug及建議'
Starting program: /usr/local/bin/svn mv BugReport 'Bug及建議'
Breakpoint 2 at 0x281a1c0e: file subversion/libsvn_subr/utf.c, line 363.
Pending breakpoint "utf.c:363" resolved

Breakpoint 2, convert_to_stringbuf (convset=0x80700d0, src_data=0x808d348 "Bug嫹217\212撱箄降/.svn/lock", src_length=22,
    dest=0xbfbfe05c, pool=0x808d018) at subversion/libsvn_subr/utf.c:363
warning: Source file is more recent than executable.

363         return svn_error_create (apr_err, NULL, "Can't recode string");
(gdb) bt
#0  convert_to_stringbuf (convset=0x80700d0, src_data=0x808d348 "Bug嫹217\212撱箄降/.svn/lock", src_length=22,
    dest=0xbfbfe05c, pool=0x808d018) at subversion/libsvn_subr/utf.c:363
#1  0x281a236a in convert_cstring (dest=0xbfbfe0fc, src=0x808d348 "Bug嫹217\212撱箄降/.svn/lock", convset=0x80700d0,
    pool=0x808d018) at subversion/libsvn_subr/utf.c:551
#2  0x281a244a in svn_utf_cstring_to_utf8 (dest=0xbfbfe0fc, src=0x808d348 "Bug嫹217\212撱箄降/.svn/lock", pool=0x808d018)
    at subversion/libsvn_subr/utf.c:574
#3  0x2819b655 in svn_path_cstring_to_utf8 (path_utf8=0xbfbfe0fc, path_apr=0x808d348 "Bug嫹217\212撱箄降/.svn/lock",
    pool=0x808d018) at subversion/libsvn_subr/path.c:1250
#4  0x28193d6b in svn_io_copy_dir_recursively (src=0x80872b8 "BugReport/.svn", dst_parent=0x808ade8 "Bug嫹217\212撱箄降",
    dst_basename=0x80872f0 ".svn", copy_perms=1, cancel_func=0x804fb50 <svn_cl__check_cancel>, cancel_baton=0x0,
    pool=0x8087018) at subversion/libsvn_subr/io.c:681
#5  0x28193f01 in svn_io_copy_dir_recursively (src=0x8074d18 "BugReport", dst_parent=0x8074fa8 "",
    dst_basename=0x8074eb0 "Bug嫹217\212撱箄降", copy_perms=1, cancel_func=0x804fb50 <svn_cl__check_cancel>,
    cancel_baton=0x0, pool=0x8073018) at subversion/libsvn_subr/io.c:701
#6  0x280cbdf6 in copy_dir_administratively (src_path=0x8074d18 "BugReport", src_access=0x808aa60, dst_parent=0x8074f80,
    dst_basename=0x8074eb0 "Bug嫹217\212撱箄降", cancel_func=0x804fb50 <svn_cl__check_cancel>, cancel_baton=0x0,
    notify_copied=0x8051e90 <notify>, notify_baton=0x8074dd8, pool=0x8073018) at subversion/libsvn_wc/copy.c:319
#7  0x280cc099 in svn_wc_copy (src_path=0x8074d18 "BugReport", dst_parent=0x8074f80,
    dst_basename=0x8074eb0 "Bug嫹217\212撱箄降", cancel_func=0x804fb50 <svn_cl__check_cancel>, cancel_baton=0x0,
    notify_func=0x8051e90 <notify>, notify_baton=0x8074dd8, pool=0x8073018) at subversion/libsvn_wc/copy.c:389
#8  0x280a5f3b in wc_to_wc_copy (src_path=0x8074d18 "BugReport", dst_path=0x8074db8 "Bug嫹217\212撱箄降", is_move=1,
    force=0, ctx=0x8073510, pool=0x8073018) at subversion/libsvn_client/copy.c:157
#9  0x280a80fe in setup_copy (commit_info=0xbfbfe3f0, src_path=0x8074d18 "BugReport", src_revision=0xbfbfe5ec,
    dst_path=0x8074db8 "Bug嫹217\212撱箄降", is_move=1, force=0, ctx=0x8073510, pool=0x8073018)
    at subversion/libsvn_client/copy.c:1096
#10 0x280a8293 in svn_client_move (commit_info=0xbfbfe3f0, src_path=0x8074d18 "BugReport", src_revision=0xbfbfe5ec,
    dst_path=0x8074db8 "Bug嫹217\212撱箄降", force=0, ctx=0x8073510, pool=0x8073018) at subversion/libsvn_client/copy.c:1151
#11 0x08051e12 in svn_cl__move (os=0x8073050, baton=0xbfbfe4e4, pool=0x8073018) at subversion/clients/cmdline/move-cmd.c:68
#12 0x08051376 in main (argc=4, argv=0xbfbfe6fc) at subversion/clients/cmdline/main.c:1332

If you need any further information, don't be hestitated to ask.


plasma

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

Re: Unable to rename a directory from English to T.Chinese

Posted by Philip Martin <ph...@codematters.co.uk>.
Philip Martin <ph...@codematters.co.uk> writes:

> Yes, that looks like a bug in svn_io_copy_dir_recursively.

Fixed on the trunk by r13111.

-- 
Philip Martin

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

Re: Unable to rename a directory from English to T.Chinese

Posted by Philip Martin <ph...@codematters.co.uk>.
plasma <pl...@ms9.hinet.net> writes:

> If a file's name is English, and renamed to Big5, it works just fine.
> If do the same operation to a directory, it fails:
>
>   plasma@plasmanb:~/tmp/xyz/foo(0)> svn mv BugReport 'Bug¤Î«Øij'
>   subversion/libsvn_subr/utf.c:363: (apr_err=22)
>   svn: Can't recode string

Yes, that looks like a bug in svn_io_copy_dir_recursively.  The
current code looks like:

      /* Telescope the entryname onto the source dir. */
      src_target = svn_path_join (src, this_entry.name, subpool);
      SVN_ERR (svn_path_cstring_to_utf8 (&src_target_utf8, src_target,
                                         subpool));
  
but src is already in UTF-8, thus src_target is inconsistent and the
conversion is invalid.  I think the code should be more like:

      SVN_ERR (svn_path_cstring_to_utf8 (&entry_utf8, this_entry.name, ...));
      src_target = svn_path_join (src, entry_utf8, ...));

with something similar to construct dst_target.

-- 
Philip Martin

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