From 575e8120525ad2c63baf48581f7a797f9a2e263c Mon Sep 17 00:00:00 2001 From: Bryan Quigley Date: Thu, 14 Jun 2018 17:08:18 -0400 Subject: [plugins] Check read access before trying to list a dir I found a permission error when trying to copy /sys/fs/pstore when running on LXD containers. Adding a permission check first allows it to skip folders it can't list. Resolves: #1348 Signed-off-by: Bryan Quigley Signed-off-by: Bryn M. Reeves --- sos/plugins/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index d6915cc3..03b060db 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -431,7 +431,7 @@ class Plugin(object): self._copy_symlink(srcpath) return else: - if stat.S_ISDIR(st.st_mode): + if stat.S_ISDIR(st.st_mode) and os.access(srcpath, os.R_OK): self._copy_dir(srcpath) return -- cgit