#7746 IPA help command fails in an environment without the `less` binary
Closed: fixed Opened by stlaz.

Steps to reproduce:
https://github.com/freeipa/freeipa-container/issues/248#issue-375492686


Culprit commit: caed210bc26c0220c9292c40b66177cda671a34f

The bug report doesn' follow the bug report template, e.g. doesn't state the version, expected behavior or use case. But I'll assume that the request here is to help in environments with and without less command. E.g. if there is less then show the output "paged" if not then print everything.

Also, the possible view on the bug could be that the respected client package doesn't depend on less.

a workaround is to set PAGER environment variable to a utility that can be used instead of less.

PAGER=more
export PAGER
ipa help commands

Easy fix: add less to package dependencies for python2-ipalib and python3-ipalib.

Metadata Update from @cheimes:
- Issue tagged with: easyfix

Easy fix: add less to package dependencies for python2-ipalib and python3-ipalib.

+1. If FreeIPA's code calls external less, it should make sure it is installed via rpm Requires.

Note that there is already support for $PAGER. What is missing is the test for the executable existence.

If the pager lookup is extracted from open_in_pager() then this would be pretty trivial:

pager = get_pager()
if os.path.exists(pager): open_in_pager(pager, data)
else: for something in something: print

Metadata Update from @okozlov:
- Issue assigned to okozlov

Metadata Update from @cheimes:
- Assignee reset
- Issue set to the milestone: FreeIPA 4.7.2

Metadata Update from @okozlov:
- Issue assigned to okozlov

master:

  • a0e09526b3851602ff9e9bc6c12e34d5f77db125 Check pager's executable before subprocess.Popen

ipa-4-7:

  • e0315a601feaee2e4aeb7db33bcf87de8ac4a4f7 Check pager's executable before subprocess.Popen
  • c646f8adc32b16a0f7066d217a41a1930c9fd5ac Fix python2 compatibility

Fixed. Added checking of a pager's executable before subprocess.Popen.

If PAGER environment variable is defined check it - do which (check the path, is it a file and check does it has +x). If it is ok - use a pager, otherwise - print function.

Metadata Update from @okozlov:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata Update from @fcami:
- Custom field rhbz adjusted to https://bugzilla.redhat.com/show_bug.cgi?id=1679958

Issue linked to Bugzilla: Bug 1679958

Metadata