You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
skip tests that raise PermissionError in test_tarfile (non-root user on Android) #73367
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2017-11-12.17:03:40.042>created_at=<Date2017-01-06.16:31:35.929>labels= ['3.7', 'type-bug', 'tests']
title='skip tests that raise PermissionError in test_tarfile (non-root user on Android)'updated_at=<Date2017-11-12.17:03:40.041>user='https://github.com/xdegaye'
Why os.link() is failed? If hard links are not supported on Android, shouldn't os.link be not implemented? tarfile try to make a copy of the referenced file instead of a link if a link can't be created.
xdegaye commented on Jan 7, 2017
xdegayemannequin
MannequinAuthor
More actions
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
Activity
xdegaye commentedon Jan 6, 2017
====================================================================== [339/2616]
ERROR: test_link_size (test.test_tarfile.Bz2WriteTest)
----------------------------------------------------------------------
======================================================================
ERROR: test_link_size (test.test_tarfile.GzipWriteTest)
----------------------------------------------------------------------
======================================================================
ERROR: test_add_hardlink (test.test_tarfile.HardlinkTest)
----------------------------------------------------------------------
======================================================================
ERROR: test_add_twice (test.test_tarfile.HardlinkTest)
----------------------------------------------------------------------
======================================================================
ERROR: test_dereference_hardlink (test.test_tarfile.HardlinkTest)
----------------------------------------------------------------------
======================================================================
ERROR: test_link_size (test.test_tarfile.WriteTest)
----------------------------------------------------------------------
Ran 426 tests in 17.296s
FAILED (errors=6, skipped=80)
test test_tarfile failed
xdegaye commentedon Jan 7, 2017
Patch attached.
serhiy-storchaka commentedon Jan 7, 2017
Why os.link() is failed? If hard links are not supported on Android, shouldn't os.link be not implemented? tarfile try to make a copy of the referenced file instead of a link if a link can't be created.
xdegaye commentedon Jan 7, 2017
Android has a restrictive security model based on SELinux [1].
With the Android adb shell on the emulator at API level 24:
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/
xdegaye commentedon Jan 9, 2017
New patch following Serhiy's suggestion in msg285008.
xdegaye commentedon Nov 12, 2017
New changeset d7d4fea by xdegaye in branch 'master':
bpo-29181: Skip test_tarfile tests on PermissionError raised by Android (GH-4375)
d7d4fea