Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755314AbeAHKRX (ORCPT + 1 other); Mon, 8 Jan 2018 05:17:23 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35686 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751865AbeAHKRW (ORCPT ); Mon, 8 Jan 2018 05:17:22 -0500 X-Google-Smtp-Source: ACJfBovQQ/S6VN9bg39af0z+Rnr+YlVMajZrqlkSiazlsWtNWkD986Bz2FOFeJu1UVghR8xFHyABIA== From: Lukas Bulwahn X-Google-Original-From: Lukas Bulwahn Date: Mon, 8 Jan 2018 11:17:10 +0100 (CET) To: Masahiro Yamada cc: Lukas Bulwahn , Linux Kbuild mailing list , Nicholas Mc Guire , sil2review@lists.osadl.org, Michal Marek , Sam Ravnborg , Linux Kernel Mailing List Subject: Re: [PATCH v2] fixdep: exit with error code in error branches of do_config_file() In-Reply-To: Message-ID: References: <1513801623-19069-1-git-send-email-lukas.bulwahn@gmail.com> <1513883429-9527-1-git-send-email-lukas.bulwahn@gmail.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sun, 31 Dec 2017, Masahiro Yamada wrote: > 2017-12-22 4:10 GMT+09:00 Lukas Bulwahn : >> diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c >> index bbf62cb..4274610 100644 >> --- a/scripts/basic/fixdep.c >> +++ b/scripts/basic/fixdep.c >> @@ -284,19 +284,18 @@ static void do_config_file(const char *filename) >> exit(2); >> } >> if (st.st_size == 0) { >> - close(fd); >> - return; >> + fprintf(stderr, "fixdep: error empty file config file: "); >> + perror(filename); >> + exit(2); >> } > > No. This is correct as-is. > > do_config_file() does not parse .cmd files > but parse source files (.c .h .S etc.) > > Having an empty source file is rare, but possible. > > Now that I looked at the code for creating the v3 patch, I am confused about the error messages in scripts/basic/fixdep.c, lines 275 - 285, in do_config_file(): fd = open(filename, O_RDONLY); if (fd < 0) { fprintf(stderr, "fixdep: error opening config file: "); perror(filename); exit(2); } if (fstat(fd, &st) < 0) { fprintf(stderr, "fixdep: error fstat'ing config file: "); perror(filename); exit(2); } These error messages suggest that filename (and the file handler fd) refers to a config file, but you say that filename and fd refer to source files. Looking at parse_dep_file() and how it invokes do_config_file(), I think you are right that it does refer to source files. If you confirm that this is correct, I would change `config file` to `source file` in the error messages of do_config_file(). What is best to do here, provide a separate patch or add it to the existing patch? Lukas