About compatibility

POSIX, Linux, Solaris systems have -A parameter for ps command.
Only OpenWRT not.

Ok, OpenWRT no needs to -A parameter. But why ps -A close with error? Do I need to rewrite all shell script for OpenWRT especially?

OpenWrt routers typically have limited flash space, so most of the typical helper applications are provided by the size optimized busybox. Its apps may have somewhat limited functionality.

If you need full apps, they are typically provided as add-on packages, like coreutils etc. I think that procps-ng has also the full-scale ps

2 Likes

You don't quite understand my message.

Well I think the message was clearly understood.

You asked

And the answer is that the ps version in Openwrt is using the version from busybox by default to save space. And that version will say that -A is unrecognized.
If your script require that option then you would need to install the full feature version of ps as indicated.

3 Likes

???

Because the -A is not supported. Or do you think that any unrecognised option should just be ignored?

root@router1:~# ps -A
ps: unrecognized option: A
BusyBox v1.33.0 () multi-call binary.

Usage: ps

Show list of processes

        w       Wide output
2 Likes

Yes, I think that unsupported options must be ignored.
-A must be allowed on POSIX-compatible system.

Well, who said that busybox is fully POSIX compliant?

2 Likes

You are raising an issue about BusyBox behavior.
The proper place to report this kind of issue is here:
https://bugs.busybox.net/

2 Likes

Isn't that OpenWRT has own edition of BusyBox?

OpenWrt relies on the upstream:
https://github.com/openwrt/openwrt/blob/master/package/utils/busybox/Makefile#L16-L17

So, you should first file a ticket on the upstream bug tracker.
OpenWrt devs are unlikely bored enough to patch external project such as BusyBox for no valid reason.

3 Likes

No, you do not, like @hnyman mentioned run: opkg update; opkg install procps-ng-ps;. You might want to insert a line at the top of the script to ensure that procps-ng-ps is installed on OpenWrt:

if [ ! -x /bin/procps-ng-ps ]; then opkg update; opkg install procps-ng-ps; fi
3 Likes

This is monumentally bad, silent failures are always bad because you don't know what fails until you run a lengthy debug process.
Most commands will return an error if called with wrong (or missing) arguments.

POSIX is not enforced by anyone so projects may or may not support it. Welcome to software development

2 Likes

To be fair, there are other BusyBox applets which silently ignore unsupported options.
So the actual behavior is certainly inconsistent depending on a specific applet and option.

does not change what I said, anyone that thinks unsupported options must be ignored is wrong and causing immesurable amounts of grief to anyone else that will develop on the same system for years to come.

2 Likes

Immesurable amounts of grief causing that who generates meaningless dialects of the centuries established structures.

Specifically: on Bysybox ps m same as ps -A m on all unix and Linux, except freebsd. Why on Busybox ps -A m close with the error instead silently run ps m?

A wrong old tradition is still wrong, and I'm not more inclined to agree with it.

OpenWrt is just packaging their tool in the system, we don't know.

You need to ask/complain to Busybox developers, as this was their choice. https://busybox.net/lists.html

1 Like

Somehow OpenWrt (and other busybox using environments) has managed to survive 17 years without an implementation for ps -A, so there must be a life without it…

4 Likes