In Red Hat Satellite 5 spacecmd command fails if the package name contains ++ symbol

Solution Verified - Updated -

Environment

  • Red Hat Satellite 5

Issue

  • spacecmd command fails if the package name contains '++' with the following error:
# spacecmd -d package_details gcc-c++-4.8.2-16.2.el7_0.x86_64
ERROR: multiple repeat
Traceback (most recent call last):
  File "/usr/bin/spacecmd", line 148, in <module>
    shell.print_result(shell.onecmd(precmd), precmd)
  File "/usr/lib64/python2.6/cmd.py", line 219, in onecmd
    return func(arg)
  File "/usr/lib/python2.6/site-packages/spacecmd/package.py", line 54, in do_package_details
    packages.extend(self.do_package_search(' '.join(args), True))
  File "/usr/lib/python2.6/site-packages/spacecmd/package.py", line 144, in do_package_search
    [args], search=True)
  File "/usr/lib/python2.6/site-packages/spacecmd/utils.py", line 151, in filter_results
    compiled_patterns.append(re.compile(pattern, re.I))
  File "/usr/lib64/python2.6/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.6/re.py", line 245, in _compile
    raise error, v # invalid expression
error: multiple repeat

Resolution

  • There is no fix available as of now, use following workaround:
eg: # spacecmd -d package_details 'gcc-c\\++\\-4.8.2-16.2.el7_0.x86_64'   

// Use double escaping in code before/after ++ and be aware of shell escaping, use [' '] on start/end of package name.

Diagnostic Steps

  • Complete traceback:
# spacecmd -d package_details gcc-c++-4.8.2-16.2.el7_0.x86_64
ERROR: multiple repeat
Traceback (most recent call last):
  File "/usr/bin/spacecmd", line 148, in <module>
    shell.print_result(shell.onecmd(precmd), precmd)
  File "/usr/lib64/python2.6/cmd.py", line 219, in onecmd
    return func(arg)
  File "/usr/lib/python2.6/site-packages/spacecmd/package.py", line 54, in do_package_details
    packages.extend(self.do_package_search(' '.join(args), True))
  File "/usr/lib/python2.6/site-packages/spacecmd/package.py", line 144, in do_package_search
    [args], search=True)
  File "/usr/lib/python2.6/site-packages/spacecmd/utils.py", line 151, in filter_results
    compiled_patterns.append(re.compile(pattern, re.I))
  File "/usr/lib64/python2.6/re.py", line 190, in compile
    return _compile(pattern, flags)
  File "/usr/lib64/python2.6/re.py", line 245, in _compile
    raise error, v # invalid expression
error: multiple repeat

# spacecmd -d package_details 'gcc-c\\++\\-4.8.2-16.2.el7_0.x86_64'
Name:    gcc-c++
Version: 4.8.2
Release: 16.2.el7_0
Epoch:   
Arch:    x86_64

File:    gcc-c++-4.8.2-16.2.el7_0.x86_64.rpm
Path:    redhat/NULL/3c4/gcc-c++/4.8.2-16.2.el7_0/x86_64/3c42afe14a68ea6dd81d371c8c79dce6b682825b6044804841b283e0f3c53a70/gcc-c++-4.8.2-16.2.el7_0.x86_64.rpm
Size:    7534788
MD5:     None

Installed Systems: 0

Description
-----------
This package adds C++ support to the GNU Compiler Collection. It
includes support for most of the current C++ specification, including
templates and exception handling.

Available From Channels
-----------------------
rhel-x86_64-server-7

DEBUG: package_details gcc-c\\++\\-4.8.2-16.2.el7_0.x86_64: None

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments