Received: by 10.223.176.5 with SMTP id f5csp1086832wra; Wed, 7 Feb 2018 12:25:46 -0800 (PST) X-Google-Smtp-Source: AH8x225qgvcOU+tlI7zUnowi/ydDr3t2LvlFF6/KqtU1uTRCkyUc5WBuxCnF+YsRGNHjatMjNedr X-Received: by 10.98.166.198 with SMTP id r67mr1129051pfl.40.1518035146172; Wed, 07 Feb 2018 12:25:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518035146; cv=none; d=google.com; s=arc-20160816; b=X/HhF3J4QOKrWAGAQRcwDhEIGryWyPGkL6ziKmfLZAXsT402gTna1/7hanE4ODZEf5 9jYol8biZq0fnQwcEKdpPn0xobaKJfj8YgTP7QnrAxb4f6PFk7/Pq/xdH6QAK7Rz47Wr Pj+Yc8A+9oRXFFRaGTE8qEB+ZmBo8xbYWUe8x4xe0CLRPnJmQ6n8umtJrjk2CvrH95OD G0No+KC5nNMjkkUQlj/otxtX2ED9RGLipwKs/zcRiQ7ShavNQgD5qnc3B8touV0dT4KF xwcBSIDyQsOkncFBhLtEZ3Iy/74xcKn11Jyohu61H3McchL0rYKNNo/MwgBAIafBTmvq LJAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ZYZEnuldO8sRgeSTYf3ey7n5Kyqc139oEtQzcThpXto=; b=jGy72YBbH8d3vzJpjM3zd/8YQbzp0EPokV71W/4pgTP7bJ13FkjsHaqPwQAjEpwNBO dta60cAQ6xI120i1B2d/HuJTyuBijGpSGpoh83MhxZPiqimb5EDdpzBf/fTyBdbpTiwc At4kMlPcpMh0XHF0B6kpG4Bi/PfROHwtKzk+oZndIdikmzoeqhtMuBNh9S2hsfQohTGz ZyWRDdUQSuYdBpJOEtOJZoQnSBlIkZb+x02150twhGzZY4LHhpAonkl/BADr9omhQ3e8 lSU7jYBxfOTpx6z024xWYNep8u5dC8YsSrGlkQRgG0sZlQ2ExFcaYC1T3nXj5EbFTnSX 0T7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=e3Qfcuzr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g124si100936pgc.114.2018.02.07.12.25.32; Wed, 07 Feb 2018 12:25:46 -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=@gmail.com header.s=20161025 header.b=e3Qfcuzr; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754673AbeBGUYS (ORCPT + 99 others); Wed, 7 Feb 2018 15:24:18 -0500 Received: from mail-vk0-f68.google.com ([209.85.213.68]:38678 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754154AbeBGUYQ (ORCPT ); Wed, 7 Feb 2018 15:24:16 -0500 Received: by mail-vk0-f68.google.com with SMTP id z9so1380818vkd.5; Wed, 07 Feb 2018 12:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ZYZEnuldO8sRgeSTYf3ey7n5Kyqc139oEtQzcThpXto=; b=e3QfcuzrrsnUDhSWEmcOZh1B3TOo8CIyBBe0AAd5ezsZJwZt6ueJTmnktej/8emPyw RqsWMqvdmqtL3rkh8PE1X4hYt4wXrhKu3JzLxhYMBDY3RBkmXBhczX7ZwkU7IRZ+InWM ErI2Tw17WKVBJsg+gPCBXW1e2pYJaerb8PjQ2adLc0foRCHQZBmMDE/PqUYIOxM61KbT /k+SuCcVBOI/BYn8Lz23AP2RnDwTzeCHc/24/QkFCpa0yzm9lYrFWdxsKo+laUwK1ei+ gGshtWBYRspmUTx49+3gkJPHEe+J8v5ZelH/+GnStnGaBurtV77ATEsNHwyuU4t+aheQ /aBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ZYZEnuldO8sRgeSTYf3ey7n5Kyqc139oEtQzcThpXto=; b=J+BsSQCVejcuBkRHJmVfkqBUVEYUG1cpzLOZFZC37pkEOUOsNpmRpRX5gYYMeHMYZy CWKcxd46lxX0O5T/cBYvFaUQi5l2cCiusFuRof7cgkUiRYwWMcOaKpykPl0jpsXuvI5u gkO2R9AWd6dtndfkHtLTzlvnUUT5w0knpvRsNrzL+7+mVEKZj8czwYkTm04GsPg7iWQa Mf/kJyak3HL3mDUakzENLvjLtMMqUqKONZ5D473FxcKcrSsEBljdsR1UK9xjU4fNURLv tRdMEF1hjgGRvCKHsCxoNnlG7Gkv/1Id/S84sWD85vs0XmW7U+r1+6pU6LmPagMrcWwJ FH+w== X-Gm-Message-State: APf1xPDjmDxzNf/Xk1bHOsT4Q4fJuy7PYKL2+p0Ks4m3A5GXJUQYjNtK 3tW7HLuVyoRwL84w7UZMWR9vZ93NIEvgRLJog4c= X-Received: by 10.31.15.149 with SMTP id 143mr6085051vkp.126.1518035055503; Wed, 07 Feb 2018 12:24:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.70.21 with HTTP; Wed, 7 Feb 2018 12:24:14 -0800 (PST) In-Reply-To: <1517877294-4826-2-git-send-email-yamada.masahiro@socionext.com> References: <1517877294-4826-1-git-send-email-yamada.masahiro@socionext.com> <1517877294-4826-2-git-send-email-yamada.masahiro@socionext.com> From: Ulf Magnusson Date: Wed, 7 Feb 2018 21:24:14 +0100 Message-ID: Subject: Re: [PATCH 01/14] kconfig: send error messages to stderr To: Masahiro Yamada Cc: Linux Kbuild mailing list , Greg Kroah-Hartman , Andrew Morton , Nicolas Pitre , "Luis R . Rodriguez" , Randy Dunlap , Sam Ravnborg , Michal Marek , Linus Torvalds , Linux Kernel Mailing List , Marc Herbert Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 6, 2018 at 1:34 AM, Masahiro Yamada wrote: > These messages should be directed to stderr. > > Signed-off-by: Masahiro Yamada > --- > > scripts/kconfig/conf.c | 18 +++++++++++------- > scripts/kconfig/zconf.l | 27 +++++++++++++++------------ > 2 files changed, 26 insertions(+), 19 deletions(-) > > diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c > index 307bc3f..90a76aa2 100644 > --- a/scripts/kconfig/conf.c > +++ b/scripts/kconfig/conf.c > @@ -75,9 +75,11 @@ static void strip(char *str) > static void check_stdin(void) > { > if (!valid_stdin) { > - printf(_("aborted!\n\n")); > - printf(_("Console input/output is redirected. ")); > - printf(_("Run 'make oldconfig' to update configuration.\n\n")); > + fprintf(stderr, > + _("Aborted!\n" > + "Console input/output is redirected.\n" > + "Run 'make oldconfig' to update configuration.\n\n") > + ); This could use fputs() too, moving the stderr to the last argument. I think the _() thingies around the strings are for gettext (https://www.gnu.org/software/gettext/manual/html_node/Mark-Keywords.html). This would break it if there are existing translations, since the msgids change. More practically, I doubt anyone is translating these tools. IMO we should remove the gettext stuff unless we find traces of translations. > exit(1); > } > } > @@ -565,7 +567,7 @@ int main(int ac, char **av) > } > } > if (ac == optind) { > - printf(_("%s: Kconfig file missing\n"), av[0]); > + fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]); > conf_usage(progname); > exit(1); > } > @@ -590,9 +592,11 @@ int main(int ac, char **av) > if (!defconfig_file) > defconfig_file = conf_get_default_confname(); > if (conf_read(defconfig_file)) { > - printf(_("***\n" > - "*** Can't find default configuration \"%s\"!\n" > - "***\n"), defconfig_file); > + fprintf(stderr, > + _("***\n" > + "*** Can't find default configuration \"%s\"!\n" > + "***\n"), > + defconfig_file); > exit(1); > } > break; > diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l > index 07e074d..0ba4900 100644 > --- a/scripts/kconfig/zconf.l > +++ b/scripts/kconfig/zconf.l > @@ -184,7 +184,9 @@ n [A-Za-z0-9_-] > append_string(yytext, 1); > } > \n { > - printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); > + fprintf(stderr, > + "%s:%d:warning: multi-line strings not supported\n", > + zconf_curname(), zconf_lineno()); Whether stuff is translated seems inconsistent too. > current_file->lineno++; > BEGIN(INITIAL); > return T_EOL; > @@ -294,7 +296,7 @@ void zconf_initscan(const char *name) > { > yyin = zconf_fopen(name); > if (!yyin) { > - printf("can't find file %s\n", name); > + fprintf(stderr, "can't find file %s\n", name); > exit(1); > } > > @@ -315,8 +317,8 @@ void zconf_nextfile(const char *name) > current_buf->state = YY_CURRENT_BUFFER; > yyin = zconf_fopen(file->name); > if (!yyin) { > - printf("%s:%d: can't open file \"%s\"\n", > - zconf_curname(), zconf_lineno(), file->name); > + fprintf(stderr, "%s:%d: can't open file \"%s\"\n", > + zconf_curname(), zconf_lineno(), file->name); > exit(1); > } > yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); > @@ -325,20 +327,21 @@ void zconf_nextfile(const char *name) > > for (iter = current_file->parent; iter; iter = iter->parent ) { > if (!strcmp(current_file->name,iter->name) ) { > - printf("%s:%d: recursive inclusion detected. " > - "Inclusion path:\n current file : '%s'\n", > - zconf_curname(), zconf_lineno(), > - zconf_curname()); > + fprintf(stderr, > + "%s:%d: recursive inclusion detected. " > + "Inclusion path:\n current file : '%s'\n", > + zconf_curname(), zconf_lineno(), > + zconf_curname()); > iter = current_file->parent; > while (iter && \ > strcmp(iter->name,current_file->name)) { > - printf(" included from: '%s:%d'\n", > - iter->name, iter->lineno-1); > + fprintf(stderr, " included from: '%s:%d'\n", > + iter->name, iter->lineno-1); > iter = iter->parent; > } > if (iter) > - printf(" included from: '%s:%d'\n", > - iter->name, iter->lineno+1); > + fprintf(stderr, " included from: '%s:%d'\n", > + iter->name, iter->lineno+1); > exit(1); > } > } > -- > 2.7.4 > The unrelated gettext stuff aside: Reviewed-by: Ulf Magnusson Cheers, Ulf