diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-10-20 16:12:01 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-10-20 16:12:01 +0100 |
commit | 48a99c95078bab306cb56bb1a05420d88bf15a64 (patch) | |
tree | 00e16abc1775098f3b9746870d1fe4dc2919b8e1 /tests | |
parent | 6ce502113f550c027424fa477edc091283c32e50 (diff) | |
download | sos-48a99c95078bab306cb56bb1a05420d88bf15a64.tar.gz |
[plugin] limit names to PC_NAME_MAX
Commit 8bf7b0c removed the truncation of mangled command names to
64 chars. This causes problems for some plugins (e.g. Issue #415)
that generate long enough command lines to hit system name length
limits.
Instead of arbitrarily limiting to 64 characters limit to the
lesser of the archive format limit (if present) or the value of
PC_NAME_MAX for any intermediate FileCacheArchive path.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/plugin_tests.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py index 817e4f23..f73a003a 100644 --- a/tests/plugin_tests.py +++ b/tests/plugin_tests.py @@ -115,10 +115,14 @@ class PluginToolTests(unittest.TestCase): self.assertEquals(matches, []) def test_mangle_command(self): - self.assertEquals("foo", _mangle_command("/usr/bin/foo")) - self.assertEquals("foo_-x", _mangle_command("/usr/bin/foo -x")) - self.assertEquals("foo_--verbose", _mangle_command("/usr/bin/foo --verbose")) - self.assertEquals("foo_.path.to.stuff", _mangle_command("/usr/bin/foo /path/to/stuff")) + name_max = 255 + self.assertEquals("foo", _mangle_command("/usr/bin/foo", name_max)) + self.assertEquals("foo_-x", _mangle_command("/usr/bin/foo -x", name_max)) + self.assertEquals("foo_--verbose", _mangle_command("/usr/bin/foo --verbose", name_max)) + self.assertEquals("foo_.path.to.stuff", _mangle_command("/usr/bin/foo /path/to/stuff", name_max)) + longcmd ="foo is " + "a" * 256 + " long_command" + expected = longcmd[0:name_max].replace(' ', '_') + self.assertEquals(expected, _mangle_command(longcmd, name_max)) class PluginTests(unittest.TestCase): |