Fix broken filenames and timestamps on really poor busybox devices.

This good patch for FISH'ing to devices like my D-Link-500T :)

'busybox ls -lan'  and native 'ls -lan' is different. For example

$ busybox ls -lan /dev

drwxr-xr-x    1 0  0  0     0      0 Jan  1  1970 .
drwxrwxrwx    1 0  0  0     0      68 Dec 12  2007 ..
crw-------    1 0  0  0     0 8,   0 Jan  1  1970 .devfsd
crw-------    1 0  0  0     0 5,   1 Jan  1 12:01 console
crw-rw-rw-    1 0  0  0     0 1,   7 Jan  1  1970 full
...

and
$ ls -lan /dev
drwxr-xr-x  12 0   0     4340 Ноя 20 09:33 .
drwxr-xr-x  23 0   0     4096 Июл 29  2004 ..
crw-rw----+  1 0   0  14,  12 Июл 29  2004 adsp
crw-------   1 0   0  10, 175 Июл 29  2004 agpgart
crw-rw----+  1 0   0  14,   4 Июл 29  2004 audio

output of 'busybox ls' have two additional columns, therefore
names on filesystem shows like:
/1 12:00 proc
/1 1970 dev
/12 2007 bin
/12 2007 etc
/12 2007 lib
/12 2007 sbin
...

This patch will fix it behavior.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2009-11-25 11:37:01 +02:00
parent 11928eeff0
commit 4fc08a729e
1 changed files with 12 additions and 2 deletions

View File

@ -456,7 +456,12 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
"ADD=1;\n"
"fi\n"
"ls $LSOPT /%s 2>/dev/null | grep '^[^cbt]' | (\n"
"while read p l u g s m d y n; do\n"
"while read p l u g s m d y n n2 n3; do\n"
"if test \"$m\" = \"0\" ; then \n"
"s=$d; m=$y; d=$n y=$n2; n=$n3\n"
"else\n"
"n=$n\" \"$n2\" \"n3\n"
"fi\n"
"if [ $ADD = 0 ]; then\n"
"echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
"elif `sed --version >/dev/null 2>&1` ; then\n"
@ -468,7 +473,12 @@ fish_dir_load(struct vfs_class *me, struct vfs_s_inode *dir, char *remote_path)
"fi\n"
"done )\n"
"ls $LSOPT /%s 2>/dev/null | grep '^[cb]' | (\n"
"while read p l u g a i m d y n; do\n"
"while read p l u g a i m d y n n2 n3; do\n"
"if test \"$a\" = \"0\" ; then \n"
"a=$m; i=$d; m=$y; d=$n y=$n2; n=$n3\n"
"else\n"
"n=$n\" \"$n2\" \"n3\n"
"fi\n"
"if [ $ADD = 0 ]; then\n"
"echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
"elif `sed --version >/dev/null 2>&1` ; then\n"