Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-8318

/usr/bin/vdo import statements can name clash with other packages

    • None
    • None
    • rhel-sst-logical-storage
    • ssg_filesystems_storage_and_HA
    • 1
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:
      The /usr/bin/vdo script on RHEL 7 contains the following code in order to deal with importing modules from the vdo package:

      ~~~

      1. Temporary patch to address layout changes
        for dir in sys.path:
        vdoDir = os.path.join(dir, 'vdo')
        if os.path.isdir(vdoDir):
        sys.path.append(vdoDir)
        break
        ~~~

      This is so it can later do:

      ~~~
      from utils import Command, Logger
      from vdomgmnt import *
      ~~~

      However, this can name clash with other installed modules (for example, if there's an 'utils' Python package that was installed via pip).

      The RHEL 8 version of vdo already fixes this, using the correct syntax for importing Python code:

      ~~~
      from vdo.utils import Command
      from vdo.vdomgmnt import *
      ~~~

      Version-Release number of selected component (if applicable):
      vdo-6.1.3.23-5.el7.x86_64

      How reproducible:
      Every time if there's a package name that clashes with one of the vdo modules.

      Steps to Reproduce:
      1. Install a Python package that name clashes with one of the vdo modules (e.g. 'pip2 install utils')
      2. Run 'vdo'
      3.

      Actual results:
      Traceback (most recent call last):
      File "/usr/bin/vdo", line 50, in <module>
      from utils import Command, Logger
      ImportError: cannot import name Command

      Expected results:
      No error, and vdo runs normally

      Additional info:

              awalsh1@redhat.com Andrew Walsh
              rhn-support-jsantos Juan Santos
              Robert Johnston Robert Johnston
              Filip Suba Filip Suba
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: