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 A30C641B85; Mon, 30 Jan 2023 23:12:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4894340C35; Mon, 30 Jan 2023 23:12:52 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2063.outbound.protection.outlook.com [40.107.243.63]) by mails.dpdk.org (Postfix) with ESMTP id DE06840698 for ; Mon, 30 Jan 2023 23:12:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XrUc8KK+btCDH5Fn5OyjTQTCOERnomq+NcvmaVunVvQrVeRouN0eH4jefEVWUU5sLwdvx58kmoofRYFrgfhYEzn/o2znobHKisdHCtPt3FFXoWmRL8PKPCproslN8rooCVCwn3+RPARw++DdY6CQCgHHBf/Z+YpENv5pLdZ+7w3fpN+f1cFbs6tEovMy0BErwjjADGASDQPVUmk9GmlP1+S+NMnxbD7F4p8Bry+3x/11JCBYbZazYV2He76uBCrw4agNEUFpWy4Iwn3CXQZ5uGSONzos28JvyHPkaXRXKWtDVyFSOa16ac05xU+T6dHzmtzyud9LpyrMxaOzLa0joA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QRGozTrzOqMaDLm+zNZh4Uq3zA5NUt4Dhah3vVeFm14=; b=ikQQ/kDe3+H3FY0t5R3z8XgesN1C9JKLoVtnCiYBrJq3DnmbHwTuq58AyEIc+VP27jfgAOVMHTbrAWRxwOxEDYoecfk3XmJ+ZfEsNTNsouhsdlHFuPleQ2ennl8HSyg6tjic9bM2zx4ldbv+plLPKYBbHwYLmAtc6G4f7FdUiZz2LbNpW3tRtPJcxpj3tnn3+yNgRegr9d5/wAEqq5LSIXuDj2Voa+rF29c8DyYV/wXMx+L1YTyP4UyxcEGUgT2L8K94ISuEppp2sBI9BdN1F2LwAtmNnLjm0GSwkPdVizhE5HeWp/Ceenkfu7xbl4N8eQpcWZtZvbHUUhTpieeKow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QRGozTrzOqMaDLm+zNZh4Uq3zA5NUt4Dhah3vVeFm14=; b=NT0j3Q2cnOEPX1MPEbZH9l7O4HKbRXJF5lcPm3UY3iIuZFktHizFl37ij3iK0NY3reMFop06gbb0rV2NiNPzxLN/RT83m89wvk+5d2ZBAqZ6j+AzUG0K5oPS/PKh366MNnxvzduyJ2A3AWCMe5/ggEcoY2vzwUjW7UnL2CAXJiY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BL1PR12MB5970.namprd12.prod.outlook.com (2603:10b6:208:399::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.36; Mon, 30 Jan 2023 22:12:49 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::4807:1f44:5e04:e05a%8]) with mapi id 15.20.6043.036; Mon, 30 Jan 2023 22:12:48 +0000 Message-ID: Date: Mon, 30 Jan 2023 22:12:42 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Content-Language: en-US To: Stephen Hemminger , dev@dpdk.org References: <20221014172328.185219-1-stephen@networkplumber.org> <20230130200914.22049-1-stephen@networkplumber.org> <20230130200914.22049-2-stephen@networkplumber.org> From: Ferruh Yigit Cc: Olivier Matz Subject: Re: [PATCH v10 1/2] cmdline: handle EOF in cmdline_poll In-Reply-To: <20230130200914.22049-2-stephen@networkplumber.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO6P123CA0026.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:313::17) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BL1PR12MB5970:EE_ X-MS-Office365-Filtering-Correlation-Id: eaa1d26a-0bd9-44f6-763c-08db030f1f1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qWWMMuu2nzxgQxXAj5SmEKqm22N7oDHPsE2rwzgvInAQtxr/bHY6LltcharRWkyK2l9TcEGBMnopdsU3a0JfE+7nM87qhNA75QbvAGn/K3CSaqG4A7sPMJ+67Ozz2Fudh11hzwje8fH3KsJQDBPyQAISAdzk9o0deIWGiZ+USg+TFVJuHvMe7Voza+OjoXExAN8Be3/pTGj3R0lGr+o1Jr+zm9qlVQo85smrfm4xKLMOvlWLqH6upC3CE6htmYGWtf5aVFrCJB9ISvZg6GAjwmhFG/QyA17UckKUEEGH5a+NSSEvDYlFurnZUuZqUKjtDTRZIC6brZeclvwAa8bBSq8rAcHpQXRLnXt4QKTdhuFs0a1y57Laf2sfMk0PgGwWIvzCsQ9v7zO2a1r9qhPMf7h8vDnATtFHZZ6Upe7SWJSXDfoje9tWf0Z3IbNlsFZu4pFEgF9godnsCPNC4OC12ZD19y4b1OphrmU8MdaVDTvC9VnPOJxxB2aQpWJuzUg8l9U0+zY2kO+tXOohzqhr7cMTr4cFNNewxck8YROpYYjx2Lw6bHMiIOcvjd8TdAv4THUyhtWTzrWp2qRd/qUzSn59yy8tG+WdZPDTMrpq/53dy7I3popkgy5Ikexu3KJCUezyijA+zvytX6pOnhTDAOWhwAOJEH/PDYMZ+zkhbu/qw5joJDD6u+rhPBYzF82X1KFwt2Xl/ZXhF3AxYgZSzvR+LfwPPLP4hJgQalwc8RE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(451199018)(31686004)(36756003)(83380400001)(26005)(186003)(6512007)(316002)(2906002)(44832011)(38100700002)(478600001)(66556008)(66946007)(66476007)(8676002)(31696002)(86362001)(53546011)(2616005)(6506007)(6666004)(41300700001)(4326008)(6486002)(5660300002)(8936002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VGhkaThSYlVUcVpmVlFTQUVIR0YzemhROFBCcWFoN2Rob1BZOTEvV1JQTk5N?= =?utf-8?B?LzhvSVpLOTBCNHd1WHZ0YjQ5WDFjVjRuM2orbkpoeExWbFdYY2ZxRHFmSnNw?= =?utf-8?B?ckNBNUZkYU9ySnRMS0k3U2UzbTVKQTVQa0hxOG5KZGVHbjlzMThwOWprbm1j?= =?utf-8?B?R1VpWWNoQWZUQm0yb24xUXo3VVFvczkwaVluNEkrMlZuaHNBdnUyRC92SFZi?= =?utf-8?B?WkoweWJaQThtT2dEUHUyZkNSb2x4d0pJcmJTY3FCV3hvRFY2N2FGamNFdlVP?= =?utf-8?B?ZTNOVHdFUGYvR0p2Um9lenk2b2VGdEVCckJ1eThNK21zV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nbUmwzUKkO4nXBVW6V1+qVUH?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaa1d26a-0bd9-44f6-763c-08db030f1f1d X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 22:12:48.8379 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6rgKp29yUp+SYWof7GjlRV2BSlOT+FfkampFr6hgAx3xJGfczRNXwa97fnIy7WQ/ X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5970 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 On 1/30/2023 8:09 PM, Stephen Hemminger wrote: > If end of file is reached on input, then cmdline_read_char() > will return 0. The problem is that cmdline_poll() was not checking > for this and would continue and not return the status. > > Fixes: 9251cd97a6be ("cmdline: add internal wrappers for character input") > Signed-off-by: Stephen Hemminger > --- > lib/cmdline/cmdline.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c > index e1009ba4c413..de41406d61e0 100644 > --- a/lib/cmdline/cmdline.c > +++ b/lib/cmdline/cmdline.c > @@ -194,7 +194,7 @@ cmdline_poll(struct cmdline *cl) > else if (status > 0) { > c = -1; > read_status = cmdline_read_char(cl, &c); > - if (read_status < 0) > + if (read_status <= 0) > return read_status; According API doc it will be wrong to return '0', which imply 'RDLINE_INIT'. But function may return any negative value on error, what about to get eof as and error case: if (read_status < 0) return read_status; else if (read_status == 0) return -EIO; With this 'cmdline_poll()' can be used in testpmd as it is used in v9 of this patch: while (f_quit == 0 && cl_quit == 0) { if (cmdline_poll(cl) < 0) break; } But still I guess this is an ABI break because of API behavior change.