【help】why not support showing filename containing chinese characters with the ls function?
Hi,everyone: As the subject says, why chinese characters are shown as '?' by using ls function? Did anyone encounter the same problem and does resolution exist? Looking forward to your reply. Thanks in advance.
On Tue, May 22, 2012 at 05:34:40PM +0800, 马磊 wrote:
Hi,everyone: As the subject says, why chinese characters are shown as '?' by using ls function? Did anyone encounter the same problem and does resolution exist? Looking forward to your reply. Thanks in advance.
<fs> ls / bin boot dev etc home
I tried this, and it works for me: $ qemu-img create -f qcow2 -b /dev/vg_pin/F16x64 chinese-chars.img Formatting 'chinese-chars.img', fmt=qcow2 size=21474836480 backing_file='/dev/vg_pin/F16x64' encryption=off cluster_size=65536 $ guestfish -a chinese-chars.img -i touch "/马磊" $ guestfish --ro -a chinese-chars.img -i Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell Operating system: Fedora release 16 (Verne) /dev/mapper/vg_f16x64-lv_root mounted on / /dev/vda2 mounted on /boot lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var 马磊
<fs> ll / total 126 dr-xr-xr-x. 23 root root 4096 May 22 11:10 . drwxr-xr-x 23 500 500 4096 May 22 11:11 .. dr-xr-xr-x. 2 root root 4096 Mar 6 11:18 bin dr-xr-xr-x. 6 root root 1024 Jan 25 09:47 boot drwxr-xr-x. 5 root root 4096 Aug 16 2011 dev drwxr-xr-x. 135 root root 12288 Apr 18 13:40 etc drwxr-xr-x. 3 root root 4096 Jul 29 2011 home dr-xr-xr-x. 11 root root 4096 Nov 28 15:19 lib dr-xr-xr-x. 11 root root 12288 Mar 6 11:18 lib64 drwx------. 2 root root 16384 Aug 16 2011 lost+found drwxr-xr-x. 2 root root 4096 Jun 29 2011 media drwxr-xr-x. 4 root root 4096 Nov 28 14:22 mnt drwxr-xr-x. 2 root root 4096 Jul 29 2011 opt drwxrwxr-x 2 root root 4096 Aug 16 2011 proc dr-xr-x---. 6 root root 4096 Nov 25 08:44 root drwxr-xr-x. 21 root root 4096 Aug 16 2011 run dr-xr-xr-x. 2 root root 12288 Mar 6 11:18 sbin drwxr-xr-x 3 root root 4096 Jun 29 2011 selinux drwxr-xr-x. 2 root root 4096 Jul 29 2011 srv drwxrwxr-x. 2 root root 4096 Aug 16 2011 sys drwxrwxrwt. 10 root root 4096 Apr 18 13:40 tmp drwxr-xr-x. 13 root root 4096 Aug 28 2011 usr drwxr-xr-x. 18 root root 4096 Aug 28 2011 var -rw-r--r-- 1 root root 0 May 22 11:10 马磊
What are your language settings, eg. the locale and the environment variables $LANG etc? You can find out by running the 'locale' command: $ locale LANG=en_GB.UTF-8 LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL= If you can reproduce this issue, please file a bug: https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
<fs> mount-options '' /dev/vda1 /
Hi, I tested again! The result is as follows: ================================== [malei@xen-test2 ~]$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= [malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img -i guestfish: no operating system was found on this disk [malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell libguestfs: error: mount_options: call launch before using this function (in guestfish, don't forget to use the 'run' command)
<fs> launch <fs> mount-options '' /dev/vda1 / <fs> ls / ?? ????.txt ?? ????.wav ?? WinRAR ZIP ????.zip root1 root2 <fs> =============================================== Does it have something to do with the LANG environment variable or the disk img which is not bootable?
On Tue, May 22, 2012 at 6:14 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Tue, May 22, 2012 at 05:34:40PM +0800, 马磊 wrote:
Hi,everyone: As the subject says, why chinese characters are shown as '?' by using ls function? Did anyone encounter the same problem and does resolution exist? Looking forward to your reply. Thanks in advance.
I tried this, and it works for me:
$ qemu-img create -f qcow2 -b /dev/vg_pin/F16x64 chinese-chars.img Formatting 'chinese-chars.img', fmt=qcow2 size=21474836480 backing_file='/dev/vg_pin/F16x64' encryption=off cluster_size=65536 $ guestfish -a chinese-chars.img -i touch "/马磊" $ guestfish --ro -a chinese-chars.img -i
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
Operating system: Fedora release 16 (Verne) /dev/mapper/vg_f16x64-lv_root mounted on / /dev/vda2 mounted on /boot
<fs> ls / bin boot dev etc home lib lib64 lost+found media mnt opt proc root run sbin selinux srv sys tmp usr var 马磊 <fs> ll / total 126 dr-xr-xr-x. 23 root root 4096 May 22 11:10 . drwxr-xr-x 23 500 500 4096 May 22 11:11 .. dr-xr-xr-x. 2 root root 4096 Mar 6 11:18 bin dr-xr-xr-x. 6 root root 1024 Jan 25 09:47 boot drwxr-xr-x. 5 root root 4096 Aug 16 2011 dev drwxr-xr-x. 135 root root 12288 Apr 18 13:40 etc drwxr-xr-x. 3 root root 4096 Jul 29 2011 home dr-xr-xr-x. 11 root root 4096 Nov 28 15:19 lib dr-xr-xr-x. 11 root root 12288 Mar 6 11:18 lib64 drwx------. 2 root root 16384 Aug 16 2011 lost+found drwxr-xr-x. 2 root root 4096 Jun 29 2011 media drwxr-xr-x. 4 root root 4096 Nov 28 14:22 mnt drwxr-xr-x. 2 root root 4096 Jul 29 2011 opt drwxrwxr-x 2 root root 4096 Aug 16 2011 proc dr-xr-x---. 6 root root 4096 Nov 25 08:44 root drwxr-xr-x. 21 root root 4096 Aug 16 2011 run dr-xr-xr-x. 2 root root 12288 Mar 6 11:18 sbin drwxr-xr-x 3 root root 4096 Jun 29 2011 selinux drwxr-xr-x. 2 root root 4096 Jul 29 2011 srv drwxrwxr-x. 2 root root 4096 Aug 16 2011 sys drwxrwxrwt. 10 root root 4096 Apr 18 13:40 tmp drwxr-xr-x. 13 root root 4096 Aug 28 2011 usr drwxr-xr-x. 18 root root 4096 Aug 28 2011 var -rw-r--r-- 1 root root 0 May 22 11:10 马磊
What are your language settings, eg. the locale and the environment variables $LANG etc? You can find out by running the 'locale' command:
$ locale LANG=en_GB.UTF-8 LC_CTYPE="en_GB.UTF-8" LC_NUMERIC="en_GB.UTF-8" LC_TIME="en_GB.UTF-8" LC_COLLATE="en_GB.UTF-8" LC_MONETARY="en_GB.UTF-8" LC_MESSAGES="en_GB.UTF-8" LC_PAPER="en_GB.UTF-8" LC_NAME="en_GB.UTF-8" LC_ADDRESS="en_GB.UTF-8" LC_TELEPHONE="en_GB.UTF-8" LC_MEASUREMENT="en_GB.UTF-8" LC_IDENTIFICATION="en_GB.UTF-8" LC_ALL=
If you can reproduce this issue, please file a bug:
https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools
Thanks, Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
On Tue, May 22, 2012 at 06:38:45PM +0800, 马磊 wrote:
[malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> mount-options '' /dev/vda1 / libguestfs: error: mount_options: call launch before using this function (in guestfish, don't forget to use the 'run' command) <fs> launch <fs> mount-options '' /dev/vda1 / <fs> ls / ?? ????.txt ?? ????.wav ?? WinRAR ZIP ????.zip root1 root2 <fs> =============================================== Does it have something to do with the LANG environment variable or the disk img which is not bootable?
I guess this is a FAT or VFAT image? (Try the 'list-filesystems' command). There are several bugs, they even prevent me from creating such an image to start with :-( I have filed these: https://bugzilla.redhat.com/show_bug.cgi?id=823885 https://bugzilla.redhat.com/show_bug.cgi?id=823887 How large is 'd.img'? Would it be possible for me to get a copy of it, or of a similar image that fails in the same way? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
On Tue, May 22, 2012 at 7:37 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Tue, May 22, 2012 at 06:38:45PM +0800, 马磊 wrote:
[malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> mount-options '' /dev/vda1 / libguestfs: error: mount_options: call launch before using this function (in guestfish, don't forget to use the 'run' command) <fs> launch <fs> mount-options '' /dev/vda1 / <fs> ls / ?? ????.txt ?? ????.wav ?? WinRAR ZIP ????.zip root1 root2 <fs> =============================================== Does it have something to do with the LANG environment variable or the disk img which is not bootable?
I guess this is a FAT or VFAT image? (Try the 'list-filesystems' command).
There are several bugs, they even prevent me from creating such an image to start with :-( I have filed these:
https://bugzilla.redhat.com/show_bug.cgi?id=823885 https://bugzilla.redhat.com/show_bug.cgi?id=823887
How large is 'd.img'? Would it be possible for me to get a copy of it, or of a similar image that fails in the same way?
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
You're right! The partition containg chinese-character-name files is vfat filesystem. [malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems. Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> run <fs> list_filesystems /dev/vda1: vfat /dev/vda2: ntfs /dev/vda3: ntfs /dev/vda4: unknown /dev/vda5: vfat /dev/vda6: vfat /dev/vda7: ntfs <fs> mount-options /dev/vda2 / mount-options should have 3 parameter(s) type 'help mount-options' for help on mount-options <fs> mount-options '' /dev/vda2 / <fs> ls / System Volume Information root1 root2 新建 WinRAR ZIP 压缩文件.zip 新建 文本文档.txt 新建 波形声音.wav
On Tue, May 22, 2012 at 07:44:04PM +0800, 马磊 wrote:
On Tue, May 22, 2012 at 7:37 PM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Tue, May 22, 2012 at 06:38:45PM +0800, 马磊 wrote:
[malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> mount-options '' /dev/vda1 / libguestfs: error: mount_options: call launch before using this function (in guestfish, don't forget to use the 'run' command) <fs> launch <fs> mount-options '' /dev/vda1 / <fs> ls / ?? ????.txt ?? ????.wav ?? WinRAR ZIP ????.zip root1 root2 <fs> =============================================== Does it have something to do with the LANG environment variable or the disk img which is not bootable?
I guess this is a FAT or VFAT image? (Try the 'list-filesystems' command).
There are several bugs, they even prevent me from creating such an image to start with :-( I have filed these:
https://bugzilla.redhat.com/show_bug.cgi?id=823885 https://bugzilla.redhat.com/show_bug.cgi?id=823887
How large is 'd.img'? Would it be possible for me to get a copy of it, or of a similar image that fails in the same way?
Rich.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v
You're right! The partition containg chinese-character-name files is vfat filesystem. [malei@xen-test2 ~]$ guestfish --rw -a /home/malei/d.img
Welcome to guestfish, the libguestfs filesystem interactive shell for editing virtual machine filesystems.
Type: 'help' for help on commands 'man' to read the manual 'quit' to quit the shell
<fs> run <fs> list_filesystems /dev/vda1: vfat /dev/vda2: ntfs /dev/vda3: ntfs /dev/vda4: unknown /dev/vda5: vfat /dev/vda6: vfat /dev/vda7: ntfs <fs> mount-options /dev/vda2 / mount-options should have 3 parameter(s) type 'help mount-options' for help on mount-options <fs> mount-options '' /dev/vda2 / <fs> ls / System Volume Information root1 root2 新建 WinRAR ZIP 压缩文件.zip 新建 文本文档.txt 新建 波形声音.wav
It'd be great if you could get me / point me to a vfat image that contains Chinese character filenames. One way (assuming this image does not contain sensitive data) is: guestfish --ro -a /home/malei/d.img
<fs> run <fs> download /dev/vda1 - | xz --best > /tmp/vda1.img.xz
and then send me the file /tmp/vda1.img.xz. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or: guestfish --ro -a d.img -m /dev/vda1:/:utf8 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On 05/22/2012 08:07 PM, Richard W.M. Jones wrote:
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or:
guestfish --ro -a d.img -m /dev/vda1:/:utf8
Rich.
<fs> mkfs vfat /dev/vda <fs> mount /dev/vda / <fs> ll / total 20 drwxr-xr-x 2 root root 16384 Jan 1 1970 . drwxr-xr-x 23 1000 1000 4096 May 22 20:07 .. <fs> mkdir /新建文件夹
libguestfs: error: mkdir: /新建文件夹: Invalid argument thanks, Wanlong Gao
On Tue, May 22, 2012 at 08:15:53PM +0800, Wanlong Gao wrote:
On 05/22/2012 08:07 PM, Richard W.M. Jones wrote:
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or:
guestfish --ro -a d.img -m /dev/vda1:/:utf8
Rich.
<fs> mkfs vfat /dev/vda <fs> mount /dev/vda / <fs> ll / total 20 drwxr-xr-x 2 root root 16384 Jan 1 1970 . drwxr-xr-x 23 1000 1000 4096 May 22 20:07 .. <fs> mkdir /新建文件夹 libguestfs: error: mkdir: /新建文件夹: Invalid argument
Yeah, that's the same as: https://bugzilla.redhat.com/show_bug.cgi?id=823887 It works if you add the 'utf8' mount option ... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
On 05/22/2012 08:52 PM, Richard W.M. Jones wrote:
On Tue, May 22, 2012 at 08:15:53PM +0800, Wanlong Gao wrote:
On 05/22/2012 08:07 PM, Richard W.M. Jones wrote:
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or:
guestfish --ro -a d.img -m /dev/vda1:/:utf8
Rich.
<fs> mkfs vfat /dev/vda <fs> mount /dev/vda / <fs> ll / total 20 drwxr-xr-x 2 root root 16384 Jan 1 1970 . drwxr-xr-x 23 1000 1000 4096 May 22 20:07 .. <fs> mkdir /新建文件夹 libguestfs: error: mkdir: /新建文件夹: Invalid argument
Yeah, that's the same as:
https://bugzilla.redhat.com/show_bug.cgi?id=823887
It works if you add the 'utf8' mount option ...
Yeah, it works for me. ;) Thanks, Wanlong Gao
Rich.
On 05/22/2012 08:07 PM, Richard W.M. Jones wrote:
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or:
guestfish --ro -a d.img -m /dev/vda1:/:utf8
Rich.
It's may because our qemu locale is "C" but not "en_US.utf8".
<fs> debug sh "export LC_ALL=en_US.utf8" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): No such file or directory /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8) <fs> debug sh "locale" LANG= LC_CTYPE="C" LC_NUMERIC="C" LC_TIME="C" LC_COLLATE="C" LC_MONETARY="C" LC_MESSAGES="C" LC_PAPER="C" LC_NAME="C" LC_ADDRESS="C" LC_TELEPHONE="C" LC_MEASUREMENT="C" LC_IDENTIFICATION="C" LC_ALL=C
Thanks, Wanlong Gao
On Tue, May 22, 2012 at 08:35:19PM +0800, Wanlong Gao wrote:
On 05/22/2012 08:07 PM, Richard W.M. Jones wrote:
BTW, although this is not a proper solution, using the 'utf8' mount option should work, ie:
<fs> mount-options utf8 /dev/vda1 /
or:
guestfish --ro -a d.img -m /dev/vda1:/:utf8
Rich.
It's may because our qemu locale is "C" but not "en_US.utf8".
<fs> debug sh "export LC_ALL=en_US.utf8" /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8): No such file or directory /bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)
Unfortunately this won't set the daemon's environment. For debugging purposes *only*(!), I added a 'debug setenv' command: https://github.com/libguestfs/libguestfs/commit/87d604f88c44f891a338349e2b01... Also, this doesn't seem to help ...
<fs> debug setenv 'LANG en_US.UTF8' ok <fs> debug env '' | grep LANG LANG=en_US.UTF8 <fs> ll / total 20 drwxr-xr-x 2 root root 16384 Jan 1 1970 . drwxr-xr-x 23 1000 1000 4096 May 22 13:48 .. -rwxr-xr-x 1 root root 0 May 22 13:03 ??
Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw
participants (3)
-
Richard W.M. Jones -
Wanlong Gao -
马磊