From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web09.2003.1575282045594578101 for ; Mon, 02 Dec 2019 02:20:45 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KaPG5SzJ; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575282044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fox2X9gimNtAzfC/wv6g2pFp28wuzQ/5AyL/q3sU5f8=; b=KaPG5SzJDffrKH8SQ04K2O7wELcY54DH3quXuO8UBwlfoUQoN+yi8S4ZOhM44+goA3mKiS LDxLbNsxqOZA9zh98iKV87njNyxE3aonaqCTyjaxYHwYZePLDxqz7dQ41291Vi8lxfrigH GaWSbi/JXhIX2up6pOZzHcXaeyKIJyk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-239-wr2KVwxtP7CSMJDX9JWtMQ-1; Mon, 02 Dec 2019 05:20:42 -0500 Received: by mail-wr1-f72.google.com with SMTP id v17so55673wrm.17 for ; Mon, 02 Dec 2019 02:20:42 -0800 (PST) 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=Fox2X9gimNtAzfC/wv6g2pFp28wuzQ/5AyL/q3sU5f8=; b=GkZYKSb0i1IvFP6CqblAm0h3UgV+d4QkWyT5CGJPKYpJ6VWNBGxaIQHdkPMS766Qsi f401eJqyWTOn2X+PhccwsSDbYjwq5J2nYQfHadOilNdvUDwC++B/owA3185qOcFBomBo zGkG+rqdB+6PaBA2TeeC8G2Bi9uZBTjPtfGxTle+bGXtOtBJLECHpNHpFS+A+sSPttJF VCT0YQ8K/walgdIIkq30KU0x3m64a4aQbsudj6IaY4MGTaemVNJVPBURDb+jDh9kZQxy iw26ZADVPB9jBCZc96kWtp9Nm6MqI9GJ38rCoHNsEq9d4dpF66m1vvQsqUzVHxKfGLOB 7z1g== X-Gm-Message-State: APjAAAUshSuawwtZ/T0K+xVodW0bArKwdj/cD4b9Gx07RoSB4YmD+fTh u3BzSZDFIMDw8xeiHGT0zCMhQO5yZm1FwvjyP9CZn5uTd3itFL6jmPzlK25bj1HP4lf0G3EO817 JdVIuD0jeZm1Wbg== X-Received: by 2002:adf:b746:: with SMTP id n6mr68109073wre.65.1575282041619; Mon, 02 Dec 2019 02:20:41 -0800 (PST) X-Google-Smtp-Source: APXvYqwHSFssnMhk45UUQMvFdN3BrAvTPqS6koKVS/Kes8mbUONGRJDN8JW5EAbuVQVOvZn9/N3yVg== X-Received: by 2002:adf:b746:: with SMTP id n6mr68109042wre.65.1575282041329; Mon, 02 Dec 2019 02:20:41 -0800 (PST) Return-Path: Received: from [192.168.1.35] (182.red-88-21-103.staticip.rima-tde.net. [88.21.103.182]) by smtp.gmail.com with ESMTPSA id i8sm16977317wro.47.2019.12.02.02.20.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Dec 2019 02:20:40 -0800 (PST) Subject: Re: [edk2-devel] [PATCH] ShellPkg/ShellProtocol: Return error code while fail parsing cmd-line To: devel@edk2.groups.io, zhichao.gao@intel.com Cc: Ray Ni , Linson Augustine References: <20191202005348.22208-1-zhichao.gao@intel.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <6f2965c6-862a-e043-420a-9dceb17e63f9@redhat.com> Date: Mon, 2 Dec 2019 11:20:39 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191202005348.22208-1-zhichao.gao@intel.com> X-MC-Unique: wr2KVwxtP7CSMJDX9JWtMQ-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 12/2/19 1:53 AM, Gao, Zhichao via Groups.Io wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2395 > > Errors happened in the arguments parsing is not a critical error. > And it would miss the error status code in the release version of shell. > So replace the ASSERT with returning error status code while fail > parsing command-line in UpdateArgcArgv. > > Cc: Ray Ni > Cc: Linson Augustine > Signed-off-by: Zhichao Gao > --- > ShellPkg/Application/Shell/ShellProtocol.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c > index 5e529b6568..f0362a42d8 100644 > --- a/ShellPkg/Application/Shell/ShellProtocol.c > +++ b/ShellPkg/Application/Shell/ShellProtocol.c > @@ -1497,7 +1497,10 @@ InternalShellExecuteDevicePath( > ShellParamsProtocol.StdOut = ShellInfoObject.NewShellParametersProtocol->StdOut; > ShellParamsProtocol.StdErr = ShellInfoObject.NewShellParametersProtocol->StdErr; > Status = UpdateArgcArgv(&ShellParamsProtocol, NewCmdLine, Efi_Application, NULL, NULL); > - ASSERT_EFI_ERROR(Status); > + if (EFI_ERROR (Status)) { UpdateArgcArgv() is documented to only return EFI_OUT_OF_RESOURCES as error, however it calls ParseCommandLineToArgs() which - also not documented - returns EFI_INVALID_PARAMETER. I suppose this is the "not critical" error this BZ is trying to catch. Should we force Status to EFI_INVALID_PARAMETER before returning, is it safer to return EFI_OUT_OF_RESOURCES if it ever occurs? Should we assert if Status is EFI_OUT_OF_RESOURCES? > + goto UnloadImage; > + } > + > // > // Replace Argv[0] with the full path of the binary we're executing: > // If the command line was "foo", the binary might be called "foo.efi". >