Closed aadcg closed 1 year ago
Does (iolib/syscalls:getpwnam new-user)
work on Android?
Alternatively we chould use the id -u USERNAME
shell command. It adds overhead though.
It seems that on Android users are represented very differently. In any case, Nfiles needs to know some user identifier to return the owner name or set the new owner.
iolib
depends on libfixposix
. I need to check whether I'm able to install libfixposix
on Android with this fix.
Alternatively we chould use the id -u USERNAME shell command.
This would be a reasonable hot fix for the moment. Thanks.
Wanna send a pull request?
I need to test it first.
A kind gentleman helped me to package libfixposix
for Termux!
So I can now test @Ambrevar's suggestion:
Does (iolib/syscalls:getpwnam new-user) work on Android?
Hooray!
It turns out that running iolib
on Termux isn't as easy as I supposed. Maybe someone will help me figure it out.
Alternatively we chould use the id -u USERNAME shell command. It adds overhead though.
This is not pretty indeed, but it would work indeed!
CL-USER> (uiop:run-program "id -u u0_a256" :output t)
10256
NIL
NIL
0 (0 bits, #x0, #o0, #b0)
Note: Don't get scared by the odd username u0_a256
.
Termux is single-user
Android applications are sandboxed and have their own Linux user id and SELinux label. Termux is no exception and everything within Termux is executed with the same user id as the Termux application itself. The username may look like u0_a231 and cannot be changed as it is derived from the user id by Bionic libc.
All our packages (except root-only ones) are patched to drop any multiuser, setuid/setgid and other similar functionality. We also changed default ports for server packages: ftpd, httpd and sshd have their default ports set to 8021, 8080 and 8022 respectively.
You have free read-write access to all application components including $PREFIX. Be careful since it is very easy to break things by accidentally deleting or overwriting files in $PREFIX.
Another amazing update. iolib
runs on Termux!!!
That means that I can go back to @Ambrevar's idea and report that it indeed works!
Does (iolib/syscalls:getpwnam new-user) work on Android?
CL-USER> (iolib/syscalls:getpwnam "u0_a256")
"u0_a256"
NIL
10256 (14 bits, #x2810)
10256 (14 bits, #x2810)
NIL
"/data"
"/bin/sh"
Conclusion: there is at least one case when SBCL is available but sb-posix:getpwnam
, sb-posix:start-gid
or sb-posix:lstat
aren't defined.
My suggestion is that we should depend on iolib
even when SBCL is available.
Another way to do it would be to complicate the directives passed to #-
and #+
but I think it's much complexity for too little gain. Plus, I don't know how to define a predicate that would say "this is an Android device" (SBCL does it somehow).
Does that make sense? @Ambrevar @aartaka
Conclusion: there is at least one case when SBCL is available but
sb-posix:getpwnam
,sb-posix:start-gid
orsb-posix:lstat
aren't defined.My suggestion is that we should depend on
iolib
even when SBCL is available.
iolib
is quite huge, not sure it's good to always depend on it. The perfect solution to me seems to be: contribute SBCL-specifics to iolib
as a separate back-end. This way we can unconditionally include iolib
everywhere, while having nice and abstraction-less operations on SBCL.
But that should be a lot of work, I guess.
Another way to do it would be to complicate the directives passed to
#-
and#+
but I think it's much complexity for too little gain. Plus, I don't know how to define a predicate that would say "this is an Android device" (SBCL does it somehow).
Should be possible via *features*
. ECL on android has :unix
, :android
, :mobile
, :arm64
, and :aarch64
on my device. SBCL on Termux should have something like that too.
All good observations. See #12.
Plus, I don't know how to define a predicate that would say "this is an Android device" (SBCL does it somehow).
To be clear: I didn't know that the variable *features*
handles that.
No day without learning about new and exciting features (pun intended) of CL :D
See d146e4a.
nfiles
relies onsb-posix:getpwnam
which is not defined for Android.Any ideas on how to be able to run this library on Android?