#3781 new defect

RSB crashes in case the host as an unreadable directory in "/"

Reported by: Sebastian Huber Owned by:
Priority: normal Milestone: 5.1
Component: tool/rsb Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

butrfeld@elektra:~/rtemsSMP/src/rsb/rtems$ ../source-builder/sb-set-builder --source-only-download 5/rtems-sparc
RTEMS Source Builder - Set Builder, 5 (29fab0500e22)
Traceback (most recent call last):
  File "../source-builder/sb/cmd-set-builder.py", line 26, in <module>
    setbuilder.run()
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/setbuilder.py", line 674, in run
    if not check.host_setup(opts):
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/check.py", line 127, in host_setup
    if not path_check(opts):
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/check.py", line 115, in path_check
    elif not path.exists(p):
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/path.py", line 131, in exists
    return _exists(shell(paths))
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/path.py", line 124, in _exists
    return basename(p) in ['.'] + listdir(dirname(p))
  File "/users/staff/butrfeld/rtemsSMP/src/rsb/source-builder/sb/path.py", line 118, in listdir
    return os.listdir(hp)
OSError: [Errno 13] Permission denied: '/adm'

The root directory "/" looks like this:

butrfeld@elektra:/$ ls -ls
total 89
 4 drwxr-x---+   6 root root  4096 Nov  5  2018 adm
 4 drwxr-xr-x    2 root root  4096 Apr 10 06:17 bin

Change History (1)

comment:1 Changed on Aug 9, 2019 at 10:49:09 AM by Sebastian Huber

In source-builder/sb/check.py:

def path_check(opts, silent = False):
    if 'PATH' in os.environ:
        paths = os.environ['PATH'].split(os.pathsep)
        for p in paths:
            if len(p.strip()) == 0:
                if not silent:
                    log.notice('error: environment PATH contains an empty path')
                return False
            elif not options.host_windows and (p.strip() == '.' or p.strip() == '..'):
                if not silent:
                    log.notice('error: environment PATH invalid path: %s' % (p))
                return False
            elif not path.exists(p):
                if not silent and opts.warn_all():
                    log.notice('warning: environment PATH not found: %s' % (p))
            elif not path.isdir(p):
                if not silent and opts.warn_all():
                    log.notice('warning: environment PATH not a directory: %s' % (p))
    return True

The path.exists() seems to be rather complicated, why is it necessary in addition to path.isdir()? What is the overall goal of this check? Is it not the responsibility of the user to take care of his $PATH variable?

Note: See TracTickets for help on using tickets.