From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 77DD25A026D for ; Mon, 19 Jun 2023 07:03:38 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4QkyMm1lSjz4x0B; Mon, 19 Jun 2023 15:03:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1687151012; bh=aQdAqY5is0H2MhATyxtH/l9bgkva9Z38qo65+F2mOl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mtnD46kg4+h8ItgNZ48eFbgbP7QPlJsyiBeUdNXhJPa+QvbmiLo2COgqMsnrWUM+r JGbYI1ehBiC7NOfJ+RmOT8FpP39mCbkCwqH8Igi1yfa7bLhpjEYs25Y/kjednGDTXg cGiYYkpZfkyZJVQLgJ1/sJDf1jRLa/gdrVF15xEA= Date: Mon, 19 Jun 2023 14:49:42 +1000 From: David Gibson To: Stefano Brivio Subject: Re: Option parsing: Allow the same option multiple times Message-ID: References: <895dae7d-3e61-4ef7-829a-87966ab0bb3a@redhat.com> <20230616154306.1071c4a3@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gd1odDJOXNADA7MZ" Content-Disposition: inline In-Reply-To: <20230616154306.1071c4a3@elisabeth> Message-ID-Hash: FLNKEJ4LCKNEOVHQFZNKLKO3JEJ7MYN3 X-Message-ID-Hash: FLNKEJ4LCKNEOVHQFZNKLKO3JEJ7MYN3 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Paul Holzinger , passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --gd1odDJOXNADA7MZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 16, 2023 at 11:04:00PM +0200, Stefano Brivio wrote: > On Thu, 15 Jun 2023 14:57:37 +0200 > Paul Holzinger wrote: >=20 > > Hi all, > >=20 > > following up on a quick discussion with Stefano on IRC. > >=20 > > passt/pasta currently rejects most (not all) options when specified=20 > > multiple times, i.e. pasta -I eth0 -I eth1 ... fails. I think it makes= =20 > > more sense to just use the last one instead. > >=20 > > My use case: In podman I added a new containers.conf option[1] which=20 > > allows users to set default pasta cli options. However users can also= =20 > > add options on the podman cli with podman run --net=3Dpasta:... For me = it=20 > > would make the most sense to just append those to the config options an= d=20 > > then let pasta deal with it. This allows some form of overwrite=20 > > mechanism, i.e. by default I may have "-I" , "eth0" in containers.conf= =20 > > but for one specific container I want to use a different interface name= =20 > > and set --net=3Dpasta:-I,eth1 on the cli. Then podman should just hand = "-I=20 > > eth0 -I eth1" to pasta and then pasta picks the last one. > >=20 > > If we keep the current behavior it means I am forced to parse the=20 > > options in podman and dedup them which is hard to maintain as podman=20 > > would need to keep up with pasta upstream. >=20 > I had to do something similar in libpod/networking_pasta_linux.go, > which, if you change this, could also be simplified a bit. >=20 > > I am willing to send a patch to change this so please let me know if=20 > > anyone would object to that. >=20 > For the record, as I mentioned on IRC, I think it makes sense. >=20 > Maybe it's less "correct" as a behaviour, and it would make it a bit > harder for users to spot (unlikely) mistakes on the command line, but > making integrations simpler probably outweighs this. >=20 > I don't have a good idea for sentences like "This option can be > specified zero (for defaults) to two times (once for IPv4, once for IPv6)= =2E" > that are currently in the man page... maybe we could switch from > "This option can be specified" to "This option specifies one to two..." > and similar. So, I'm actually a bit hesitant about applying this treatment (allow multiple, last one wins) to -a specifically. The reason being that we have draft plans to allow multiple addresses within the guest/ns. That might logically lead to allowing arbitrary numbers of -a options in future, where *all* the addresses apply. If we'd previously allowed multiple options, but only the last one applies, that might be a breaking semantic change. --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --gd1odDJOXNADA7MZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmSP3j4ACgkQzQJF27ox 2GcPWhAApxJT4fM1XgyzJkfRvMIBVGXed7zgprewjCNvIotU9sn1GY8pg3cFCtTc wt0hxLSu5f6xSyV0WfTPkipgHYxjiTe87C2yNB3EKwky29JvkliqbgorNNX1a+ej VtFLUeB72hEHlfWDRJd4ivF2Ir3bwcsvDCPYiIxmdAcnTtdbMX7ZMDSrKUzf3iZD Sg3xruqu25mdfZfL2JigzDzwQEWVWVsyJYAFuQOpd8WL/VqDasFfR3KLopk+x52q 3mULn6SjCp9gQIddQFHWgi5rUsMMZWt29xliItIJMo8yN7586DMDq29pUIg8Hnur 8yr5Tj2VWyhr5yPyMG5EWvp1SkpCreym/PNjJaF3VebZur+aOacVkdLywXkTkSSD U6Gdu6mUFQ9iJ4J95bcQAJ3EuvXiqjaQ0B5dW3G69viOEq8zuLqEKVfDTKlWDbR2 MC80wWADPJvciydvGKiFsNQlWvM4suhbmzD3vbUnmJGbosEknkCfZfAHeePmrDRE C20YrVvYVocyG6tNjaDKXlhMev14iiXGRioZ8FjXqlUtlR6CLFgaj3JXF2iGe3ET M8jaWnClGDpT8NsZBdZcU0HM+4VxPDXIPPddsUNwg05dwAsBdmNTk3FvNayRmc/z dKm++3yUIwrrn5Bu94HHZuqQ4Ar1lDc0rn+oGhUhniWJyxWCvmM= =0I2N -----END PGP SIGNATURE----- --gd1odDJOXNADA7MZ--