From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 00ECD5A0262 for ; Fri, 16 Jun 2023 23:04:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686949456; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=it68a1h9xjNbPdbWdbZXIZRaBtsdEx1d8zzXzKV/riE=; b=d7lYFul5OELUWKdoTZuTqB+xQtn5qtMYiWFHl4zP2bUZojQvUnAAS0b1VaRzTaZj1mfiV8 7lHBiXP3ErnKCRTSo5Vo/xVtSe8cKL3z81u/UAUzOCt2wSt/GbK/YN5nf/4iE2QwdfWy0J 5rh8tGoSbRqa7QpnUiKsHujYMy4u7CY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-255-UaHaxTAzNky1MA_V6bCYzg-1; Fri, 16 Jun 2023 17:04:15 -0400 X-MC-Unique: UaHaxTAzNky1MA_V6bCYzg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BDFF8185A794 for ; Fri, 16 Jun 2023 21:04:14 +0000 (UTC) Received: from elisabeth (unknown [10.39.208.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D02D2166B25; Fri, 16 Jun 2023 21:04:13 +0000 (UTC) Date: Fri, 16 Jun 2023 23:04:00 +0200 From: Stefano Brivio To: Paul Holzinger Subject: Re: Option parsing: Allow the same option multiple times Message-ID: <20230616154306.1071c4a3@elisabeth> In-Reply-To: <895dae7d-3e61-4ef7-829a-87966ab0bb3a@redhat.com> References: <895dae7d-3e61-4ef7-829a-87966ab0bb3a@redhat.com> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: RG4RBBUR4RILFUL4R6VF4NPRWFITEVPG X-Message-ID-Hash: RG4RBBUR4RILFUL4R6VF4NPRWFITEVPG X-MailFrom: sbrivio@redhat.com 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: 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: On Thu, 15 Jun 2023 14:57:37 +0200 Paul Holzinger wrote: > Hi all, > > following up on a quick discussion with Stefano on IRC. > > passt/pasta currently rejects most (not all) options when specified > multiple times, i.e. pasta -I eth0 -I eth1 ... fails. I think it makes > more sense to just use the last one instead. > > My use case: In podman I added a new containers.conf option[1] which > allows users to set default pasta cli options. However users can also > add options on the podman cli with podman run --net=pasta:... For me it > would make the most sense to just append those to the config options and > then let pasta deal with it. This allows some form of overwrite > mechanism, i.e. by default I may have "-I" , "eth0" in containers.conf > but for one specific container I want to use a different interface name > and set --net=pasta:-I,eth1 on the cli. Then podman should just hand "-I > eth0 -I eth1" to pasta and then pasta picks the last one. > > If we keep the current behavior it means I am forced to parse the > options in podman and dedup them which is hard to maintain as podman > would need to keep up with pasta upstream. I had to do something similar in libpod/networking_pasta_linux.go, which, if you change this, could also be simplified a bit. > I am willing to send a patch to change this so please let me know if > anyone would object to that. For the record, as I mentioned on IRC, I think it makes sense. 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. 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)." 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. -- Stefano