Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 68D78C433EF for ; Mon, 7 Mar 2022 17:41:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AE1FB81E0C; Mon, 7 Mar 2022 18:41:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="JHOPMb/o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0607C81FBB; Mon, 7 Mar 2022 18:41:53 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AEB0881DD0 for ; Mon, 7 Mar 2022 18:41:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 209B061205; Mon, 7 Mar 2022 17:41:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62FF7C340EB; Mon, 7 Mar 2022 17:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646674907; bh=CI0QKX+EMlmqYGeQljvctKUsC6yQvN37Fuia1nmVOCU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JHOPMb/oqxjoXvhsr81EHPut2BgxRf+PaoZ5GeLfd/z9UVcEykKOetQqDxOXoR2Fi 0A9sOBo9O7aafpWKAmTc6J7JnwdT1oBpP9ZvfgqNbVqqO+nor8Lm5/5jM5VK74SQ36 /vxrRXEyTZmZs/MVXaK7Mv/kkB9abzx7bG+oBrMtr4yTQPWVGoG9xVhXRVA5kEq+Rd XSLMfH/KyrE8jg8MUupk9tlrSjh3/fGjDU1sCp8DP+mGvCS9wMH91uBeMoKrS/Rmz4 G6Rh1lahdSi1MGWflJjydkr4kZpGuMlhuynsUOASUfCTRjd4NXNJAKBtd56Zg3xJ39 5VipFxMybcg9A== Received: by pali.im (Postfix) id 5FF09133E; Mon, 7 Mar 2022 18:41:44 +0100 (CET) Date: Mon, 7 Mar 2022 18:41:44 +0100 From: Pali =?utf-8?B?Um9ow6Fy?= To: Marek =?utf-8?B?QmVow7pu?= Cc: Stefan Roese , Tony Dinh , U-Boot Mailing List Subject: Re: kwboot - positional tty argument Message-ID: <20220307174144.jj2sysmjnkprvkci@pali> References: <20220306123907.24798-1-pali@kernel.org> <20220307114047.ni4dahqwaxch7xoj@pali> <20220307174553.1a40c122@dellmb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220307174553.1a40c122@dellmb> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Monday 07 March 2022 17:45:53 Marek Behún wrote: > On Mon, 7 Mar 2022 15:39:33 +0100 > Stefan Roese wrote: > > > On 3/7/22 12:40, Pali Rohár wrote: > > > Hello! > > > > > > On Sunday 06 March 2022 14:38:57 Tony Dinh wrote: > > >> Hi Pali, > > >> > > >> I have an observation, which is not related to this patch. But about > > >> the kwboot options changes in general, I hope it is OK to mention it > > >> here. > > >> > > >> Before the changes you've made to solve the problem with the -b > > >> option, I can do this: > > >> > > >> kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.kwb > > > > > > Interesting... I did not know that this kind of setup worked. It was not > > > documented neither in usage nor in manpage. Normally in applications and > > > scripts, all option arguments are before non-option (positional) > > > argument. > > > > > >> But now, the -b option can not be used after the tty device name. All > > >> options must appear before the tty device. > > >> > > >> Is this the actual intention? it did break some of my existing > > >> aliases/scripts (It is not a big deal to retrofit them). Just want to > > >> make sure I understand the reason to make the tty device a positional > > >> argument for kwboot. > > >> > > >> Thanks, > > >> Tony > > > > > > Marek, Stefan, do you want to support above (old) handling of positional > > > tty device argument to be present in the middle of option arguments? > > > > I personally don't... > > > > > I think I can develop some "hack" patch for argv[] processing to support > > > this operation. But my question is, if this is something which we want > > > to officially support. Because if not, it is better to have separate > > > option arguments and positional arguments like in any other application. > > > > ... > > > > The only case I can think of, is scripts that use the "incorrect" format > > and might fail now. I don't have any such scripts and I would not object > > to breaking this backward compatibility. Tony, what's your thinking on > > this? Marek? > > I don't care. I only care whether I can use the -t flag after > everything else, and I think this still works. > > Marek I figure out that mixing of positional arguments and options is by default supported by getopt API and seems that it is used (in other applications). Anyway, it looks like that other usage of kwboot is broken too, so I will send a patch which fix processing -b option with optional argument again, including mixing of positional arguments and options, like it was in older kwboot version.