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 1q9Yih-0000ou-TN for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jun 2023 22:12:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9Yig-0003K1-H6 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jun 2023 22:12:02 +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 1q9Yif-0003Jr-W2 for pgsql-hackers@lists.postgresql.org; Wed, 14 Jun 2023 22:12:02 +0000 Received: from mail-yw1-x1131.google.com ([2607:f8b0:4864:20::1131]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q9Yic-002EWy-Vy for pgsql-hackers@postgresql.org; Wed, 14 Jun 2023 22:12:00 +0000 Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5700b15c12fso11712057b3.1 for ; Wed, 14 Jun 2023 15:11:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1686780718; x=1689372718; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=GIjYp8121XmPhthLRbYKV8F95WKHbGWT2j6Iu51jIYM=; b=VF9o/IhyYP+XyYp2ztcrFUh3cb/86+Ypce1qmlKbI4XnaQz7uRjgRz0uBOf4NuIMVt J+pV/VPhFgXgYFn89eiRxamvmSJycxYJyqSVsc02jJViI3HKQgVlZZnHzfMn0xyXgJr3 cNi9+ZH7DGiykr4ryK5uhmziYs9KyNxmz0U3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686780718; x=1689372718; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GIjYp8121XmPhthLRbYKV8F95WKHbGWT2j6Iu51jIYM=; b=ZzFYFonJhwevGryIF4w0r6YAEJYSLt1WvRo6mylY8gkfJNIwLHwv/7py4iJB/0aqkz jd6r1iGAln1ZwMDNNDEgC30jJLuw2MFVQluVEsEAWc2d+dMbC6OCsLkRHi7JhwO7Wa5h W1mQL25uhcu4ZYr8QZ+R0+1iOCxJI60dSeR46rtH9tjOu9f4Ub47GsuZ1P435b+/Tpbf x0oupxsd3pLgjgkurO9n/MCD/kMFH1imrSSzZrW0gQFrKwhxyhzWHbFuVS0QnmCFShKz EuCdDaRyW0dVmlfWft4WQWitJYoXYVGhGNKY3oftb52FTkuJGstgOf5wKrmod+ipbec9 r2eg== X-Gm-Message-State: AC+VfDx1avRGbJgQTldn61p1iLVrRUiVqZXbxmj7Kvyvc8298kCaTprb zR9vRtPxizG9+a9iHxgIUpiiYg== X-Google-Smtp-Source: ACHHUZ5TUFQlQ9kq029B4tEvPXty/0iT4ud1XLao9Pg/JP5EB/D/E8aSQO+0GjwVNKuC6KNzrVCBOQ== X-Received: by 2002:a0d:cc48:0:b0:56d:53f6:2b80 with SMTP id o69-20020a0dcc48000000b0056d53f62b80mr3520305ywd.2.1686780718192; Wed, 14 Jun 2023 15:11:58 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id g124-20020a0dc482000000b0056d4c86b639sm1007785ywd.9.2023.06.14.15.11.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2023 15:11:56 -0700 (PDT) Date: Wed, 14 Jun 2023 15:11:54 -0700 From: Noah Misch To: Nathan Bossart Cc: Michael Paquier , Kyotaro Horiguchi , pgsql-hackers@postgresql.org Subject: Re: add non-option reordering to in-tree getopt_long Message-ID: <20230614221154.GA1656253@rfd.leadboat.com> References: <20230609232257.GA121461@nathanxps13> <20230613.120001.2091320520660271559.horikyota.ntt@gmail.com> <20230613051343.GA211254@nathanxps13> <20230613.160201.833376179512503274.horikyota.ntt@gmail.com> <20230613223657.GC219055@nathanxps13> <20230614001737.GB1607568@rfd.leadboat.com> <20230614212816.GA492731@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230614212816.GA492731@nathanxps13> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jun 14, 2023 at 02:28:16PM -0700, Nathan Bossart wrote: > On Tue, Jun 13, 2023 at 05:17:37PM -0700, Noah Misch wrote: > > If you have a test program to be run, I can run it on AIX. > > Thanks. The patch above [0] adjusts 040_createuser.pl to test modifying > argv, so that's one test program. And here's a few lines for reversing > argv: > > #include > > int > main(int argc, char *argv[]) > { > for (int i = 0; i < argc / 2; i++) > { > char *tmp = argv[i]; > > argv[i] = argv[argc - i - 1]; > argv[argc - i - 1] = tmp; > } > > for (int i = 0; i < argc; i++) > printf("%s ", argv[i]); > printf("\n"); > } 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 Interesting discussion here, too: https://github.com/libuv/libuv/pull/1187