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,URIBL_BLOCKED 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 15BB3C4338F for ; Fri, 20 Aug 2021 16:12:36 +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 EEFF561131 for ; Fri, 20 Aug 2021 16:12:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EEFF561131 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 931F982D50; Fri, 20 Aug 2021 18:12:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="iEZ1hor/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9723582DB3; Fri, 20 Aug 2021 18:12:30 +0200 (CEST) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0545182C0A for ; Fri, 20 Aug 2021 18:12:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=none smtp.helo=mail-wm1-x32f.google.com Received: by mail-wm1-x32f.google.com with SMTP id k5-20020a05600c1c85b02902e699a4d20cso6422321wms.2 for ; Fri, 20 Aug 2021 09:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UqUAc9i2LVKJbgooA7uoOSzEiMGTbrqu2WR4beuVL7A=; b=iEZ1hor/mkQqJOIv2bAR66eUPMOLoKRoxiOqCBM0SR50EIxw8dfkoDH5hBxFuMltUq xPyFa3kCsWrHpdtKesul9m0EeLa7DDB9xpTKY8dMtAjqGFwtVyh7zCe6OuqzBcE3ZYPo VdBY7RPkPcO/xX8I7jVtvvErsNgZ9XCNQZvOE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=UqUAc9i2LVKJbgooA7uoOSzEiMGTbrqu2WR4beuVL7A=; b=Azgbaqtxz2+rUtVpA853j2IzYEMIv5pNmn5owG1mKWfiBFXStHdvz9tv18k1fzIUDV Oox/bPfqmD9amvKNf48s+9wWCS5MNCUFSHjszUQ3CK+rFOdx1nI0jg8uSTmESESQsGgC HZGeRnmUnxRQrtRC3sHqW5yU2yby00VHKu8S82/XluHYsiH6F671Lp8LqlRuGdAFS9Yd JW5CYxBBsu0klf+zvw+5JKmDaqoPyiw4o10rASfesD5hvzes/FSPrwYQGjj1SiV6e1uE mY5hZwAPVCqOo45bhI3ES0qFvwFEXV06S8nfIjVM/9B12u3fRYx/4HcuLgC+vGn2fPhv wJkA== X-Gm-Message-State: AOAM533Y24xWf852sQ5voVZirMJ504IPL5d0IxghZ4DYzRw14UuPj281 hghzwKlxhTCgxwKlWmk+r8oXmr8TJ3IPvg== X-Google-Smtp-Source: ABdhPJzWDtyNEvIg14Qfyx+6Q4Cp6ftPTTAmkQpTFpbyXz7NeoQyR2t4lrtfb7CLJvchVCvTGk3akA== X-Received: by 2002:a05:600c:1d06:: with SMTP id l6mr4745812wms.18.1629475945611; Fri, 20 Aug 2021 09:12:25 -0700 (PDT) Received: from pwmachine.localnet ([2a01:cb14:983:1f00:4e0c:e96d:5c36:fa68]) by smtp.gmail.com with ESMTPSA id z137sm11090263wmc.14.2021.08.20.09.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Aug 2021 09:12:24 -0700 (PDT) From: Francis Laniel To: u-boot@lists.denx.de Cc: michael@amarulasolutions.com, Marek =?ISO-8859-1?Q?Beh=FAn?= , Simon Glass , Wolfgang Denk , hws@denx.de Subject: How should we deal with actual hush odd behavior? Date: Fri, 20 Aug 2021 18:12:23 +0200 Message-ID: <2787647.e9J7NaK4W3@pwmachine> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 Hi. I hope you are fine and the same for your family and friends. In July, a proposal to add a new shell for U-Boot was posted on the mailing list [1]. The community discussed a lot about this changes, some people did not agree with it because the new shell is not compatible with the actual one (hush) [2]. So, a proposal to update U-Boot actual hush to follow what they currently have in Busybox was made [3]. Porting 2021 Busybox hush to U-Boot seems, for me, to be a good idea as we would benefit from Busybox bug fixes as well as being compatible with actual hush (in theory). We could also add new features to U-Boot hush, like functions, as they were added to Busybox. Nonetheless, the idea of this port is to be compatible. In practice, I noted some cases when this is actually not the case. The first one can be related to how && and || operators were handled in hush. So, the following: false && false || true Returns 0 on Busybox 2021 hush and 1 on U-Boot. The behavior of 2021 is coherent with the definition of these operators [4]: > The return status of AND and OR lists is the exit > status of the last command executed in the list. An other example concerns variable expansion, where foo='bar "quux" is expanded to bar quux in U-Boot and bar "quux in Busybox. I do not have a real opinion on the second one, as I think local variable set in U-Boot scripts are quite simple as people do not try to do: foo="bar \"quux 'quuz' \"\"\"corge". The first one is maybe more problematic. Grepping "if test" shows me that the more complex if condition seems to be under the form: if first_test_ AND/OR second_test Here also, people seems to no try to write complex expression like: foo || bar; echo quux && quuz. So, porting Busybox 2021 hush can solve bugs we have currently in U-Boot, but what if fixing these bugs lead to a board script failing and so a device not booting... I would like to have the opinion of the community on this question. Best regards. --- [1] https://lists.denx.de/pipermail/u-boot/2021-July/453347.html [2] https://lists.denx.de/pipermail/u-boot/2021-July/453790.html [3] https://lists.denx.de/pipermail/u-boot/2021-July/453848.html [4] https://linux.die.net/man/1/bash