Re: add non-option reordering to in-tree getopt_long

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: nathandbossart(at)gmail(dot)com
Cc: noah(at)leadboat(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org
Subject: Re: add non-option reordering to in-tree getopt_long
Date: 2023-06-15 05:30:34
Message-ID: 20230615.143034.1555041904838122564.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 14 Jun 2023 15:46:08 -0700, Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote in
> On Wed, Jun 14, 2023 at 03:11:54PM -0700, Noah Misch wrote:
> > Here's some output from this program (on AIX 7.1, same output when compiled
> > 32-bit or 64-bit):
> >
> > $ ./a.out a b c d e f
> > f e d c b a ./a.out
>
> Thanks again.
>
> > Interesting discussion here, too:
> > https://github.com/libuv/libuv/pull/1187
>
> Hm. IIUC modifying the argv pointers on AIX will modify the process title,
> which could cause 'ps' to temporarily show duplicate/missing arguments
> during option parsing. That doesn't seem too terrible, but if pointer
> assignments aren't atomic, maybe 'ps' could be sent off to another part of
> memory, which does seem terrible.

Hmm, the discussion seems to be based on the assumption that argv[0]
can be safely redirected to a different memory location. If that's the
case, we can prpbably rearrange the array, even if there's a small
window where ps might display a confusing command line, right?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiro Ikeda 2023-06-15 06:06:01 Support to define custom wait events for extensions
Previous Message Thomas Munro 2023-06-15 05:22:49 Re: Bypassing shared_buffers