diff options
author | Louis Bouchard <louis.bouchard@canonical.com> | 2016-11-17 15:17:19 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2017-01-19 15:12:36 +0000 |
commit | 679b1efe034c918207ed6e84818822cf78c20d53 (patch) | |
tree | 2c3a67746cdd38634aa2178f0b4c663b825dc407 /tests/archive_tests.py | |
parent | 3ddfe078dbad9acaf6d35aa02892a000d57ae8fb (diff) | |
download | sos-679b1efe034c918207ed6e84818822cf78c20d53.tar.gz |
[archive] Handle error when adding /dev/null as a node
Adding /dev/null as a node will trigger EPERM. This can happen namely
when masking systemd units which symlinks to /dev/null. This fix will
avoid a stacktrace and will generate a INFO message about it.
Test for that situation is also included.
Resolves: #893.
Signed-off-by: Louis Bouchard <louis.bouchard@canonical.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests/archive_tests.py')
-rw-r--r-- | tests/archive_tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/archive_tests.py b/tests/archive_tests.py index dac02a04..febc96b4 100644 --- a/tests/archive_tests.py +++ b/tests/archive_tests.py @@ -39,6 +39,12 @@ class TarFileArchiveTest(unittest.TestCase): self.check_for_file('test/tests/ziptest') + def test_add_node_dev_null(self): + st = os.lstat('/dev/null') + dev_maj = os.major(st.st_rdev) + dev_min = os.minor(st.st_rdev) + self.tf.add_node('/dev/null', st.st_mode, os.makedev(dev_maj, dev_min)) + # when the string comes from tail() output def test_add_string_from_file(self): self.copy_strings = [] |