From owner-freebsd-current@freebsd.org Thu Mar 1 12:03:10 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EBD8F41C1F for ; Thu, 1 Mar 2018 12:03:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F1947F8C1; Thu, 1 Mar 2018 12:03:09 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w21C2wFC023962 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 1 Mar 2018 14:03:01 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w21C2wFC023962 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w21C2wCp023961; Thu, 1 Mar 2018 14:02:58 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 1 Mar 2018 14:02:58 +0200 From: Konstantin Belousov To: John Baldwin Cc: freebsd-current@freebsd.org, cem@freebsd.org, Ronald Klop Subject: Re: pkg does not recognize correct kernel version Message-ID: <20180301120257.GB3194@kib.kiev.ua> References: <20287587.l4BUZnE1AB@ralph.baldwin.cx> <20180228194547.GA7123@kib.kiev.ua> <1796463.2W2Te48fqL@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1796463.2W2Te48fqL@ralph.baldwin.cx> User-Agent: Mutt/1.9.3 (2018-01-21) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 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: Thu, 01 Mar 2018 12:03:10 -0000 On Wed, Feb 28, 2018 at 03:32:43PM -0800, John Baldwin wrote: > On Wednesday, February 28, 2018 09:45:47 PM Konstantin Belousov wrote: > > On Wed, Feb 28, 2018 at 10:57:53AM -0800, John Baldwin wrote: > > > On Tuesday, February 20, 2018 10:19:02 AM Conrad Meyer wrote: > > > > On Mon, Feb 19, 2018 at 2:38 PM, Ronald Klop wrote: > > > > > On Mon, 19 Feb 2018 22:05:51 +0100, Konstantin Belousov > > > > > wrote: > > > > > > > > > >> Look at the man page. pkg reads version from the /bin/sh ELF FreeBSD > > > > > > > > > > > > > > > Which man page? I can't find it in pkg help update or pkg help upgrade or > > > > > man pkg. > > > > > > > > I had to dig for quite a while to find a reference (pkg.conf(5)): > > > > > > > > ABI: string The ABI of the package you want to install. Default: > > > > derived from the ABI of the /bin/sh binary. > > > > > > > > >> version note: > > > > >> orion% file /bin/ls > > > > >> /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), > > > > >> dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.1 > > > > >> (1101506), FreeBSD-style, stripped > > > > >> > > > > >> Update world past the __FreeBSD_version which is reported for the > > > > >> repository. > > > > > > > > > > > > > > > Does this mean I always have to do a *clean* buildworld after every version > > > > > bump? This takes ages. > > > > > > > > You could also do a -DNO_CLEAN buildworld. > > > > > > > > Or you can continue to override with "-o OSVERSION=foo", although that > > > > may eventually result in broken packages. In general the OSVERSION is > > > > bumped conservatively (more often than will actually result in > > > > breakage), so you can get away with the easy workaround for a while > > > > between buildworlds. > > > > > > NO_CLEAN=yes doesn't work. A clean buildworld is required. The reason is that > > > the __FreeBSD_version embedded in binaries is stored in /usr/lib/crt*.o, but > > > that the dependency rules in lib/csu/Makefile do not rebuild these .o files > > > everytime changes (so a NO_CLEAN=yes buildworld won't rebuild them > > > leaving them with a stale version). Furthermore, when binaries and shared > > > libraries are built, our Makefiles do not specify that the relevant > > > /usr/lib/crt*.o files are dependencies, so even if we fixed the missing > > > dependency, no binaries would relink to pick up the updated > > > __FreeBSD_version file unless some other input to the binary changed. This > > > one could perhaps be mostly mitigated by forcing libc to depend on the > > > relevant crt*.o files explicitly (or even having it depend on > > > to force relinking of everything when changes). > > libc already depends on sys/param.h. > > Hmm, even when I removed /usr/obj/usr/src/lib/csu entirely and then did a buildworld > NO_CLEAN=yes recently /bin/sh was not relinked, though perhaps at that point > libc already thought it was up-to-date relative to from the previous > build. > > > I think it would be enough to specify that crt1.o depends on sys/param.h > > as well. Although it is also strange, because e.g. for amd64 the dep > > thread is csu/amd64/crt1.c->csu/common/crtbrand.c->sys/param.h, which should > > be detected by the include file calculation. > > I think the detour via assembly + sed is what breaks the dependency chain. > FWIW, I found that on at least MIPS with clang I did not need the SED_FIX_NOTE > hack. Perhaps the FIX_NOTE should be re-evaluated for all the changes happen in the toolchains since the hack was needed.