-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some failures #10
Conversation
ceil is introduced since cpython hg rev 88845:827d948ac6aa
Finally I find out why getprop in subprocess.Popen fails - on Android 4.1.1 properties are read from a inherited file descriptor. See Android 4.1.1's |
Thanks for finding and diagnosing these issues! |
In fact in C level there's no assumption that property values should be valid UTF-8 strings. I can create a malicious
(Simply replace my name And python script fails:
In Java land, both keys and values of system properties are assumed UTF-8 (see the JNI part of As a result, I think it's OK to use UTF-8 everywhere as of now. Just to mention it as a record. If these codes are eventually merged into CPython reposiroty some day, I or someone else may want to propose such a possible case. |
Looks good to me; if Java assumes this, it seems fairly canonical and safe for us to assume as well. If nothing else, it's better than just decoding as ASCII, which would have similar issues. |
Fix Android property retrieval and select module libm dependency.
Again, thanks for reporting, diagnosing and fixing! |
This PR contains two parts:
platform.android_version()
On my first phone
subprocess.check_call(['/system/bin/getprop', 'ro.build.version.release'])
returns empty stringb''
, while in adb shell,/system/bin/getprop ro.build.version.release
returns '4.1.1'. I don't know why but I try to make the falling back part working.Then it's the problem of binary/unicode. My
/system/build.prop
contains the following line:Non-ascii characters forces me to read in binary data first and then explicitly decode them.
Finally on my another phone
/system/build.prop
contains the following line:As a result, I need the
maxsplit
parameter.2. Correct libm.so dependency in selectmodule.c
Since cpython hg 88854,
Modules/selectmodule.c
contains aceil
call. Without explicitly linking to libm.so,import select
fails.With the above two fixes, I can run youtube-dl with the following command:
Tested environments: