Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect_shell fails on IBM i / AIX #21

Open
kadler opened this issue Mar 14, 2019 · 3 comments · May be fixed by #23
Open

detect_shell fails on IBM i / AIX #21

kadler opened this issue Mar 14, 2019 · 3 comments · May be fixed by #23
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kadler
Copy link

kadler commented Mar 14, 2019

>>> import shellingham
>>> shellingham.detect_shell() 
ps: illegal option -- w
ps: illegal option -- w
Usage: ps [-ANPaedfklmMZ] [-n namelist] [-F Format] [-o specifier[=header],...]
                [-p proclist][-G|-g grouplist] [-t termlist] [-U|-u userlist] [-c classlist] [ -T pid] [ -L pidlist] 
                [-@ [wparname] ]
Usage: ps [aceglnsuvwxX] [t tty] [ProcessNumber]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/QOpenSys/pkgs/lib/python3.6/site-packages/shellingham-1.3.1.dev0-py3.6.egg/shellingham/__init__.py", line 25, in detect_shell
shellingham._core.ShellDetectionFailure

The problem is that the AIX version of ps does not support the -w option. It does support the w option (without the - prefix) in Berkeley mode, but then it doesn't support the -o option. 😞

kadler added a commit to kadler/shellingham that referenced this issue Mar 14, 2019
AIX ps does not support -w option in POSIX mode, only in Berkeley
mode ('w'), but Berkeley mode doesn't support -o, so just remove
-ww and hope for the best.

Fixes sarugaku#21
kadler added a commit to kadler/shellingham that referenced this issue Mar 14, 2019
AIX ps does not support -w option in POSIX mode, only in Berkeley
mode ('w'), but Berkeley mode doesn't support -o, so just remove
the -ww option and hope for the best.

Fixes sarugaku#21
@uranusjr
Copy link
Member

I have absolutely zero experience on IBM systems, but one quick solution would be to look for /proc support, which is used if possible. Try this and see if it works

>>> from shellingham.posix import proc
>>> proc.detect_proc()   # This tries to check whether /proc is available.

If the above passes without exception, we’ll need to check why the proc format cannot be parsed. Otherwise we’ll need to play with ps. The w options are not essential (it isn’t that easy to hit the width limit), so there’re definitely ways to work around it.

If only I can get my hands on an actual IBM machine to play with. That’d be a cool exxperience.

@uranusjr uranusjr added enhancement New feature or request help wanted Extra attention is needed labels Mar 14, 2019
@kadler
Copy link
Author

kadler commented Mar 14, 2019

I believe AIX has /proc starting with 7.1, but it's files are binary structures: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.files/proc.htm It also has no /proc/<pid>/cmdline

We run a subset of the AIX runtime on top of the IBM i OS and it has no /proc support at all ☹️

@uranusjr
Copy link
Member

Why do these UNIX system vendors make things so difficult 😞

@uranusjr uranusjr linked a pull request Mar 15, 2019 that will close this issue
Moomboh added a commit to Moomboh/shellingham that referenced this issue May 13, 2023
@Moomboh Moomboh mentioned this issue May 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants