From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bruce.richardson@intel.com>
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id 226833572
 for <dev@dpdk.org>; Mon,  1 Apr 2019 16:47:55 +0200 (CEST)
X-Amp-Result: UNKNOWN
X-Amp-Original-Verdict: FILE UNKNOWN
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 01 Apr 2019 07:47:55 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,297,1549958400"; d="scan'208";a="136592700"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by fmsmga008.fm.intel.com with SMTP; 01 Apr 2019 07:47:52 -0700
Received: by  (sSMTP sendmail emulation); Mon, 01 Apr 2019 15:47:51 +0100
Date: Mon, 1 Apr 2019 15:47:50 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: Ali Alnubani <alialnu@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>,
 "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
 harini.ramakrishnan@microsoft.com, ranjit.menon@intel.com
Message-ID: <20190401144750.GB1441@bricha3-MOBL.ger.corp.intel.com>
References: <20190401103551.28909-1-alialnu@mellanox.com>
 <3743424.Qud79MjzIA@xps>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <3743424.Qud79MjzIA@xps>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH] build: use cat instead of more
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Apr 2019 14:47:56 -0000

On Mon, Apr 01, 2019 at 01:24:20PM +0200, Thomas Monjalon wrote:
> 01/04/2019 12:36, Ali Alnubani:
> > This is to fix a build error with meson that is caused
> > by using the 'more' command to read the VERSION file. The error:
> > 
> >     config/meson.build:10:10: ERROR:  String
> >     '::::::::::::::\n<RTE_SDK_PATH>VERSION\n::::::::::::::\n19' cannot be
> >     converted to int
> > 
> > The command 'more' prints the file name before the actual
> > contents of the file when it's being run without a controlling terminal.
> > This could happen in CI environments.
> > 
> > Please refer to:
> > https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/more.c
> > 
> > The cat command can still be found on Windows if the ports of GNU
> > utilities are installed.
> > 
> > Fixes: c04172b5f031 ("build: add single source of DPDK version number")
> > Fixes: d320fe56bd51 ("build: use version number from config file")
> > 
> > Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 
> It is fixing a regression on Linux.
> I think we should take this fix urgently
> and think about Windows in a next step.
> 
> "more" is an interactive command, we should not use it.
> As suggested by Ali, we may require an extra dependency on Windows
> to get some GNU utilities. Or if no other tools are required,
> may we have a meson builtin to read a file?
> 
Should not need to do so. May I suggest using "find_program" function
instead of hard-coding the command. That allows a list of programs to be
specified and the first one found is used. Unfortunately, on windows the
direct equivalent of "cat" is "type" which is a built-in rather than
command as far as I can see, so find_program doesn't work for it. However,
the following should do:

version: run_command(find_program('cat', 'more'), files('VERSION')).stdout().strip()

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id DEA02A0679
	for <public@inbox.dpdk.org>; Mon,  1 Apr 2019 16:47:58 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id E7AFF3572;
	Mon,  1 Apr 2019 16:47:57 +0200 (CEST)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id 226833572
 for <dev@dpdk.org>; Mon,  1 Apr 2019 16:47:55 +0200 (CEST)
X-Amp-Result: UNKNOWN
X-Amp-Original-Verdict: FILE UNKNOWN
X-Amp-File-Uploaded: False
Received: from fmsmga008.fm.intel.com ([10.253.24.58])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 01 Apr 2019 07:47:55 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,297,1549958400"; d="scan'208";a="136592700"
Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.35])
 by fmsmga008.fm.intel.com with SMTP; 01 Apr 2019 07:47:52 -0700
Received: by  (sSMTP sendmail emulation); Mon, 01 Apr 2019 15:47:51 +0100
Date: Mon, 1 Apr 2019 15:47:50 +0100
From: Bruce Richardson <bruce.richardson@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: Ali Alnubani <alialnu@mellanox.com>, "dev@dpdk.org" <dev@dpdk.org>,
 "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
 harini.ramakrishnan@microsoft.com, ranjit.menon@intel.com
Message-ID: <20190401144750.GB1441@bricha3-MOBL.ger.corp.intel.com>
References: <20190401103551.28909-1-alialnu@mellanox.com>
 <3743424.Qud79MjzIA@xps>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
In-Reply-To: <3743424.Qud79MjzIA@xps>
User-Agent: Mutt/1.11.4 (2019-03-13)
Subject: Re: [dpdk-dev] [PATCH] build: use cat instead of more
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190401144750.VhdVOnRSn7UNp1NNHJ2WEezgwBdgZVVXVlfqEFrA3_I@z>

On Mon, Apr 01, 2019 at 01:24:20PM +0200, Thomas Monjalon wrote:
> 01/04/2019 12:36, Ali Alnubani:
> > This is to fix a build error with meson that is caused
> > by using the 'more' command to read the VERSION file. The error:
> > 
> >     config/meson.build:10:10: ERROR:  String
> >     '::::::::::::::\n<RTE_SDK_PATH>VERSION\n::::::::::::::\n19' cannot be
> >     converted to int
> > 
> > The command 'more' prints the file name before the actual
> > contents of the file when it's being run without a controlling terminal.
> > This could happen in CI environments.
> > 
> > Please refer to:
> > https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git/tree/text-utils/more.c
> > 
> > The cat command can still be found on Windows if the ports of GNU
> > utilities are installed.
> > 
> > Fixes: c04172b5f031 ("build: add single source of DPDK version number")
> > Fixes: d320fe56bd51 ("build: use version number from config file")
> > 
> > Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 
> It is fixing a regression on Linux.
> I think we should take this fix urgently
> and think about Windows in a next step.
> 
> "more" is an interactive command, we should not use it.
> As suggested by Ali, we may require an extra dependency on Windows
> to get some GNU utilities. Or if no other tools are required,
> may we have a meson builtin to read a file?
> 
Should not need to do so. May I suggest using "find_program" function
instead of hard-coding the command. That allows a list of programs to be
specified and the first one found is used. Unfortunately, on windows the
direct equivalent of "cat" is "type" which is a built-in rather than
command as far as I can see, so find_program doesn't work for it. However,
the following should do:

version: run_command(find_program('cat', 'more'), files('VERSION')).stdout().strip()