Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756690AbbLARWT (ORCPT ); Tue, 1 Dec 2015 12:22:19 -0500 Received: from smtprelay0210.hostedemail.com ([216.40.44.210]:35279 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756569AbbLARWQ (ORCPT ); Tue, 1 Dec 2015 12:22:16 -0500 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2553:2559:2562:2902:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4470:5007:6261:7875:9108:10004:10400:10848:10967:11232:11658:11914:12294:12296:12517:12519:12555:12740:13069:13095:13311:13357:13618:14659:21080:30054:30070:30079:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:7,LUA_SUMMARY:none X-HE-Tag: sofa69_4da6860b4413e X-Filterd-Recvd-Size: 2956 Date: Tue, 1 Dec 2015 12:22:12 -0500 From: Steven Rostedt To: Russell King - ARM Linux Cc: Michal Marek , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Thomas Petazzoni , linux-kbuild@vger.kernel.org, Nicolas Pitre , Arnd Bergmann , =?UTF-8?B?TcOlbnMgUnVsbGfDpXJk?= Subject: Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Message-ID: <20151201122212.474afce5@gandalf.local.home> In-Reply-To: <20151201171014.GY8644@n2100.arm.linux.org.uk> References: <1448488264-23400-1-git-send-email-sboyd@codeaurora.org> <1448488264-23400-2-git-send-email-sboyd@codeaurora.org> <20151125234711.GT8644@n2100.arm.linux.org.uk> <565C6714.802@suse.com> <20151130153208.GR8644@n2100.arm.linux.org.uk> <565C6DE9.2020302@suse.com> <565DC5A9.2010305@suse.cz> <20151201161944.GX8644@n2100.arm.linux.org.uk> <20151201114929.655433a2@gandalf.local.home> <20151201171014.GY8644@n2100.arm.linux.org.uk> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1611 Lines: 49 On Tue, 1 Dec 2015 17:10:14 +0000 Russell King - ARM Linux wrote: > Another suggestion - maybe recordmcount, which fstat()s the file, > should check the st_nlink before modifying the file, and error out > with a helpful error message telling people not to use hardlinks, > which would stop nasty surprises (and make it a rule that this should > be implemented as a general principle for good build behaviour) - iow, Actually I like this solution the best. > something like this (untested): Can you test it to see if it gives you the error, otherwise I need to set up a CCACHE_HARDLINK environment :-) I guess another solution is to do a copy instead of modifying in place if it detects the multiple hard link? -- Steve > > scripts/recordmcount.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c > index 698768bdc581..bb7589fd7392 100644 > --- a/scripts/recordmcount.c > +++ b/scripts/recordmcount.c > @@ -203,6 +203,10 @@ static void *mmap_file(char const *fname) > fprintf(stderr, "not a regular file: %s\n", fname); > fail_file(); > } > + if (sb.st_nlink != 1) { > + fprintf(stderr, "file is hard linked: %s\n", fname); > + fail_file(); > + } > addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE, > fd_map, 0); > mmap_failed = 0; > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/