ls -l on Android device

Tom Spear speeddymon at gmail.com
Tue Feb 2 03:57:35 UTC 2010


I forgot to attach the file. It is here now.

Thanks

Tom



On Mon, Feb 1, 2010 at 9:57 PM, Tom Spear <speeddymon at gmail.com> wrote:
> As requested: new errors attached. Denys, I have ssh setup with
> private keys and a domain name so that I can access the machine from
> my office. If you would like, I will be happy to grant you access so
> you can login to run tests, if you wish to speed the process up. The
> machine has nothing sensitive on it.
>
> Thanks
>
> Tom
>
>
>
> On Mon, Feb 1, 2010 at 7:25 PM, Denys Vlasenko <vda.linux at googlemail.com> wrote:
>> On Monday 01 February 2010 15:55, Tom Spear wrote:
>>> Thanks
>>>
>>> Tom
>>>
>>>
>>>
>>> On Mon, Feb 1, 2010 at 6:37 AM, Denys Vlasenko <vda.linux at googlemail.com> wrote:
>>> > On Mon, Feb 1, 2010 at 7:11 AM, Tom Spear <speeddymon at gmail.com> wrote:
>>> >>>>> Ok. Let's dig deeper. Earlier you said that busybox id gives this:
>>> >>>>>
>>> >>>>> $ ./busybox id
>>> >>>>> uid=2000 gid=2000 groups=1003,1004,1007,1011,1015,3001,3002,3003
>>> >>>>>
>>> >>>>> Looking at the source, "id" with no parameters ends up here
>>> >>>>> in id.c:
>>> >>>>>
>>> >>>>> static int print_group(gid_t id, const char *prefix)
>>> >>>>> {
>>> >>>>>        return print_common(id, gid2group(id), prefix);
>>> >>>>> }
>>> >>>>>
>>> >>>>> static int print_user(uid_t id, const char *prefix)
>>> >>>>> {
>>> >>>>>        return print_common(id, uid2uname(id), prefix);
>>> >>>>> }
>>> >>>>>
>>> >>>>> Let's follow uid2uname: it's in libbb/bb_pwd.c:
>>> >>>>>
>>> >>>>> char* FAST_FUNC uid2uname(uid_t uid)
>>> >>>>> {
>>> >>>>>        struct passwd *pw = getpwuid(uid);
>>> >>>>>        return (pw) ? pw->pw_name : NULL;
>>> >>>>> }
>>> >>>>>
>>> >>>>> As you see, it uses the very same getpwuid() call.
>>> >>>>> Please instrument it by adding this line:
>>> >>>>>
>>> >>>>>        struct passwd *pw = getpwuid(uid);
>>> >>>>> bb_error_msg("getpwuid(%d):%p", (int)uid, pw);
>>> >>>>>        return (pw) ? pw->pw_name : NULL;
>>> >>>>>
>>> >>>>> recompile busybox, making sure CONFIG_USE_BB_PWD_GRP
>>> >>>>> and CONFIG_USE_BB_SHADOW are off, then re-run
>>> >>>>> "./busybox id". What does it print? Give the same uid to
>>> >>>>> "/system/bin/test <UID> root" - does it resolve it?
>>> >>
>>> >> Hi all, I have tested this tonight, as promised.
>>> >>
>>> >> Here are the results.
>>> >>
>>> >> Firstly, I noticed that after I recompiled busybox, with the line
>>> >> inserted into libbb/bb_pwd.c, the normal output of the id command
>>> >> changed. Previously it included a group list, however now it does not:
>>> >>
>>> >> [tom at Speeddy busybox-1.15.3]$ adb shell
>>> >> # su shell
>>> >> $ /system/busybox id
>>> >> id: getpwuid(2000):(nil)
>>> >> uid=2000 gid=2000
>>> >
>>> > Aha. So getpwuid(2000) *fails*
>>> >
>>> >> Second thing is that, unless I missed a step somewhere, the test
>>> >> program doesn't compile against busybox headers, so therefore the
>>> >> change requested does not affect the output of it either way
>>> >>
>>> >> $ bbtest 2000 shell
>>> >> pw_name:shell
>>> >> pw_passwd:(null)
>>> >> pw_uid:2000
>>> >> pw_gid:2000
>>> >> pw_dir:/
>>> >> pw_shell:/system/bin/sh
>>> >>
>>> >> pw_name:shell
>>> >> pw_passwd:(null)
>>> >> pw_uid:2000
>>> >> pw_gid:2000
>>> >> pw_dir:/
>>> >> pw_shell:/system/bin/sh
>>> >
>>> > but in the test program getpwuid(2000) *succeeds*.
>>> >
>>> > Please send your busybox's .config file.
>>> >
>>> > It's definitely not normal that the same getpwuid(2000)
>>> > call returns different results in bbox and in test prog.
>>> > We need to find out why.
>>>
>>>
>>> Attached
>>>
>>> >> Another thing I just thought about is the fact that I am needing to
>>> >> use the CodeSourcery toolchain to compile busybox, and that I am
>>> >> needing to use the "agcc" command (which is a wrapper script for the
>>> >> android prebuilt toolchain included in the android source), to compile
>>> >> the test application.
>>> >
>>> > Are you sure that busybox built with CodeSourcery toolchain
>>> > uses android libc? Do you have working strace tool on android?
>>> > Can you strace test program run and "busibox id" run
>>> > and post results?
>>>
>>>
>>> Actually, I'm 99% certain that that is why, as Tito put it, there are
>>> unexpected results is because it doesn't use bionic that I know of,
>>> whereas the android toolchain does.
>>>
>>> >> If I try to build busybox directly using the arm-eabi-gcc compiler
>>> >> included with the android source, it errors because it can't find
>>> >> various include files.
>>> >
>>> > Please post these error messages and .config file used for build.
>>> >
>>> >> If I try to build busybox using the agcc wrapper script, it errors
>>> >> because busybox redefines the type definition of socklen_t which is
>>> >> defined at bionic/libc/include/sys/socket.h line 61 in the android
>>> >> source. More errors pop up if you disable the definition in either bb
>>> >> or bionic's include dir. Eventually I gave up on fixing them.
>>> >
>>> > Same: please post these error messages and .config file used for build.
>>> > --
>>> > vda
>>> >
>>>
>>> If I change the gcc config prefix entry to use "a" as the prefix to
>>> gcc (thus making it call "agcc", smart eh? ;-) ), I get the errors
>>> attached in agcc-errors.txt.
>>
>> Please replace this:
>>
>> #if defined __GLIBC__ || defined __UCLIBC__ \
>>  || defined __dietlibc__ || defined _NEWLIB_VERSION
>> # include <features.h>
>> # define HAVE_FEATURES_H
>> # include <stdint.h>
>> # define HAVE_STDINT_H
>> #elif !defined __APPLE__
>> /* Largest integral types. */
>> # if BB_BIG_ENDIAN
>> /* Looks BROKEN! */
>> typedef long                intmax_t;
>> typedef unsigned long       uintmax_t;
>> # else
>> __extension__
>> typedef long long           intmax_t;
>> __extension__
>> typedef unsigned long long  uintmax_t;
>> # endif
>> #endif
>>
>> by just
>>
>> #if defined __GLIBC__ || defined __UCLIBC__ \
>>  || defined __dietlibc__ || defined _NEWLIB_VERSION
>> # include <features.h>
>> #endif
>> #include <stdint.h>
>>
>>
>>
>> Also please add this line:
>>
>> #ifndef __APPLE__
>> # include <arpa/inet.h>
>> # if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
>> #  define socklen_t bb_socklen_t   <=============== THIS
>> typedef int socklen_t;
>> # endif
>> #else
>> # include <netinet/in.h>
>> #endif
>>
>>
>>
>>
>> and also disable CONFIG_FEATURE_SHADOWPASSWDS in order to not trip over this:
>>
>> #if ENABLE_FEATURE_SHADOWPASSWDS
>> # if !ENABLE_USE_BB_SHADOW
>> /* If using busybox's shadow implementation, do not include the shadow.h
>>  * header as the toolchain may not provide it at all.
>>  */
>> #  include <shadow.h>
>> # endif
>> #endif
>>
>>
>> try again, post error messages.
>>
>>
>>> If I change the gcc config prefix entry to use "arm-eabi-" as the
>>> prefix to gcc, I get the errors attached in arm-eabi-gcc-errors.txt
>>
>> Broken paths to includes.
>>
>> --
>> vda
>>
>
-------------- next part --------------
[tom at Speeddy busybox-1.15.3]$ make
  SPLIT   include/autoconf.h -> include/config/*
  GEN     include/bbconfigopts.h
  HOSTCC  applets/usage
  GEN     include/usage_compressed.h
13110+1 records in
13110+1 records out
26221 bytes (26 kB) copied, 0.034976 s, 750 kB/s
  HOSTCC  applets/applet_tables
  GEN     include/applet_tables.h
  CC      applets/applets.o
In file included from include/libbb.h:15,
                 from include/busybox.h:10,
                 from applets/applets.c:11:
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:99: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:99: warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:104: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:109: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:114: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:119: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:124: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:129: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:134: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:139: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:144: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:149: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:154: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:161: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:170: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:177: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:182: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:187: warning: C99 inline functions are not supported; using GNU89
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/ctype.h:192: warning: C99 inline functions are not supported; using GNU89
In file included from /home/tom/Devel/source/android/2.0.1/bionic/libc/include/netdb.h:66,
                 from include/libbb.h:20,
                 from include/busybox.h:10,
                 from applets/applets.c:11:
/home/tom/Devel/source/android/2.0.1/bionic/libc/include/sys/socket.h:61: error: redefinition of typedef 'bb_socklen_t'
include/platform.h:199: error: previous declaration of 'bb_socklen_t' was here
make[1]: *** [applets/applets.o] Error 1
make: *** [applets_dir] Error 2


More information about the busybox mailing list