From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F14C11F66 for ; Tue, 29 Jun 2021 08:44:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1D3DB61DC8 for ; Tue, 29 Jun 2021 08:44:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D3DB61DC8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 268CB8313D; Tue, 29 Jun 2021 10:44:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624956293; bh=eN0FHZ++Mm9uGydGircMhixNcHTNqi+t+yynzoW9+1g=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pMakJKP2ARILuwkFckzuOmt/+ufflx/7bzNCwtFN5AWCTC4BdBmomhbVPbl9nDolN ldFDql+phfsVTm52gGSAW4SWhH/zd7ZUquekfmWPTNK+N9ws8hI4CJ90i73SyoDuyZ igIhHTI/pLduOz930sVGn7IfTtIqC6Ny3QAkgnAiDdkYF0mpW6jYHyhYp25Wk6cyWA 14yOU5ytW3aFPX2qbqHARFeBt/pNVaBls5y833hxF59ebDinOL/zxux8shmRDKFpvE v/0UKBgjdH0txROV+OWZmOF6/6p8WpB10Dz1LeFO0SN1z3bjM3ue17ID8YkvWYwnL3 qcV7sff4qyFrg== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B8CB183133 for ; Tue, 29 Jun 2021 10:44:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1624956291; bh=eN0FHZ++Mm9uGydGircMhixNcHTNqi+t+yynzoW9+1g=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=yptWpXO9IV98qnznPl84zuynwkIlvSsc+6LpmXKcQgh76qle96VZaCA/+M+Cgif0l /246arsh8Ae/97pJhXEox+eOWFzwjQUH7CM+ph5ucaIFkKcKdLXRxodxTuX+ZoaJhT L59+S1ftcxdgO/odxNQETLVk1TGmCYiv8WayRQNCYx2GlfIVfRdUu0139+GQDehCpv +V/F8zvjKWzYW9oAZG6rY0Fmekx0icAgDjHHi+k4maMNEPviFGZgKSDaX8IInb6KFs CYGQSzmJvwL0iiMTEOGbTCuoaBFH5IE94SzWgcxzol1Tb4WLekA49mXKKcUzfAaC9U eBbyNYvZZ9G7Q== Received: by janitor.denx.de (Postfix, from userid 108) id 6D356A025F; Tue, 29 Jun 2021 10:44:51 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id CAAB5A0165; Tue, 29 Jun 2021 10:44:45 +0200 (CEST) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 8D8471E1DD2; Tue, 29 Jun 2021 10:44:45 +0200 (CEST) To: Rasmus Villemoes cc: Roland Gaudig , u-boot@lists.denx.de, Simon Glass , Roland Gaudig From: Wolfgang Denk Subject: Re: [PATCH 1/3] cmd: setexpr: add fmt format string operation MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <4c69688f-c187-ad14-5cfe-cdcddc71f5c8@prevas.dk> References: <20210628151750.572837-1-roland.gaudig-oss@weidmueller.com> <20210628151750.572837-2-roland.gaudig-oss@weidmueller.com> <4c69688f-c187-ad14-5cfe-cdcddc71f5c8@prevas.dk> Comments: In-reply-to Rasmus Villemoes message dated "Mon, 28 Jun 2021 19:39:30 +0200." Date: Tue, 29 Jun 2021 10:44:45 +0200 Message-ID: <84286.1624956285@gemini.denx.de> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Dear Rasmus, In message <4c69688f-c187-ad14-5cfe-cdcddc71f5c8@prevas.dk> you wrote: > > I think this allows a lone % to appear at the end of the string after > the actual %d, i.e. it seems "%d bla %" would be accepted. there are a lot of highly unintuitive restrictions in that code, indeed. > I think allowing "arbitrary" format strings, restricted to those > expected exactly one integer argument, is too fragile and error-prone. Indeed. See for example the "printf" (bash) shell builtin - we should have a similar flexibility here. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition. - Isaac Asimov