The run() utility function from ipapython/ipautil.py is called inconsistently throughout the code base. Sometimes it is invoked with the full path of the external command (e.g. '/usr/bin/kinit') and sometimes without (e.g. 'kinit').
run()
ipapython/ipautil.py
'/usr/bin/kinit'
'kinit'
Invocations of this function should be consolidated so that it is always called in a consistent way.
Rob already raised an interesting point that we should rather call programs with relative name, i.e. "kinit" instead of "/usr/bin/kinit" to avoid problems when the program is being run on other platform with different absolute path.
This is what I would propose: 1. PATH should be always set unless it is overriden in env. Now, when any env is passed, PATH is omitted:
def run(...): ... if env is None: # copy default env env = copy.deepcopy(os.environ) env["PATH"] = "/bin:/sbin:/usr/kerberos/bin:/usr/kerberos/sbin:/usr/bin:/usr/sbin"
I would propose that we instead fix our build system to make paths to (not just) binaries customizable at build time using autotools (or whatever). That would solve more than just this particular issue and clean the whole guess-where-a-file-is mess.
If you just want to enfoce the non-absolute paths, make run check for the first parameter not to start with a slash (and fail if it does).
Metadata Update from @akrivoka: - Issue assigned to someone - Issue set to the milestone: Ticket Backlog
This was resolved with the platform code.
Metadata Update from @rcritten: - Issue close_status updated to: fixed - Issue status updated to: Closed (was: Open)
Login to comment on this ticket.