From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5AF70A00C2; Fri, 17 Jun 2022 04:36:15 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 656B742823; Fri, 17 Jun 2022 04:35:56 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id BB347410E7 for ; Fri, 17 Jun 2022 04:35:51 +0200 (CEST) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LPNNt0sMlzSgxn; Fri, 17 Jun 2022 10:32:30 +0800 (CST) Received: from localhost.localdomain (10.67.165.24) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 17 Jun 2022 10:35:37 +0800 From: Chengwen Feng To: , , CC: , , Subject: [PATCH v3 3/4] eal: fix trace init fail with long file-prefix Date: Fri, 17 Jun 2022 10:29:12 +0800 Message-ID: <20220617022913.47564-4-fengchengwen@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20220617022913.47564-1-fengchengwen@huawei.com> References: <20220607120014.49823-1-fengchengwen@huawei.com> <20220617022913.47564-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Bug scenario: 1. start testpmd: dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* \ --file-prefix=trace_autotest -- -i 2. then observed: EAL: eal_trace_init():93 failed to initialize trace \ [No space left on device] EAL: FATAL: Cannot init trace EAL: Cannot init trace EAL: Error - exiting with code: 1 The root cause it that the offset set wrong with long file-prefix and then lead the strftime return failed. Fixes: 321dd5f8fa62 ("trace: add internal init and fini interface") Cc: stable@dpdk.org Signed-off-by: Chengwen Feng Reviewed-by: David Marchand Acked-by: Jerin Jacob --- lib/eal/common/eal_common_trace_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_trace_utils.c b/lib/eal/common/eal_common_trace_utils.c index 09f97d3c34..2b55dbec65 100644 --- a/lib/eal/common/eal_common_trace_utils.c +++ b/lib/eal/common/eal_common_trace_utils.c @@ -104,7 +104,7 @@ trace_session_name_generate(char *trace_dir) rc = rte_strscpy(trace_dir, eal_get_hugefile_prefix(), TRACE_PREFIX_LEN); if (rc == -E2BIG) - rc = TRACE_PREFIX_LEN; + rc = TRACE_PREFIX_LEN - 1; trace_dir[rc++] = '-'; rc = strftime(trace_dir + rc, TRACE_DIR_STR_LEN - rc, -- 2.33.0