From owner-freebsd-current@FreeBSD.ORG Sat Jan 24 18:58:22 2015 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B7FE26A for ; Sat, 24 Jan 2015 18:58:22 +0000 (UTC) Received: from mail-qc0-x22a.google.com (mail-qc0-x22a.google.com [IPv6:2607:f8b0:400d:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D88E31DD for ; Sat, 24 Jan 2015 18:58:21 +0000 (UTC) Received: by mail-qc0-f170.google.com with SMTP id p6so2293053qcv.1 for ; Sat, 24 Jan 2015 10:58:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=DCAPbrSAaGaOgS+TjwZjWHYQSP/gP5fdJENb61q0RgM=; b=YNOVAPqa95XYYqa4GIqlZ0ZSHUZYjzikBJ/PueqalhMbju52oLW9kcKhzEerLPbkUu Fr0DVoucytseYssWsUyOGFJcFxOqScWd2thpcN7u0OPch2VH5Up1UgZfMkEblcJz9461 ZSKhxrmSaupEo6Eez9+s5khOwQFRwv6/ipHErwsPvy6yyrZ8HAUyl1kZJDZaPqSOaXQ7 Z/mOeK7tdbFUlOuGMdYd4NXZy0GoPw4fQTSMt16kqPDGfFExiE4DP4aFNQaH4Ik6pAFd BseQORVyt5mPDm2rsJIhc9i458+5bNausnCpCAcR4m5mDG7UBeVG81+7a8Dc+ugky1iZ m2aw== X-Received: by 10.224.120.10 with SMTP id b10mr21262396qar.19.1422125900962; Sat, 24 Jan 2015 10:58:20 -0800 (PST) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.140.39.209 with HTTP; Sat, 24 Jan 2015 10:58:00 -0800 (PST) In-Reply-To: <20150124081101.GA74579@onelab2.iet.unipi.it> References: <20150124081101.GA74579@onelab2.iet.unipi.it> From: Ed Maste Date: Sat, 24 Jan 2015 13:58:00 -0500 X-Google-Sender-Auth: -qye-Bs2EabogCUloL-6unzty1M Message-ID: Subject: Re: elftoolchain version of strip unlinks hard-linked files ? To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Jan 2015 18:58:22 -0000 Hi Luigi, On 24 January 2015 at 03:11, Luigi Rizzo wrote: > I just found that recent versions of 'strip' on head (the change > occurred between svn 276756 and 277633, not in the code but with > the change from GNU binutils to the elf toolchain) when operating > on hard-linked files, creates a new file instead of modifying the > original: > > ... > > I believe the elftoolchain is doing it wrong and should be fixed. I agree that strip ought to leave links intact and will make sure this gets fixed. Fortunately copy_from_tempfile() already has logic to try rename() first and fall back to copying otherwise, so it should be fairly straightforward to add special handling for files with link count > 1. If you need a short term workaround you can set WITHOUT_ELFTOOLCHAIN_TOOLS in src.conf to switch back to the binutils tools. That said, when installworld strips it does so at install time and creates links afterwards. Thus this issue won't happen for those standard targets. Could picobsd make use of that? > It is also weird that the new strip, despite being statically > linked, looks up for helper programs somewhere,because if i copy > it to a different directory it makes the copy but no longer works > correctly: No, it doesn't use any helper programs. It's just that strip and elfcopy are hard-links, and the mode is selected based on argv[0]. This seems reasonable to me, but if there's a need to be able to give it an arbitrary name I'll undo the link and make it always operate as strip. Otherwise, I think a reasonable enhancement would be to check also for *-strip.