yujiang / python-for-android

Automatically exported from code.google.com/p/python-for-android
Apache License 2.0
0 stars 1 forks source link

importing uuid module causes segmentation fault #11

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install Python for Android version 5
2. In adb shell set env vars and start python interpreter
3. import uuid

What is the expected output? 
uuid module imported successfully and available for use in interpreter

What do you see instead?
Segmentation fault - signal 11 (SIGSEGV)   

What version of the product are you using? On what operating system?
Motorola Droid, OS v2.2.2

Please provide any additional information below.

Interpreter install used these .zip archives:

python_r16.zip
python_extras_r13.zip
python_scripts_r13.zip

Output from adb shell:

$ export PYTHONHOME=/data/data/com.googlecode.pythonforandroid/files/python
$ export PYTHONPATH=/sdcard/com.googlecode.pythonforandroid/extras/python
$ export PATH=$PYTHONHOME/bin:$PATH
$ export 
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.googlecode.pythonforandroid/file
s/python/lib:/data/data/com.googlecode.pythonforandroid/files/python/lib/python2
.6/lib-dynload 
$ python
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
[1] + Stopped (signal)        python
[1]   Segmentation fault      python
$

Output from adb logcat:

I/DEBUG   ( 1010): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 
***
I/DEBUG   ( 1010): Build fingerprint: 
'verizon/voles/sholes/sholes:2.2.2/FRG83G/91102:user/release-keys'
I/DEBUG   ( 1010): pid: 3167, tid: 3167  >>> python <<<
I/DEBUG   ( 1010): signal 11 (SIGSEGV), fault addr 00000000
I/DEBUG   ( 1010):  r0 00000000  r1 0000002f  r2 b0014df8  r3 00000000
I/DEBUG   ( 1010):  r4 b000c448  r5 b000c448  r6 00000000  r7 00000000
I/DEBUG   ( 1010):  r8 8010960d  r9 0000a048  10 800d0264  fp ffffffff
I/DEBUG   ( 1010):  ip 80110210  sp be80d098  lr b0002527  pc b00061c4  cpsr 
40000030
I/DEBUG   ( 1010):  d0  6472656767756265  d1  0000e6800000e574
I/DEBUG   ( 1010):  d2  0000ef8c0000e776  d3  0000e7640000e661
I/DEBUG   ( 1010):  d4  0000e9a00000e680  d5  0000e9a00000e680
I/DEBUG   ( 1010):  d6  0000ea300000e680  d7  0000ea6c0000e680
I/DEBUG   ( 1010):  d8  0000000000000000  d9  0000000000000000
I/DEBUG   ( 1010):  d10 0000000000000000  d11 0000000000000000
I/DEBUG   ( 1010):  d12 0000000000000000  d13 0000000000000000
I/DEBUG   ( 1010):  d14 0000000000000000  d15 0000000000000000
I/DEBUG   ( 1010):  d16 3fdb160ab370cb80  d17 4022000000000000
I/DEBUG   ( 1010):  d18 0000000000000000  d19 8000000000000000
I/DEBUG   ( 1010):  d20 4000000000000000  d21 3f11566aaf25de2c
I/DEBUG   ( 1010):  d22 bebbbd41c5d26bf1  d23 0000000000000000
I/DEBUG   ( 1010):  d24 3e66376972bea4d0  d25 c04a800000000000
I/DEBUG   ( 1010):  d26 3ff0000000000000  d27 8000000000000000
I/DEBUG   ( 1010):  d28 c000000000000000  d29 0000000000000000
I/DEBUG   ( 1010):  d30 0000000000000000  d31 0000000000000000
I/DEBUG   ( 1010):  scr 60000010
I/DEBUG   ( 1010): 
I/DEBUG   ( 1010):          #00  pc b00061c4  /system/bin/linker
I/DEBUG   ( 1010):          #01  lr b0002527  /system/bin/linker
I/DEBUG   ( 1010): 
I/DEBUG   ( 1010): code around pc:
I/DEBUG   ( 1010): b00061a4 c003f811 d0024564 0004ebcc b114e004 
I/DEBUG   ( 1010): b00061b4 429a3301 2000d1f3 bf00bd10 20004603 
I/DEBUG   ( 1010): b00061c4 428a781a 4618bf08 4770b902 e7f73301 
I/DEBUG   ( 1010): b00061d4 68004603 b1a0b570 46624684 f8122500 
I/DEBUG   ( 1010): b00061e4 5d4e4b01 d10742a6 4622b90c 2100e002 
I/DEBUG   ( 1010): 
I/DEBUG   ( 1010): code around lr:
I/DEBUG   ( 1010): b0002504 ffffcfbb 00006828 ffffd361 0000003c 
I/DEBUG   ( 1010): b0002514 4d2db5f0 b087a300 18ed212f f0034606 
I/DEBUG   ( 1010): b0002524 4637fe4d 1c47b100 582c4828 46214638 
I/DEBUG   ( 1010): b0002534 fd82f003 28004684 f8d4d137 f01660a8 
I/DEBUG   ( 1010): b0002544 d0180f02 f2404822 4b2244a4 94001828 
I/DEBUG   ( 1010): 
I/DEBUG   ( 1010): stack:
I/DEBUG   ( 1010):     be80d058  800dd1f8  
I/DEBUG   ( 1010):     be80d05c  0006ee48  
I/DEBUG   ( 1010):     be80d060  0006ee48  
I/DEBUG   ( 1010):     be80d064  400c0b70  
I/DEBUG   ( 1010):     be80d068  00000000  
I/DEBUG   ( 1010):     be80d06c  800d0264  
I/DEBUG   ( 1010):     be80d070  400c0b70  
I/DEBUG   ( 1010):     be80d074  400781a0  
I/DEBUG   ( 1010):     be80d078  e62c78ef  
I/DEBUG   ( 1010):     be80d07c  800714f1  
/data/data/com.googlecode.pythonforandroid/files/python/lib/libpython2.6.so
I/DEBUG   ( 1010):     be80d080  392dc3e1  
I/DEBUG   ( 1010):     be80d084  0006ee48  
I/DEBUG   ( 1010):     be80d088  0006ee48  
I/DEBUG   ( 1010):     be80d08c  800d0264  
I/DEBUG   ( 1010):     be80d090  df002777  
I/DEBUG   ( 1010):     be80d094  e3a070ad  
I/DEBUG   ( 1010): #00 be80d098  00000000  
I/DEBUG   ( 1010):     be80d09c  8010960d  
/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynloa
d/_ctypes.so
I/DEBUG   ( 1010):     be80d0a0  b0014df8  
I/DEBUG   ( 1010):     be80d0a4  b0004a94  /system/bin/linker
I/DEBUG   ( 1010):     be80d0a8  b000c448  
I/DEBUG   ( 1010):     be80d0ac  00000000  
I/DEBUG   ( 1010):     be80d0b0  400c26c0  
I/DEBUG   ( 1010):     be80d0b4  b000c448  
I/DEBUG   ( 1010):     be80d0b8  00000000  
I/DEBUG   ( 1010):     be80d0bc  400c26c0  
I/DEBUG   ( 1010):     be80d0c0  00000000  
I/DEBUG   ( 1010):     be80d0c4  b00033bf  /system/bin/linker
I/DEBUG   ( 1010):     be80d0c8  801100d8  
I/DEBUG   ( 1010):     be80d0cc  4007ca08  
I/DEBUG   ( 1010):     be80d0d0  400c26c0  
I/DEBUG   ( 1010):     be80d0d4  8010963d  
/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6/lib-dynloa
d/_ctypes.so
I/DEBUG   ( 1010):     be80d0d8  00000000  
I/DEBUG   ( 1010):     be80d0dc  00000000  
I/BootReceiver( 1104): Copying /data/tombstones/tombstone_02 to DropBox 
(SYSTEM_TOMBSTONE)

Original issue reported on code.google.com by BrainAid...@gmail.com on 14 Apr 2011 at 3:12

GoogleCodeExporter commented 8 years ago
Some more detail on this - since the segfault looked directly related to ctypes 
and knowing that uuid works with or without ctypes I added code to my boot 
script using shutil.rmtree() to remove /extras/python/ctypes, and that did the 
trick. I don't need ctypes for now so this is an OK workaround for the time 
being...

Original comment by BrainAid...@gmail.com on 16 Apr 2011 at 12:49

GoogleCodeExporter commented 8 years ago
Thanks, I found the problem, any call to:
ctypes._dlopen(None)

Will end in a segfault, I guess it has to do with the internal ctypes 
implementation. Will see what can be done.

Manuel

Original comment by naranjo....@gmail.com on 17 May 2011 at 1:17