Skip to content

Commit

Permalink
[Plugin] Detect copy operations without the adequate access rights
Browse files Browse the repository at this point in the history
(e.g. apparmor restriction for '/proc/sys/fs/binfmt' inside a LXD container)

Fix: #1662
Resolves: #1867

Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
  • Loading branch information
Eric Desrochers authored and Bryan Quigley committed Dec 12, 2019
1 parent 49e636b commit e10473d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sos/plugins/__init__.py
Expand Up @@ -744,6 +744,10 @@ def _copy_dir(self, srcpath):
path = os.path.join(srcpath, name)
self._do_copy_path(path)
except OSError as e:
if e.errno == errno.EPERM or errno.EACCES:
msg = "Permission denied"
self._log_warn("_copy_dir: '%s' %s" % (srcpath, msg))
return
if e.errno == errno.ELOOP:
msg = "Too many levels of symbolic links copying"
self._log_error("_copy_dir: %s '%s'" % (msg, srcpath))
Expand Down

0 comments on commit e10473d

Please sign in to comment.