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 A54F6C433EF for ; Sun, 6 Feb 2022 18:23:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7EFEC83BB2; Sun, 6 Feb 2022 19:23:41 +0100 (CET) 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="nDvFmcKJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B70B983BBB; Sun, 6 Feb 2022 19:23:39 +0100 (CET) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 ED1B483BB2 for ; Sun, 6 Feb 2022 19:23:36 +0100 (CET) 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-wr1-x435.google.com Received: by mail-wr1-x435.google.com with SMTP id h6so2399283wrb.9 for ; Sun, 06 Feb 2022 10:23:36 -0800 (PST) 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=3NeKZ0Kz6eAFC9RaRHbGHdMMMs8E4s0ASfmUAxc2cPo=; b=nDvFmcKJgRvfzZa2RLqrlvK3OGrtnQoIO1VrmloxtuIZ5sDnpG7BWtWsQ8dvLWGXu/ KaDXgweTwP3ApMLCbl9hCoZ2o27hqhyPYmObKyYI+aH4KdOqJbM+8JYeGTkOI+OZUviy OwsTdjql8QnGfCfM2otrJAjl7gHlfct4lUlFI= 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=3NeKZ0Kz6eAFC9RaRHbGHdMMMs8E4s0ASfmUAxc2cPo=; b=AolvBvfpYakyU/qKieQi+w00Qk7aNVEFrd8pQwVVcpVMxGpYVUPtf2wYQEfVeKs29E iFAh/IJQLQD5MjQoN06+9xj5rFKA66olRV7xhjU++MteklD++OyzQQ4k4RCaw1ITm7Kb agKcISOs71Yfne0H4gQ8CaYUMVb0pynfWZa6SE+QF0J+rZYa5ykcUoZgPgHAuFQOsDQG xbwaF3XT97aOKjHZ8+SI7uJoRt45521lfdiYETtOsWyq9KtXJ2/5PVHwoGOTJFodAxyy lBOCcO6jNHVsLb/2HSKUtq8YBXPUCK0kP2g3AR0c42ikC7I0JmnBRDk/EAYbKJgmhxSo bFzQ== X-Gm-Message-State: AOAM533QTZSmGpl4c04Mz+Bkzjok3PFubGinZwGIs2Kg+M1HTNIP5c9T XLHPNf3VGBraxbI7dSvOYD5HgQ== X-Google-Smtp-Source: ABdhPJyDxFJa6yJebp+w6l3PcM5P9nDUODF2GJEWkpmC57ZX9Wkh3eG0xnS1mjMOgSO7dWpJOnxOyw== X-Received: by 2002:adf:ee46:: with SMTP id w6mr762560wro.451.1644171816632; Sun, 06 Feb 2022 10:23:36 -0800 (PST) Received: from pwmachine.localnet ([2a01:cb14:983:1f00:e5b3:218b:cb92:2549]) by smtp.gmail.com with ESMTPSA id c14sm8252350wri.56.2022.02.06.10.23.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 10:23:36 -0800 (PST) From: Francis Laniel To: Simon Glass Cc: U-Boot Mailing List , Marek Behun , Michael Nazzareno Trimarchi , Wolfgang Denk , Harald Seiler Subject: Re: [RFC PATCH v1 17/21] cli: hush_2021: Enable using \< and \> as string compare operators. Date: Sun, 06 Feb 2022 19:23:35 +0100 Message-ID: <2817356.e9J7NaK4W3@pwmachine> In-Reply-To: References: <20211231161327.24918-1-francis.laniel@amarulasolutions.com> <20211231161327.24918-18-francis.laniel@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" 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 Le mercredi 12 janvier 2022, 21:03:40 CET Simon Glass a =E9crit : > Hi Francis, >=20 > On Fri, 31 Dec 2021 at 09:14, Francis Laniel >=20 > wrote: > > In Busybox hush, '<' and '>' are used as redirection operators. > > For example, cat foo > bar will write content of file foo inside file b= ar. > > In U-Boot, we do not have file system, so we can hardly redirect command > > output inside a file. > >=20 > > But, in actual U-Boot hush, these operators ('<' and '>') are used as > > string compare operators. > > For example, test aaa < bbb returns 0 as aaa is before bbb in the > > dictionary. Busybox hush also permits this, but operators need to be > > escaped ('\<' and '\>'), so we stick here to this behavior. > > Also, if escaping is needed it permits the developer to think about its > > code, as in a lot of case, we want to compare integers (using '-lt' or > > '-gt') rather than strings. > >=20 > > Signed-off-by: Francis Laniel > > --- > >=20 > > common/cli_hush_2021_upstream.c | 28 +++++++++++++++++++++++++++- > > 1 file changed, 27 insertions(+), 1 deletion(-) >=20 > Reviewed-by: Simon Glass >=20 > We should add a file interface to U-Boot. Is that the only impediment > to implementing redirection? I thought the problem was lack of fork() > ? =46rom my understanding of Busybox hush code dealing with I/O redirection=20 (mainly parse_redirect() and struct redir_struct), it seems fork is never u= sed=20 here. So, if we add something to emulate file descriptor it should be OK to add t= his=20 feature to U-Boot. > Regards, > Simon