|
|
Chromium Code Reviews
DescriptionTry 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
rm -rf x
Expected:
x and x/y are fully deletable without sudo in the last rm -rf.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
Review-Url: https://codereview.chromium.org/2949253002
Committed: https://github.com/luci/luci-py/commit/274f6429d25c5243eb8043afff854f884b20cf18
Patch Set 1 : . #
Depends on Patchset: Messages
Total messages: 19 (15 generated)
Description was changed from ========== Try sudo chmod in make_tree_deleteable() Some tasks on Swarming may create root owned files on passwordless sudoer account. R=vadimsh@chromium.org BUG=723809 ========== to ========== Try sudo chmod in make_tree_deleteable() Some tasks on Swarming may create root owned files on passwordless sudoer account. Manually tested with: mkdir -p x/y && sudo chmod -R a-rwX x sudo ls -la x x/y python -c 'import os; from utils import file_path; \ file_path.make_tree_deleteable(os.path.abs(u"x"))' sudo ls -la x x/y sudo rm -rf x and: mkdir -p x/y && sudo chmod -R a-rwX x python -c 'import os; from utils import file_path; \ file_path.rmtree(os.path.abs(u"x"))' ls -la x R=vadimsh@chromium.org BUG=723809 ==========
Patchset #1 (id:1) has been deleted
Description was changed from
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested with:
mkdir -p x/y && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abs(u"x"))'
sudo ls -la x x/y
sudo rm -rf x
and:
mkdir -p x/y && sudo chmod -R a-rwX x
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abs(u"x"))'
ls -la x
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested with:
mkdir -p x/y && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
sudo ls -la x x/y
sudo rm -rf x
and:
mkdir -p x/y && sudo chmod -R a-rwX x
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
R=vadimsh@chromium.org
BUG=723809
==========
Patchset #1 (id:20001) has been deleted
Patchset #1 (id:40001) has been deleted
Description was changed from
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested with:
mkdir -p x/y && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
sudo ls -la x x/y
sudo rm -rf x
and:
mkdir -p x/y && sudo chmod -R a-rwX x
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
sudo ls -la x x/y
sudo rm -rf x
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
R=vadimsh@chromium.org
BUG=723809
==========
Description was changed from
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
sudo ls -la x x/y
sudo rm -rf x
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
Description was changed from
==========
Try sudo chmod in make_tree_deleteable()
Some tasks on Swarming may create root owned files on passwordless sudoer
account.
Manually tested:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
Description was changed from
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
Make rmtree() usable even if fix_encoding() wasn't called so the test case above
can be used.
R=vadimsh@chromium.org
BUG=723809
==========
Description was changed from
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
Make rmtree() usable even if fix_encoding() wasn't called so the test case above
can be used.
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux. If it fails once, do not try
again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
Description was changed from
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. Try running 'sudo chmod' on linux. If it fails once, do not try
again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
lgtm
Description was changed from
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
sudo rm -rf x
Expected:
x and x/y are fully writeable.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
rm -rf x
Expected:
x and x/y are fully deletable without sudo in the last rm -rf.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
The CQ bit was checked by maruel@chromium.org
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 60001, "attempt_start_ts": 1498151974098760,
"parent_rev": "8122a5d84198cd85ade442dbdcb4d3ef5ca2dc2c", "commit_rev":
"274f6429d25c5243eb8043afff854f884b20cf18"}
Message was sent while issue was closed.
Description was changed from
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
rm -rf x
Expected:
x and x/y are fully deletable without sudo in the last rm -rf.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
==========
to
==========
Try 'sudo chmod' in make_tree_deleteable() as last effort
- Some tasks on Swarming may create root owned files on passwordless sudoer
account. This CL makes rmtree() try running 'sudo chmod' on linux in case the
current account happens to be passwordless sudoer. If it fails once, do not
try again.
- Make rmtree() usable even if fix_encoding() wasn't called so the test case
above can be used.
Because correctly testing this code requires passwordless sudo, it
has to be manually tested.
The 3 manual test cases to confirm the code works as expected:
1) Verify make_tree_deleteable() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.make_tree_deleteable(os.path.abspath(u"x"))'
ls -la x x/y
rm -rf x
Expected:
x and x/y are fully deletable without sudo in the last rm -rf.
2) Verify rmtree() works with passwordless sudo:
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
x and x/y were removed
A logging warning was printed
3) Verify that a sudo password prompt fails the rmtree():
mkdir -p x/y && sudo chown -R root:root x && sudo chmod -R a-rwX x
sudo ls -la x x/y
sudo -K
python -c 'import os; from utils import file_path; \
file_path.rmtree(os.path.abspath(u"x"))'
ls -la x
Expected:
removal failed
R=vadimsh@chromium.org
BUG=723809
Review-Url: https://codereview.chromium.org/2949253002
Committed:
https://github.com/luci/luci-py/commit/274f6429d25c5243eb8043afff854f884b20cf18
==========
Message was sent while issue was closed.
Committed patchset #1 (id:60001) as https://github.com/luci/luci-py/commit/274f6429d25c5243eb8043afff854f884b20cf18 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
