From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57713 invoked by alias); 6 Apr 2016 09:01:36 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 55631 invoked by uid 89); 6 Apr 2016 09:01:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=vars, UD:top, p, late X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 06 Apr 2016 09:01:33 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 560BCA89D; Wed, 6 Apr 2016 09:01:32 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-113-22.phx2.redhat.com [10.3.113.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3691UG1016961 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Apr 2016 05:01:31 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u3691SWu009620; Wed, 6 Apr 2016 11:01:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u3691Qdt009619; Wed, 6 Apr 2016 11:01:26 +0200 Date: Wed, 06 Apr 2016 09:01:00 -0000 From: Jakub Jelinek To: Jonathan Wakely Cc: Eric Botcazou , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: [patch] Remove superfluous /dev/null on grep line Message-ID: <20160406090126.GU19207@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <3554293.nIQqjdAT3l@polaris> <20160406085048.GL5814@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160406085048.GL5814@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-04/txt/msg00277.txt.bz2 On Wed, Apr 06, 2016 at 09:50:48AM +0100, Jonathan Wakely wrote: > On 06/04/16 09:39 +0200, Eric Botcazou wrote: > >we recently ran into build failures on Windows systems using a somewhat old > >grep, coming from a syntax error in the libstdc++-symbols.ver version file: > > > ># Symbol versioning for shared libraries. > >if ENABLE_SYMVERS > >libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ > > $(port_specific_symbol_files) > > cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp > > chmod +w $@.tmp > > if test "x$(port_specific_symbol_files)" != x; then \ > > if grep '^# Appended to version file.' \ > > $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then > >\ > > cat $(port_specific_symbol_files) >> $@.tmp; \ > > else \ > > sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \ > > sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \ > > cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \ > > rm tmp.top tmp.bottom; \ > > fi; \ > > fi > > > >Note the double /dev/null on the grep command line. The first one causes the > >grep to fail when the command is invoked on these systems. That's old code, > >but it is now invoked for config/abi/pre/float128.ver on the mainline and 5 > >branch and this breaks the build on these systems (4.9 builds fine). > > > >This first /dev/null doesn't serve any useful purpose and seems to be a typo, > > Doesn't it mean that if $port_specific_symbol_files contains only > whitespace we don't hang waiting for input from stdin? The 'if' above > it will be true when "x$port_specific_symbol_files" = "x " or similar. > > I don't see any way for that to happen in the FSF tree, so it should > be safe. I'm a bit concerned about making that change this late in > stage 4 though. There isn't much time to find out if it breaks an > obscure target. As it is a make variable, can't make be used to test this? So perhaps chmod +w $@.tmp ifneq ($(port_specific_symbol_files),) if grep '^# Appended to version file.' \ $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \ cat $(port_specific_symbol_files) >> $@.tmp; \ else \ sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \ sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \ cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \ rm tmp.top tmp.bottom; \ fi; endif ? Though, I think the initial and trailing whitespace is removed during expansion (or already parsing of the vars), so even the test "x$(port_specific_symbol_files)" != x check should work right. Jakub