'ls' output with '\"\ \ ' on 1.18.4 - problem with dropbear+mc
Denys Vlasenko
vda.linux at googlemail.com
Sat Apr 2 22:31:15 UTC 2011
> 2011/4/2 Tomasz Czapiewski <xeros at irc.pl>:
>> Hi,
>> I have replaced BusyBox 1.2.1 with 1.18.1 yestarday on one embedded machine
>> and I've encountered problems using FISH connection from Midnight Commander
>> on PC to Dropbear SSH server on embedded machine.
>>
>> All the file and dir names (including '.' and '..') are ending with:
>> '\"\ \ ' - quotation mark (interted commas) and two spaces.
>>
>> Unfortunately I don't know how MC executes 'ls' command (which arguments).
>> I couldn't get the problematic output with 'ls' or 'ls -al' or other
>> arguments so can't track where's the problem myself.
>>
>> BusyBox 1.18.1 (before upgrade, on 1.2.1 everything was fine)
>> Midnight Commander 4.7.0.6
> On Saturday 02 April 2011 21:59, Tomasz Czapiewski wrote:
> On Sat, 2 Apr 2011, Sergey Naumov wrote:
>
> > It seems that it is problem of new mc. I have similar problems with mc
> > from Debian 6.0.0 and openssh. mc from debian 5.0.0 works fine with my
> > busybox-based system.
> >
> > Sergey Naumov.
>
> Thanks for info, but I haven't upgraded MC in last few moths (it's default
> one in Kubuntu 10.10) and it worked without any problems with older
> BusyBox. I can only assume that there were any used by MC parameters which
> older BusyBox was missing and MC haven't used them. Is there already known
> workaround for this problem?
>
> Here's the strace log from current connection (cut the key exchange and
> password verification at the beginning):
> http://www.mediafire.com/?zydc5kkqtb66o2c
$ grep 'execve.*ls' LOG-dropbear-fish-shell.log
860 execve("/bin/ls", ["ls", "-1", "/"], [/* 10 vars */] <unfinished ...>
861 execve("/bin/ls", ["ls", "-Q", "/"], [/* 10 vars */]) = 0
862 execve("/bin/ls", ["ls", "-Qlan", "/"], [/* 10 vars */] <unfinished ...>
865 execve("/bin/ls", ["ls", "-Qlan", "/"], [/* 10 vars */] <unfinished ...>
869 execve("/bin/ls", ["ls", "-1", "//bin"], [/* 10 vars */] <unfinished ...>
870 execve("/bin/ls", ["ls", "-Q", "//bin"], [/* 10 vars */]) = 0
871 execve("/bin/ls", ["ls", "-Qlan", "//bin"], [/* 10 vars */] <unfinished ...>
874 execve("/bin/ls", ["ls", "-Qlan", "//bin"], [/* 10 vars */] <unfinished ...>
878 execve("/bin/ls", ["ls", "-1", "//mnt"], [/* 10 vars */] <unfinished ...>
879 execve("/bin/ls", ["ls", "-Q", "//mnt"], [/* 10 vars */] <unfinished ...>
880 execve("/bin/ls", ["ls", "-Qlan", "//mnt"], [/* 10 vars */] <unfinished ...>
883 execve("/bin/ls", ["ls", "-Qlan", "//mnt"], [/* 10 vars */]) = 0
887 execve("/bin/ls", ["ls", "-1", "/tmp"], [/* 10 vars */] <unfinished ...>
888 execve("/bin/ls", ["ls", "-Q", "/tmp"], [/* 10 vars */]) = 0
889 execve("/bin/ls", ["ls", "-Qlan", "/tmp"], [/* 10 vars */] <unfinished ...>
892 execve("/bin/ls", ["ls", "-Qlan", "/tmp"], [/* 10 vars */] <unfinished ...>
897 execve("/bin/ls", ["ls", "-1", "/tmp/.stagecraft\" "], [/* 10 vars */] <unfinished ...>
It uses -Q.
busybox 1.2.1 didn't have -Q at all. Probably mc was detecting that
and used some other method. Now it uses -Q (because it is supported, but isn't
happy with results.
Let's check how it ended up using '.stagecraft" '
$ grep 'stagecraft' LOG-dropbear-fish-shell.log
889 lstat64("/tmp/.stagecraft", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
891 write(1, "Pdrwxrwxrwx 0.0\nS0\ndJan 1 00:00\n:\".stagecraft\" \n\n", 50) = 50
892 lstat64("/tmp/.stagecraft", {st_mode=S_IFDIR|0777, st_size=0, ...}) = 0
855 write(7, "#LIST /tmp/.stagecraft\\\"\\ \\ \nif `perl -v > /dev/null 2>&1` ; then\nperl -e '\nuse strict;\nuse POSIX;\n"..., 2216) = 2216
858 <... read resumed> "#LIST /tmp/.stagecraft\\\"\\ \\ \nif `perl -v > /dev/null 2>&1` ; then\nperl -e '\nuse strict;\nuse POSIX;\n"..., 1023) = 1023
858 read(0, "osedir(DIR);\n} else {\nprintf(\"### 500\\n\");\n}\nexit 0\n' /tmp/.stagecraft\\\"\\ \\ ||\n echo '### 500'\n"..., 1023) = 1023
897 execve("/bin/ls", ["ls", "-1", "/tmp/.stagecraft\" "], [/* 10 vars */] <unfinished ...>
897 lstat64("/tmp/.stagecraft\" ", 0x7fa51a38) = -1 ENOENT (No such file or directory)
897 write(2, "ls: /tmp/.stagecraft\" : No such file or directory\n", 51) = 51
The second line above is fishy. Let's see where it comes from:
891 read(0, "d", 1) = 1
891 read(0, "r", 1) = 1
891 read(0, "w", 1) = 1
891 read(0, "x", 1) = 1
891 read(0, "r", 1) = 1
891 read(0, "w", 1) = 1
891 read(0, "x", 1) = 1
891 read(0, "r", 1) = 1
891 read(0, "w", 1) = 1
891 read(0, "x", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "3", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "J", 1) = 1
891 read(0, "a", 1) = 1
891 read(0, "n", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "1", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, ":", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, "0", 1) = 1
891 read(0, " ", 1) = 1
891 read(0, "\"", 1) = 1
891 read(0, ".", 1) = 1
891 read(0, "s", 1) = 1
891 read(0, "t", 1) = 1
891 read(0, "a", 1) = 1
891 read(0, "g", 1) = 1
891 read(0, "e", 1) = 1
891 read(0, "c", 1) = 1
891 read(0, "r", 1) = 1
891 read(0, "a", 1) = 1
891 read(0, "f", 1) = 1
891 read(0, "t", 1) = 1
891 read(0, "\"", 1) = 1
891 read(0, "\n", 1) = 1
891 waitpid(-1, 0x7f898c50, WNOHANG) = -1 ECHILD (No child processes)
891 waitpid(-1, 0x7f898c50, WNOHANG) = -1 ECHILD (No child processes)
891 waitpid(-1, 0x7f898c50, WNOHANG) = -1 ECHILD (No child processes)
891 waitpid(-1, 0x7f898c50, WNOHANG) = -1 ECHILD (No child processes)
891 fcntl64(1, F_GETFL) = 0x1 (flags O_WRONLY)
891 write(1, "Pdrwxrwxrwx 0.0\nS0\ndJan 1 00:00\n:\".stagecraft\" \n\n", 50) = 50
I don't see what process 891 is (I see neither fork or clone which created it,
nor any execve's in it), but this is clearly where bug originates:
this process reads ls output (byte-by-byte), and then
translates it in some other format. This translation is buggy:
it took input in the form ".stagecraft" (quotes included)
and converted it to ".stagecraft"<space><space>
which looks wrong to me.
Aha. Looks like we have some docs:
http://cvs.savannah.gnu.org/viewvc/mc/mc/vfs/README.fish?view=markup
According to it, process 891 must be shell running "while read..."
part of the shell construct similar to:
ls -Qlan /tmp | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
S$s
d$m $d $y
:$n
"; done )
Questions for further debugging:
What is your shell?
Can you run this:
ls -Qlan /tmp | grep '^[^cbt]' | ( while read p x u g s m d y n; do echo "P$p $u.$g
S$s
d$m $d $y
:$n
"; done ) >LOG
and post resulting LOG file?
--
vda
More information about the busybox
mailing list