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 D738E5A004E for ; Thu, 08 Aug 2024 11:37:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723109862; 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=IbGFpk67/xIe2JN9c3NYfvVie2BoyEtm/qJaR5CCWyM=; b=ehKk4Wh9kGun084mKsCeG8E8Sb1NmnjvMT0J42PsmQEAsgqgKjeqkMrXCpdol1MYFmss8q 6slRTrLafG0qyr2RbhF8KDaz2J/dqUSCtLTmu76F11yVRE+WJPyUqSvHqrZX/ec0Zi7lGw 3PqN9FtQrXHilTno2yiz72cIqhDDyDE= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-cwNxJi_eNAmuJgLbg7qagA-1; Thu, 08 Aug 2024 05:37:41 -0400 X-MC-Unique: cwNxJi_eNAmuJgLbg7qagA-1 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5bb35b28f82so561528a12.2 for ; Thu, 08 Aug 2024 02:37:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723109860; x=1723714660; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=IbGFpk67/xIe2JN9c3NYfvVie2BoyEtm/qJaR5CCWyM=; b=QwlfkqH4VfritLQRwVPJu2MTfRTOacpnUmniQ3OLUIs94mhgmZ7BCJEiUUmgxsuMZ0 3Nj1Gs3dCsBme/+5hy2YvUWeq0P+6qZzjq5l6sgRMyUOJrM9lyQnOgezAzyhAjRoK/eo llVtgxTMhCcSvxneR6Jl3N6Cgf69/28Ay8Xog5JiBBvRAvcFv9oXJWRdAA4+IHwm1tbn 20SgaU1pr4Mnw1eUUv+mmF20sWJ97DAoyj5FOeQPHszJZJMhIEW5kEbjCzHj85Ocx8qG MgfJKUxRpSkKAqNO52qZ7osDFvG/HD5NJ29n4ayWjRKssyWNAY2FsASmfehcWHS1VvGt jDww== X-Forwarded-Encrypted: i=1; AJvYcCWP76kEnd9AJN4yXLfIem5uAYevcFQeBx9IK16L54Bb5y8utbtmw4qWJs3zPh1xYXoaNT4isOmJpJWo12id+g+hR6DA X-Gm-Message-State: AOJu0YwSvFcPb1kzg5sLeRe/jF67Fz9kfuZRLZl+Yxk0r/7Y7IZ+ukvE 4r8Me7Y8kxywOCakSHq4asbIRgVYNtt8jxwJj7NtJdy9/mpLeKKaIAxopbOz3CYgcflBVFCsofO ucqiafQ4/bpCkchWdbpbeHxZRawSuInbLZ9NV8Cs4FCtPUGTcKw== X-Received: by 2002:a05:6402:278d:b0:5a1:a447:9fa7 with SMTP id 4fb4d7f45d1cf-5bbb221c4ddmr1029125a12.15.1723109860003; Thu, 08 Aug 2024 02:37:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFo29MIGGqLuUt7GCTxXKXpPRD/FeKXlcH6cq/zYX2y1Kcoy0VFCfkE2vISzUUBmjBV/ASnCQ== X-Received: by 2002:a05:6402:278d:b0:5a1:a447:9fa7 with SMTP id 4fb4d7f45d1cf-5bbb221c4ddmr1029111a12.15.1723109859313; Thu, 08 Aug 2024 02:37:39 -0700 (PDT) Received: from [192.168.188.25] ([80.243.52.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bbb2d34a74sm467947a12.69.2024.08.08.02.37.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Aug 2024 02:37:38 -0700 (PDT) Message-ID: Date: Thu, 8 Aug 2024 11:37:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] conf: Stop parsing options at first non-option argument To: Stefano Brivio , passt-dev@passt.top References: <20240808040251.2568850-1-sbrivio@redhat.com> From: Paul Holzinger In-Reply-To: <20240808040251.2568850-1-sbrivio@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: GZKBXIIGT3BMQ4QF52M4JPKQ3CQSTYOB X-Message-ID-Hash: GZKBXIIGT3BMQ4QF52M4JPKQ3CQSTYOB X-MailFrom: pholzing@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: David Gibson 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 08/08/2024 06:02, Stefano Brivio wrote: > Given that pasta supports specifying a command to be executed on the > command line, even without the usual -- separator as long as there's > no ambiguity, we shouldn't eat up options that are not meant for us. > > Paul reports, for instance, that with: > > pasta --config-net ip -6 route > > -6 is taken by pasta to mean --ipv6-only, and we execute 'ip route'. > That's because getopt_long(), by default, shuffles the argument list > to shift non-option arguments at the end. > > Avoid that by adding '+' at the beginning of 'optstring'. > > Reported-by: Paul Holzinger > Signed-off-by: Stefano Brivio > --- > v3: Use '+' in optstring and drop first non-option tracking > > v2: Instead of overriding 'name' in the getopt_long() loop, to force > exiting the loop, adjust the exit condition > > conf.c | 4 ++-- > util.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > I like this change but I like to point out that this is a breaking change for any user that sets options after the main argument, i.e. pid. I can tell you that this will not effect podman but I don't know what other users exists out there... I am not sure if it is worth the risk just to improve the UX for the command use case but I guess you already decided it is otherwise you would have not posted this patch. -- Paul Holzinger