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.releasereturns '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.propcontains 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.propcontains the following line:As a result, I need the
maxsplitparameter.2. Correct libm.so dependency in selectmodule.c
Since cpython hg 88854,
Modules/selectmodule.ccontains aceilcall. Without explicitly linking to libm.so,import selectfails.With the above two fixes, I can run youtube-dl with the following command:
Tested environments: