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 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 B2540C43334 for ; Thu, 16 Jun 2022 22:37:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D308844F1; Fri, 17 Jun 2022 00:34:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (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="nNFxNeRO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D13A5844EC; Fri, 17 Jun 2022 00:34:17 +0200 (CEST) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (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 4CD0584451 for ; Fri, 17 Jun 2022 00:33:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=francis.laniel@amarulasolutions.com Received: by mail-wr1-x429.google.com with SMTP id c21so3566728wrb.1 for ; Thu, 16 Jun 2022 15:33:23 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZdPrTwIpuOH4oElUF1JGOvB6ef650+182eEsh5rU+XU=; b=nNFxNeRON82f5V1iorWJvj8PSDMob102FoidcFjr/plZM0g17ICCWiEmqTaBwdbzSz 8b0Z3DJG4Fb9nnILhW6utQA01gXXPTjSVvnS8jUhJyqfgaTO/U5XxpVZVaB4H2uewiWU jqALWhK4KARIRprRPiPh+e4kxo+j9AtdWJl8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZdPrTwIpuOH4oElUF1JGOvB6ef650+182eEsh5rU+XU=; b=TEiZB1tCcwRoc9+DOB2VGf/uwnkF4jQgIUCmQr8jL3HBh9LcbiLaTb2LD7v4jSC+P4 Lp1w5zMzRl0Ia4eDtLVOLWwZFeMyEcDS0zE4JQIKq4tmrI3J42JK8CJe2N9bGYglFU0b IzgyOIW8dZqiNwGU79j/y+H64wy+uDfDKZOhy2f1jOGhzwQWuLapUSCAY9wLWK0yHhwY O5Hsqiy7C0FVVYfTXYMpd+PEoQEVO487YTBLHfQic7ioJAVFpexKNBaZL+5p3+MGQAMP 25wCFzVcuDUPplnzr4jwM0i10MbBt7MddAfFK1vr5E60kIVSpY3MTcyjFD8G379IAw3y l58Q== X-Gm-Message-State: AJIora/GIvEJbpGEVkwQkRTMh6X4ooauIqqUvEW+7VgbIfGsLHYK/F/J 6RXnRcBkWUv2E57cCDnlih4kVYqWY+Nydw== X-Google-Smtp-Source: AGRyM1tkHvLUvr/aft7GhoyZ7yagvBGBFKW2loxRAay/B1MM91xogTWaXD0XGI5MiUAbfbNaOcaOGA== X-Received: by 2002:adf:e2cb:0:b0:20c:c1bb:9fcb with SMTP id d11-20020adfe2cb000000b0020cc1bb9fcbmr6569213wrj.35.1655418803046; Thu, 16 Jun 2022 15:33:23 -0700 (PDT) Received: from pwmachine.home (17.pool80-103-97.dynamic.orange.es. [80.103.97.17]) by smtp.gmail.com with ESMTPSA id n4-20020a05600c4f8400b003971fc23185sm7912044wmq.20.2022.06.16.15.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 15:33:22 -0700 (PDT) From: Francis Laniel To: u-boot@lists.denx.de Cc: Marek Behun , Michael Nazzareno Trimarchi , Simon Glass , Wolfgang Denk , Harald Seiler , Tom Rini , Francis Laniel Subject: [RFC PATCH v4 24/28] Modernize U-Boot shell Date: Fri, 17 Jun 2022 00:31:54 +0200 Message-Id: <20220616223158.9225-25-francis.laniel@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220616223158.9225-1-francis.laniel@amarulasolutions.com> References: <20220616223158.9225-1-francis.laniel@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Tom Rini On Fri, Apr 01, 2022 at 01:26:53AM +0200, Francis Laniel wrote: > Hi. > > First I hope you are fine and the same for your relatives. > I would also like to apologize for the delay between v2 and v3. > > During 2021 summer, Sean Anderson wrote a contribution to add a new shell, based > on LIL, to U-Boot [1][2]. > While one of the goals of this contribution was to address the fact actual > U-Boot shell, which is based on Busybox hush, is old there was a discussion > about adding a new shell versus updating the actual one [3][4]. > > So, in this series, with Harald Seiler, we updated the actual U-Boot shell to > reflect what is currently in Busybox source code. > Basically, this contribution is about taking a snapshot of Busybox shell/hush.c > file (as it exists in commit 37460f5da) and adapt it to suit U-Boot needs. In order to put this through CI and my local testing loop as well, I need: commit 0eae144ef84e7190b3c2da5fbd745468f7d1f7e6 Author: Tom Rini Date: Wed Apr 20 15:28:10 2022 -0400 HACK: Make new HUSH default Signed-off-by: Tom Rini Signed-off-by: Francis Laniel --- cmd/Kconfig | 2 +- common/cli_hush_upstream.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index ce19ad2080..32672d52ef 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -28,7 +28,6 @@ menu "Hush flavor to use" config HUSH_OLD_PARSER bool "Use hush old parser" - default y help This option enables the old flavor of hush based on hush Busybox from 2005. @@ -37,6 +36,7 @@ menu "Hush flavor to use" config HUSH_2021_PARSER bool "Use hush 2021 parser" + default y help This option enables the new flavor of hush based on hush Busybox from 2021. diff --git a/common/cli_hush_upstream.c b/common/cli_hush_upstream.c index 7b8712c981..9127183ed7 100644 --- a/common/cli_hush_upstream.c +++ b/common/cli_hush_upstream.c @@ -1454,6 +1454,7 @@ static void xxfree(void *ptr) * HUSH_DEBUG >= 2 prints line number in this file where it was detected. */ #if HUSH_DEBUG < 2 +#include # define msg_and_die_if_script(lineno, ...) msg_and_die_if_script(__VA_ARGS__) # define syntax_error(lineno, msg) syntax_error(msg) # define syntax_error_at(lineno, msg) syntax_error_at(msg) @@ -1471,7 +1472,7 @@ static void die_if_script(void) } } -static void msg_and_die_if_script(unsigned lineno, const char *fmt, ...) +static void __maybe_unused msg_and_die_if_script(unsigned lineno, const char *fmt, ...) { va_list p; @@ -1545,7 +1546,7 @@ static void syntax_error_unexpected_ch(unsigned lineno UNUSED_PARAM, int ch) /* Replace each \x with x in place, return ptr past NUL. */ static char *unbackslash(char *src) { - char *dst = src = strchrnul(src, '\\'); + char *dst = src = (char *)strchrnul(src, '\\'); while (1) { if (*src == '\\') { src++; -- 2.25.1