Home › Forums › OS X Server and Client Discussion › Misc. › Am I the only idiot who got bit by the changes to ‘ps’?
- This topic has 0 replies, 1 voice, and was last updated 17 years, 5 months ago by
khiltd.
-
AuthorPosts
-
November 10, 2007 at 6:09 pm #370497
khiltd
ParticipantThe other day I noticed that I had logs filling up with
[code]No user named ‘x'[/code]
I tracked it down to a custom launch agent that was utilizing the ‘ps -aux’ command to figure out whether or not a process was running before attempting to start it back up. This command, which had worked successfully for years, was now expecting an argument after the -u option. Fair enough, but I had no idea why.
The first time I attempted to seek the assistance of the general public I received a snippy response from one of the Macfixit authorlords suggesting that I “read the man page” and very little else. Confused, I decided to read the man page that was on my RedHat box, and found it to be infinitely more helpful than Leopard’s. Within the first few paragraphs, well before any details are discussed, it contains a very simple explanation which anyone can understand immediately:
[code]Note that “ps -aux” is distinct from “ps aux”. The POSIX and UNIX standards require that
“ps -aux” print all processes owned by a user named “x”, as well as printing all processes
that would be selected by the -a option. If the user named “x” does not exist, this ps may
interpret the command as “ps aux” instead and print a warning. This behavior is intended to
aid in transitioning old scripts and habits. It is fragile, subject to change, and thus
should not be relied upon. [/code]Now if that had been in the OS X version I certainly wouldn’t have felt so stupid. I scoured some more, and waaaaay down at the bottom, under a section titled “LEGACY DESCRIPTION” Leopard’s man page [i]does[/i] state that:
[code]The biggest change is in the interpretation of the -u option, which now dis-
plays processes belonging to the specified username(s). Thus, “ps -aux” will
fail (unless you want to know about user “x”). As a convenience, however, “ps
aux” still works as it did in Tiger.[/code]So I suppose it was there after all, I just didn’t see it.
I’m certainly not complaining that they brought the tool into compliance with POSIX standards, but why can’t they also follow the convention of generating a warning rather than total failure and bring the man page up to speed for us stupid people who tend to read the current documentation rather than the “legacy” malarkey way down at the bottom, too? Incorrect or not, I can’t possibly be the only person who’s gotten used to typing ‘ps -aux’ in the world. Or can I?
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed