Page MenuHomePhabricator

`scap clean --delete 1.34.0-wmf.13` fails with `Permission denied`
Closed, ResolvedPublic

Description

zfilipin@deploy1001:/srv/mediawiki-staging$ find . -mindepth 2 -maxdepth 2 -type f -path './php-*/README' -ctime +30 -exec dirname {} \;
./php-1.34.0-wmf.13
./php-1.34.0-wmf.14

zfilipin@deploy1001:/srv/mediawiki-staging$ scap clean --delete 1.34.0-wmf.13
           ___ ____
         ⎛   ⎛ ,----
          \  //==--'
     _//|,.·//==--'    ____________________________
    _OO≣=-  ︶ ᴹw ⎞_§ ______  ___\ ___\ ,\__ \/ __ \
   (∞)_, )  (     |  ______/__  \/ /__ / /_/ / /_/ /
     ¨--¨|| |- (  / ______\____/ \___/ \__^_/  .__/
         ««_/  «_/ jgs/bd808                /_/

14:03:05 Checking for new runtime errors locally
14:03:06 Started clean-l10nupdate-cache
14:03:06 Finished clean-l10nupdate-cache (duration: 00m 00s)
14:03:06 Started clean-l10nupdate-owned-files
14:03:07 Finished clean-l10nupdate-owned-files (duration: 00m 00s)
14:03:07 Started clean-ExtensionMessages
14:03:07 Finished clean-ExtensionMessages (duration: 00m 00s)
14:03:07 Started removing-local-copy
14:03:08 Finished removing-local-copy (duration: 00m 01s)
14:03:08 Unhandled error:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/scap/cli.py", line 342, in run
    exit_status = app.main(app.extra_arguments)
  File "/srv/mediawiki-staging/scap/plugins/clean.py", line 50, in main
    return super(Clean, self).main(*extra_args)
  File "/usr/lib/python2.7/dist-packages/scap/main.py", line 84, in main
    self._before_cluster_sync()
  File "/srv/mediawiki-staging/scap/plugins/clean.py", line 56, in _before_cluster_sync
    self.cleanup_branch(self.arguments.branch, self.arguments.delete)
  File "/srv/mediawiki-staging/scap/plugins/clean.py", line 107, in cleanup_branch
    self._maybe_delete(self.branch_stage_dir)
  File "/srv/mediawiki-staging/scap/plugins/clean.py", line 148, in _maybe_delete
    shutil.rmtree(path)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 247, in rmtree
    rmtree(fullname, ignore_errors, onerror)
  File "/usr/lib/python2.7/shutil.py", line 252, in rmtree
    onerror(os.remove, fullname, sys.exc_info())
  File "/usr/lib/python2.7/shutil.py", line 250, in rmtree
    os.remove(fullname)
OSError: [Errno 13] Permission denied: '/srv/mediawiki-staging/php-1.34.0-wmf.13/.git/modules/extensions/Gadgets/refs/remotes/origin/wmf/1.34.0-wmf.11'
14:03:08 clean failed: <OSError> [Errno 13] Permission denied: '/srv/mediawiki-staging/php-1.34.0-wmf.13/.git/modules/extensions/Gadgets/refs/remotes/origin/wmf/1.34.0-wmf.11'

scap clean --delete 1.34.0-wmf.14 worked fine 🤔

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 20 2019, 2:06 PM
zeljkofilipin triaged this task as Unbreak Now! priority.Aug 20 2019, 2:06 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptAug 20 2019, 2:06 PM
zeljkofilipin renamed this task from `scap clean` fails with `Permission denied` to `scap clean --delete 1.34.0-wmf.13` fails with `Permission denied`.Aug 20 2019, 2:15 PM

This looks like @Urbanecm 's umask maybe set wrong:

$ ls -lh /srv/mediawiki-staging/php-1.34.0-wmf.13/.git/modules/extensions/Gadgets/refs/remotes/origin/wmf/1.34.0-wmf.11
-rw-r--r-- 1 urbanecm wikidev 41 Jul 11 11:19 /srv/mediawiki-staging/php-1.34.0-wmf.13/.git/modules/extensions/Gadgets/refs/remotes/origin/wmf/1.34.0-wmf.11

You need to find a root to chown that

Jdforrester-WMF closed this task as Resolved.Aug 20 2019, 4:04 PM
Jdforrester-WMF assigned this task to Joe.
Jdforrester-WMF added a project: serviceops.
Jdforrester-WMF added subscribers: Joe, Jdforrester-WMF.

Fixed by @Joe.