Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5989968ybc; Wed, 27 Nov 2019 13:01:11 -0800 (PST) X-Google-Smtp-Source: APXvYqzsJ2Foi7YLAVsm7h9HX5iDU5QGfF+fImjznPCoafeTLbZzlb5UARs1hZh8VAoF8COtvKP3 X-Received: by 2002:a05:6402:6c7:: with SMTP id n7mr30726929edy.177.1574888471664; Wed, 27 Nov 2019 13:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888471; cv=none; d=google.com; s=arc-20160816; b=QG4Oddz0n5mRWuvs/DPsMR8Zlb5LghteVFai+RJ3h/kwQyYCkGyEYtB/5SG0AvVbLA t9q/pPJ2b7AbQMOF5rG9SRYyGjRzHTqSVmAbQhHt2Lze3F+G2taUYN27B9yxLYjkmutw GSFuw3wjKMM2sLuZhg7Uh78rY0JUPQsO34etx8wklF7zB5qB4x5xkGKKHrBu64uOYBJe FF15kOMY4yuwaZQZsaKIKzstClbo8PtlB081MQ6TqiRDe2S1xHCpDaRbJ8/k1Xbk/MOz FP2w/jfg7SKA82RGx0tZrNmn7aVlZMFmYGv6fyDzOH/2k2W5LUrt/YFgI4vyC8sqCfVQ Nb5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IXfyNEGFjeY3/LtfuzYSanFspurbHvK3aPnp+aotPVo=; b=p+FZcW+4nztycnpvzh000KWVnddK/y2BhCXHcaXt2CHQKBxkqLQ4ixhljQcB4KXzZa C+ovKOZtqieuCtCa15PVNRC7d6heySk/eZdkqiZ4VVf96lHzuqwfLz3lYHK3RdYkuKO7 jyuNdnFHDcTNZ9W7vM7A/LZa/5AD16Bolf7lgU01mFiWqavZj77oMF4fyV6oMFc7LZwO 6O56XdoaP7TfHfJfMnPKWza5Fulr5kghbSKK8yxjJzlFNKDcAnF2tEflYyKlhv6b+px/ XNn1LaAhTx6Krh7hduwLkhFKPFzvW/wwSoYrzE3J8fTL0XFLynTfLSyiKE6yu1J1x1fk n9rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jTSaPZlC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si4112109ejc.263.2019.11.27.13.00.48; Wed, 27 Nov 2019 13:01:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jTSaPZlC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731491AbfK0U74 (ORCPT + 99 others); Wed, 27 Nov 2019 15:59:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:51522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731463AbfK0U7w (ORCPT ); Wed, 27 Nov 2019 15:59:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F6C120678; Wed, 27 Nov 2019 20:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888391; bh=Y18yuxI31zdXm3BrZcwrM5f7T94WmOvlXVgoXwJyH2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTSaPZlCvsAnBRM8s4RwmiFNU7fHEVQwOeiLXE1hfC0xHT/jlT3pJlKquDSYLbrTf 5PH/LehrmvEeyGRAlFV7LaJ2mAHdj414TSt9HlcSdyJ5Ty/vM0czCwAv/ZMGrusLjN 7lzTS+yCcwyXe4WfJElCMx77keeNVf6gvcFmEEwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Monnet , Jakub Kicinski , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.19 116/306] tools: bpftool: fix completion for "bpftool map update" Date: Wed, 27 Nov 2019 21:29:26 +0100 Message-Id: <20191127203123.650790329@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quentin Monnet [ Upstream commit fe8ecccc10b3adc071de05ca7af728ca1a4ac9aa ] When trying to complete "bpftool map update" commands, the call to printf would print an error message that would show on the command line if no map is found to complete the command line. Fix it by making sure we have map ids to complete the line with, before we try to print something. Signed-off-by: Quentin Monnet Reviewed-by: Jakub Kicinski Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- tools/bpf/bpftool/bash-completion/bpftool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index 598066c401912..c2b6b2176f3b7 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool @@ -143,7 +143,7 @@ _bpftool_map_update_map_type() local type type=$(bpftool -jp map show $keyword $ref | \ command sed -n 's/.*"type": "\(.*\)",$/\1/p') - printf $type + [[ -n $type ]] && printf $type } _bpftool_map_update_get_id() -- 2.20.1