On Fri, May 22, 2015 at 12:59 PM, Alvaro Herrera wrote:
> Tom Lane wrote:
>> Note that we should not rip out the existing code, because part of the
>> reason for that is that it acts before any of the other stuff that runs
>> before getopt parsing starts, eg the postmaster's refusal to run if you're
>> root.
>
> No objection to that, though I wonder (without looking at the code) if
> for binaries other than postmaster this is really worthwhile.
I would plead for consistency in this area, aka moving the root check
before the option parsing for all the utilies, still check --help and
--version are argv[1] (or argv[optind]), and move them as well in
getopt_long parsing to get cleaner error messages be one of them
mentioned. I can believe that some people may want to have quick looks
at --help or --version even when running a binary utility as root even
if it is not permitted to run under such circumstances.
--
Michael