Message284938
> Why os.link() is failed? If hard links are not supported on Android, shouldn't os.link be not implemented?
Android has a restrictive security model based on SELinux [1].
With the Android adb shell on the emulator at API level 24:
$ >foo
$ ln foo bar
ln: cannot create hard link from 'foo' to 'bar': Permission denied
$ su
# ln foo bar
# ls -li foo bar
15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 bar
15688 -rw-rw-rw- 2 shell shell 0 2017-01-07 22:29 foo
Here is the Android commit message that does not grant hard link capabilities by default:
https://android.googlesource.com/platform/external/sepolicy/+/85ce2c7
[1] https://source.android.com/security/selinux/ |
|
Date |
User |
Action |
Args |
2017-01-07 21:41:22 | xdegaye | set | recipients:
+ xdegaye, lars.gustaebel, serhiy.storchaka |
2017-01-07 21:41:22 | xdegaye | set | messageid: <1483825282.92.0.0513800761995.issue29181@psf.upfronthosting.co.za> |
2017-01-07 21:41:22 | xdegaye | link | issue29181 messages |
2017-01-07 21:41:22 | xdegaye | create | |
|