From patchwork Sat May 21 08:21:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Cromie X-Patchwork-Id: 805352 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4L8Mwuk022495 for ; Sat, 21 May 2011 08:23:00 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753001Ab1EUIWK (ORCPT ); Sat, 21 May 2011 04:22:10 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:38472 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799Ab1EUIWI (ORCPT ); Sat, 21 May 2011 04:22:08 -0400 Received: by pzk9 with SMTP id 9so1972660pzk.19 for ; Sat, 21 May 2011 01:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=KlO5yd6AoS7rcRzcCm2/ljIu3WyKM1rdrH2HCS9artY=; b=Icv7yIefXf1G47YavxGhaMc59bamb7VnjGv9fN5158JvZ16Nz4Pqgkq51asyG9etun QVk6wYOojV7PLg292rooZViD1nYm4LSvJ87WmKV60zZuyh772LApQq6fYUPrzhmumTH3 a1+sjBi6jIq0ES0hdJoiRjDCTBLr7A5BUTLjM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=N49/Ynw9GYsFvuk1Pax7GtH6uWCOQgXVa14VVcrg5U2sUejH3HVauc1y+MkW6Qjiej 2ZJGCDlmK7lndFiZJNIm4LR1YjCXQuqiwB3/G61WbMBgAi7VnTpRhZgpjb0DlNBDoO+G kdH6KJF5cOwtX6nTWsvZ+9tyDkVsn+XYKpkdE= Received: by 10.68.66.169 with SMTP id g9mr434925pbt.527.1305966127572; Sat, 21 May 2011 01:22:07 -0700 (PDT) Received: from localhost.localdomain (c-67-174-123-122.hsd1.co.comcast.net [67.174.123.122]) by mx.google.com with ESMTPS id q20sm2985706pbt.72.2011.05.21.01.22.06 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 May 2011 01:22:07 -0700 (PDT) From: Jim Cromie To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Jim Cromie Subject: [PATCH 1/3] do collectcfiles work in perl itself, eschew shell pipeline Date: Sat, 21 May 2011 02:21:46 -0600 Message-Id: <1305966108-13399-2-git-send-email-jim.cromie@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1305966108-13399-1-git-send-email-jim.cromie@gmail.com> References: <1305966108-13399-1-git-send-email-jim.cromie@gmail.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 21 May 2011 08:23:00 +0000 (UTC) avoid spawning a shell pipeline doing cat, grep, sed, and do it all inside perl. The <*.c> construct works at least as far back as 5.8.9 Note that this is not just an optimization; the sed command in the pipeline was unterminated, due to lack of escape on the end-of-line (\$) in the regex, resulting in this: $ perl ../linux-2.6/scripts/export_report.pl > /dev/null sed: -e expression #1, char 5: unterminated `s' command sh: .mod.c/: not found Comments on an earlier patch sought an all-perl implementation. Signed-off-by: Jim Cromie cc: Michal Marek , cc: linux-kbuild@vger.kernel.org cc: Arnaud Lacombe lacombar@gmail.com cc: Stephen Hemminger shemminger@vyatta.com --- scripts/export_report.pl | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 04dce7c..5499ff0 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl @@ -49,8 +49,14 @@ sub usage { } sub collectcfiles { - my @file - = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; + my @file; + while (<.tmp_versions/*.mod>) { + open my $fh, '<', $_ or die "cant open $_: $!\n"; + push (@file, + grep s/\.ko/.mod.c/, # change the suffix + grep m/.+\.ko/, # find the .ko path + <$fh>); # lines in opened file + } chomp @file; return @file; }