Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q8y2a-0000eV-QT for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2023 07:02:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q8y2Z-0007qH-DL for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2023 07:02:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q8y2Z-0007q4-3q for pgsql-hackers@lists.postgresql.org; Tue, 13 Jun 2023 07:02:07 +0000 Received: from mail-oi1-x22f.google.com ([2607:f8b0:4864:20::22f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q8y2W-001vj4-Mo for pgsql-hackers@postgresql.org; Tue, 13 Jun 2023 07:02:05 +0000 Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-39ce64700cbso1012288b6e.0 for ; Tue, 13 Jun 2023 00:02:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686639724; x=1689231724; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=+C0mpquZSYsJ67myslos+Aj+Z8DZr9hyySNXHiBb9cI=; b=Lyde1zGDCr4iuF23rr8xAmuLOCvcejY5tTknNdndzgPgaNu+USotW/X0JU0jnSvolG q8fNvFCigt3av3hrOh2ayNkkWWtvZtYJZ9aklRwVO9Jxnf26n1FpIU+th8+BYI8U2Ebv bFrR9lXIpNBLeBr0C9kJn9bEwufSHMv4SwTIVdMyqCjkBqT7Z0vE8FYmOnoS5O4rHb3b hMjRIXtlGx63qoNens+9g51hHLVewxQs16T3P1FpBQ+qh/f0zR4pQjT8NzWOJQdpY+XE AFLQdZhe6OOYGXr8h3hEnqFx9YIZXoc7/uo0HytXqVU3zKKw47i2gaElRZrwy5aHJOxa 39jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686639724; x=1689231724; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+C0mpquZSYsJ67myslos+Aj+Z8DZr9hyySNXHiBb9cI=; b=U3lYifTvZJQtXxyXf5aVLwh1eP5/gUXHV2cOpMly9NwqyXoRf6b/nRmO9zCDU6QWFh nnuOOLhMJAX7KPqYZn2ZJmV8W7pOvuovk+dYNt/0jvQo8XrugILk9bWELHWfSuMrkgjs ByXUWcDOWa+Sjqxf463Sg/dXYWOIg0/yFkm0ttNCBay+hCsYfeC9vk93kQZca+lLf4v9 eeSg+fo71nZR9ryflCq9qAUa1PcoDwpnTAZDvSXbQ2IzYTv1xMCkeoQQvSfqvdUluOJ8 Dnu5v+aQCpNp6OJh3KSdIa4jsKN0kXUTcGmmGQAN0hz1Worb0R7yiKdegG+H4TaJ9x3H kqGQ== X-Gm-Message-State: AC+VfDxWmePIod8ulfqiWH0Uw2OhtutkjtX1V1k/BTOH2aWHoDfgz6Q0 43Z8BGWrxoqThtY+yU6ZHyD4YngAi2Y= X-Google-Smtp-Source: ACHHUZ5iPAz9R80n8DCA4KhGJB7TEYv5/OmsqjnZWD6+hveGXgBaECsm49/qf3+wtmExa9RZFbLtqw== X-Received: by 2002:a54:480d:0:b0:398:29bb:dd4a with SMTP id j13-20020a54480d000000b0039829bbdd4amr6300060oij.54.1686639723783; Tue, 13 Jun 2023 00:02:03 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id ja1-20020a170902efc100b0019a6cce2060sm2781510plb.57.2023.06.13.00.02.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 00:02:03 -0700 (PDT) Date: Tue, 13 Jun 2023 16:02:01 +0900 (JST) Message-Id: <20230613.160201.833376179512503274.horikyota.ntt@gmail.com> To: nathandbossart@gmail.com Cc: pgsql-hackers@postgresql.org Subject: Re: add non-option reordering to in-tree getopt_long From: Kyotaro Horiguchi In-Reply-To: <20230613051343.GA211254@nathanxps13> References: <20230609232257.GA121461@nathanxps13> <20230613.120001.2091320520660271559.horikyota.ntt@gmail.com> <20230613051343.GA211254@nathanxps13> User-Agent: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Mon, 12 Jun 2023 22:13:43 -0700, Nathan Bossart wrote in > On Tue, Jun 13, 2023 at 12:00:01PM +0900, Kyotaro Horiguchi wrote: > > POSIXLY_CORRECT appears to be intended for debugging or feature > > validation. If we know we can always rearrange argv on those > > platforms, we don't need it. I would suggest that we turn on the new > > feature at the compile time on those platforms where we know this > > rearrangement works, instead of switching at runtime. > > I'd be okay with leaving it out wherever possible. I'm curious whether any > supported systems do not allow this. Hmm. from the initial mail, I got the impression that AIX and Windows allow this, so I thought that we can do that for them. While there could be other platforms that allow it, perhaps we don't need to go as far as extending this until we come across another platform that does. > > As far as I can see, getopt_long on Rocky9 does *not* rearrange argv > > until it reaches the end of the array. But it won't matter much. > > Do you mean that it rearranges argv once all the options have been > returned, or that it doesn't rearrange argv at all? I meant the former. argv remains unaltered until getopt_long returns -1. Once it does, non-optional arguments are being collected at the end of argv. (But in my opinion, that behavior isn't very significant in this context..) regards. -- Kyotaro Horiguchi NTT Open Source Software Center