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=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 70C06C47082 for ; Sat, 29 May 2021 15:50:10 +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 1C24F611CE for ; Sat, 29 May 2021 15:50:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C24F611CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 28A0C81D10; Sat, 29 May 2021 17:50:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="Sm9moQNt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C142381DB3; Sat, 29 May 2021 17:50:03 +0200 (CEST) Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) (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 20A3B81CE7 for ; Sat, 29 May 2021 17:50:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=seanga2@gmail.com Received: by mail-qt1-x82c.google.com with SMTP id g8so4957304qtp.4 for ; Sat, 29 May 2021 08:50:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gN5hGe+SC1z/GbHZjZq4ANjHCqSn7mgJZe+duJ75fDU=; b=Sm9moQNtlkJ2dQWQxJ3v/KI/y/W33p4cJdOv2DAEBAedGRvyXXQ9XKsVfcLAm4HfW5 rvyeyzvMF+dKaRsrF6e6b80o4BEEmGREPmVjfiEndlAMs/pJejl23CmaQzabHWHs6Kns UbmNy3R6hGuaUXSkjYrgSH54yZ7ySXKZTOekWj4Pfvwpj97IkclrF7N3ZZO+/57LUbOP oPFqXuB93k2kS91401VILzHF4H8k/hvqa7KDNvRH6iV0Z8EuadzgJcPKTSA5/t4oOtFs wZLMOQm/MwrXc3D31Fmm5fjCcb+7V+/e/gSkuEt6sI7XFe0t6gWj7huHAvanscbCCzRL JOMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gN5hGe+SC1z/GbHZjZq4ANjHCqSn7mgJZe+duJ75fDU=; b=JXLMHEwoVn2ht+u4HqcdfyIr3B73msWFfHLdHYmcF//SUC4qjaT0r3Z8uk8E6wzU28 ZX4T3BJwcCnve0Myi8HxIhltdzCNWB5dkpxPc9dbulaSnJ8b1w1FDwoyGVXv0Vr0kOKE jswE11iHX44bKqDXY7cKhkg9Yp26c5YxURyGAJKG3BpODJqAL9+4uAz4mSaVJBk+hVoc 4Qsdvxp65GK7XAi2+5BOs/vRwr+HIqGZ2q7o1BfF3LNNG2uRNkOiKOO77NLwFDNsuwMS H9uEeZ5/48FIIvr/IpXJL3z7153pNFVOrQJvtaPbKYSkx8c4tvQYdpHoEgDxGnquazuf TOyA== X-Gm-Message-State: AOAM5339B7vXqnfSmvnGGh/+UM4vKzZ3Tpr/5zbrjqaThgYGuRRRte3p tKa4cfWbviQaeJYB32Ez7Mo= X-Google-Smtp-Source: ABdhPJwTg02nMlM0GFMEUhBdMvEcdAXgx7NPgwCNMAbmRlmCIk5c8myaxdnC/zdtVv6dsoP8U5lxsQ== X-Received: by 2002:a05:622a:170b:: with SMTP id h11mr8353264qtk.330.1622303398851; Sat, 29 May 2021 08:49:58 -0700 (PDT) Received: from [192.168.1.201] (pool-108-51-35-162.washdc.fios.verizon.net. [108.51.35.162]) by smtp.googlemail.com with ESMTPSA id f15sm5695057qkk.41.2021.05.29.08.49.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 May 2021 08:49:58 -0700 (PDT) Subject: Re: [PATCH] common: The do_repeat flag interferes with commands issued via run_command API To: Farhan Ali Cc: U-Boot Mailing List , Simon Glass , Rasmus Villemoes , "peng.wang@smartm.com" , Patrick Delaunay References: <20210527212404.38250-1-farhan.ali@broadcom.com> <24f61522-b53a-0d80-ed74-71ad8e68b75e@gmail.com> From: Sean Anderson Message-ID: Date: Sat, 29 May 2021 11:49:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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.102.4 at phobos.denx.de X-Virus-Status: Clean On 5/28/21 2:34 PM, Farhan Ali wrote: > Hi Sean, > > Thanks for taking a look. I will add the changes you requested. > However a test case might be difficult to add in the automated tests. > This problem only happens if there is an asynchronous event ( packet What do you mean by an "asynchronous event"? > received/Button pressed ) which triggers a run_command API call AND > when the user has entered some console commands which have enabled the > do_repeat flag. If the do_repeat flag is set AND the command issued > via the run_command API is a 'non-repeatable' command (e.g mmc write), > the command is ignored. Ok, so if I understand correctly, this occurs when someone uses a repeatable command which also calls run_command. Perhaps you can trigger this behavior with a python test? > > On Thu, May 27, 2021 at 4:24 PM Sean Anderson > wrote: > > > Re: [PATCH] common: The do_repeat flag interferes with commands issued via run_command API > > The tag here should be "hush: ..." The subject should be an action, > such as "Clear do_repeat flag after running commands". > > On 5/27/21 5:24 PM, Farhan Ali wrote: > > Must clear the do_repeat flag once it is consumed. > > What is "it" here? Please add a few more sentences describing why you > want to change this. For example, you could note that do_repeat is a > file-level variable which is used by get_user_input to signal when a > command should be repeated. Though, I wonder why we don't set the flags > in the first place... > > 'it' refers to the do_repeat flag. I found this wording confusing because the flag itself is not really "consumed", per se. Perhaps "used" is a better verb? > > > > > Signed-off-by: Farhan Ali > > > Cc: Simon Glass > > > Cc: Sean Anderson > > > Cc: Rasmus Villemoes > > > Cc: Farhan Ali > > > Cc: "peng.wang@smartm.com " > > > Cc: Patrick Delaunay > > > > > --- > > common/cli_hush.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/common/cli_hush.c b/common/cli_hush.c > > index 1467ff81b3..1c9adf5683 100644 > > --- a/common/cli_hush.c > > +++ b/common/cli_hush.c > > @@ -1559,6 +1559,11 @@ static int run_pipe_real(struct pipe *pi) > > # endif > > #endif /* __U_BOOT__ */ > > > > + /* Clear do_repeat after consumption, avoids conflicts > > Multi-line comments should start with a blank line. > > > + * with cmds issued via run_command API > > + */ > > + do_repeat = 0; > > + > > Can you add a test case for this? > > So a use case could be as follows: > (1) User issues several repeated commands on console. This sets do_repeat flag internally > (2) Webserver embedded in main polling loop of uboot detects an image upgrade request > (3) Image downloads, about to be written via run_command("mmc write etc.") > (4) Since 'mmc write' is a non-repeatable command, issuing it with do_repeat flag set results in command getting ignored > (5) Image upgrade fails > > --Sean > > > nextin = 0; > > #ifndef __U_BOOT__ > > pi->pgrp = -1; > > > > > > Regards, > > Farhan