aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-09-16 11:23:17 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-09-16 11:23:17 +0100
commitdf2cdb056d7a6d19d03457a6e4762f97586dcf75 (patch)
tree4fd719fc6d124f4b3e2d61e2e5dde622bd9cce9b
parent7992649d4a87c46442cb30e4c87e0094d7264c13 (diff)
downloadsos-df2cdb056d7a6d19d03457a6e4762f97586dcf75.tar.gz
[plugins] do not truncate mangled command names
There's no reason to truncate mangled command names within an archive. This isn't MS-DOS 3.1 and there are cases where the 64 character limit causes a loss of uniqueness and resulting name collisions (e.g. namespaced network commands). Fixes #388.
-rw-r--r--sos/plugins/__init__.py2
-rw-r--r--tests/plugin_tests.py2
2 files changed, 1 insertions, 3 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 9ad079d2..f53fc94f 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -46,7 +46,7 @@ def _mangle_command(command):
# FIXME: this can be improved
mangledname = re.sub(r"^/(usr/|)(bin|sbin)/", "", command)
mangledname = re.sub(r"[^\w\-\.\/]+", "_", mangledname)
- mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")[0:64]
+ mangledname = re.sub(r"/", ".", mangledname).strip(" ._-")
return mangledname
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index 956f808d..b7b13b22 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -119,8 +119,6 @@ class PluginToolTests(unittest.TestCase):
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"))
- expected = "foo_.path.to.stuff.this.is.very.long.and.i.only.expect.part.of.it.maybe.this.is.enough.i.hope.so"[0:64]
- self.assertEquals(expected, _mangle_command("/usr/bin/foo /path/to/stuff/this/is/very/long/and/i/only/expect/part/of/it/maybe/this/is/enough/i/hope/so"))
class PluginTests(unittest.TestCase):