From nobody Sun Jul 07 13:11:35 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WH71g6yLvz5Pf10; Sun, 07 Jul 2024 13:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WH71g5KWlz4hJd; Sun, 7 Jul 2024 13:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720357895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9MxoMiArZyIEU7XIheqvMnp16yGNOftjObWqO3ei1Jw=; b=DZ6lixIOogyodU1O5lRfV54FwQof0gITmDH40hRORmVHcbGkIWMizeUF58NXgFFKNelZb3 i3hhnTMbrwN90t6lEqyX1py3gvdu1Cx2Hw+mTScS17odJxO8fasdD7DllTZzv08SU4DKIw I5jc9BMx5VaYxAirIffO6nKXpey1ehI6fs56YSTkpt3PyfFyuVDslPHWTUBIOpsqz6D+iZ Ia8JVN7kyB4aZGvvRlkIBcdbGzZI/+HcYjVZ5EAllQLTzrK8OjTn0P0DXZLgFXCRAIc4MT YCjNkcPlljMQs62Niij6YfkfNW7wuFMaKBJw98DardWqXpRfBlpISW6hWRQQVQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720357895; a=rsa-sha256; cv=none; b=Vdu46MRSNQVTTWS7XReW5gE3u43SikpMkl9+ZsvgrTHOlVTkGZQMeTDScpfBCcSqmlUWf0 Ybn3K+tzHAt/hS0VlPtmZPos2YPUx/0NzJF1LI9cHIRC6A441/QXfDlO4iSdeuOp56wYEk v0rbFyjJfL3iakFVuuYQyZJOTwHFiZwhRiNSNCtBLQINaeSFS35oVVnOvldvMvBtXcRwWl OGougCq8r/V9DSUqEwZdz9p51n2qDn3qqZTe12gJz4MEbubj502iRWJm6+Iv+I/Rd1RnDx Px1h6AEqNXF5QkONd5cfvpfsYDh9S4cQsmdfBtP0EJLkT4oBq1veL8Y5hhazNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720357895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9MxoMiArZyIEU7XIheqvMnp16yGNOftjObWqO3ei1Jw=; b=l8Qyrt5jDOovvkgSNmPnTKvgqDvsGVy+cP/8w6d1fl8TFsXhIHlhboCWFqHZLbiEhSyJqy KaRdQyf0LQAf4ojpGT5WJiSPsJ1JR/QWAKb7I48TjqEE1nVnefcx463m/uvLEyMN1edaRW awAx+hPXTlCqUk1sjV1cb5fnxaLfvDAVrWiMdvZ3oOsDWYnm0s49JnWAz1EU/0sjwJNNmE hB50qlyhOSTr9ci0h4BVyWbm06rbbbtKoMTrNxcs58NGW5m2wdN72WhZGyStGnAdtkLK7P 5gMDFB+pnEOjlOiSaLzBnx9Pn7ZcD+b+rhyx1rbpBhkbtiPx0zDuvAYCV5UkhQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WH71g4y2Xz1NwP; Sun, 7 Jul 2024 13:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 467DBZDD005920; Sun, 7 Jul 2024 13:11:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 467DBZZ9005917; Sun, 7 Jul 2024 13:11:35 GMT (envelope-from git) Date: Sun, 7 Jul 2024 13:11:35 GMT Message-Id: <202407071311.467DBZZ9005917@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wolfram Schneider Subject: git: e880dd644f63 - main - stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wosch X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e880dd644f63fbe068c38b73b44aa7e7c5f176f3 Auto-Submitted: auto-generated The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=e880dd644f63fbe068c38b73b44aa7e7c5f176f3 commit e880dd644f63fbe068c38b73b44aa7e7c5f176f3 Author: Wolfram Schneider AuthorDate: 2024-07-07 12:59:20 +0000 Commit: Wolfram Schneider CommitDate: 2024-07-07 12:59:20 +0000 stale-symlink-buildworld.sh: a script to check for stale symlinks on a FreeBSD system You can run the script before or after `make installworld' You may also check your local ports with: env STALE_SYMLINK_BUILDWORLD_DIRS=/usr/local ./stale-symlink-buildworld.sh PR: 276235 --- tools/build/stale-symlink-buildworld.sh | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/tools/build/stale-symlink-buildworld.sh b/tools/build/stale-symlink-buildworld.sh new file mode 100755 index 000000000000..a4515db3fccb --- /dev/null +++ b/tools/build/stale-symlink-buildworld.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# Copyright (c) Feb 2024 Wolfram Schneider +# SPDX-License-Identifier: BSD-2-Clause +# +# stale-symlink-buildworld.sh - check for stale symlinks on a FreeBSD system +# +# You can run the script before or after `make installworld' +# + +PATH="/bin:/usr/bin"; export PATH + +: ${ncpu=$(nproc)} + +# check other directories as well +: ${STALE_SYMLINK_BUILDWORLD_DIRS="/usr/obj"} + +trap 'rm -f $script' 0 +script=$(mktemp -t stale-symlink) +chmod u+x $script + +# create a temporary shell script to check for stale symbolic links +cat << 'EOF' > $script +file="$1" + +if [ ! -e "$file" ]; then + echo "stale symlink detected: $(ls -ld $file)" >&2 + exit 1 +else + exit 0 +fi +EOF + +find -s -H \ + /bin \ + /boot \ + /etc \ + /lib \ + /libexec \ + /sbin \ + /usr/bin \ + /usr/include \ + /usr/lib \ + /usr/lib32 \ + /usr/libdata \ + /usr/libexec \ + /usr/sbin \ + /usr/src \ + /usr/share \ + $STALE_SYMLINK_BUILDWORLD_DIRS \ + -type l \ + -print0 | xargs -n1 -0 -P${ncpu} $script + +#EOF