In 14.0-RELEASE and the branch releng/14.0 we have the problem that some of the locale symlinks are wrong. See Bug 260841 I think we can detect this kind of stale symlinks during `make installworld’ and bail out: As an example: (set -o pipefail; sudo find /bin /boot /etc /lib /libexec /sbin /usr/bin /usr/include /usr/lib /usr/lib32 /usr/libdata/ /usr/libexec/ /usr/sbin /usr/share/ -type l -print0 | perl -0e 'while(<>) { if (! -e $_) { print; $exit=1}}; exit $exit' | xargs -0 ls -ld); echo $? lrwxr-xr-x 1 root wheel 31 Nov 10 07:59 /usr/share/locale/nn_NO.ISO8859-1/LC_MESSAGES -> ../nn_NO.ISO8859-15/LC_MESSAGES lrwxr-xr-x 1 root wheel 31 Nov 10 07:59 /usr/share/locale/nn_NO.ISO8859-15/LC_MESSAGES -> ../nn_NO.ISO8859-15/LC_MESSAGES lrwxr-xr-x 1 root wheel 30 Nov 10 07:59 /usr/share/locale/sl_SI.ISO8859-2/LC_MESSAGES -> ../sr_RS.ISO8859-2/LC_MESSAGES 1 Maybe we should write a shell script and put it in src/tools/stale-symlinks.sh and call it from `make installworld’ as the last step.
Here is an example without perl, just the base tools: find /bin /boot /etc /lib /libexec /sbin /usr/bin /usr/include /usr/lib /usr/lib32 /usr/libdata/ /usr/libexec/ /usr/sbin /usr/share/ -type l -print0 | xargs -n1 -0 -P$(sysctl -n hw.ncpu) ./stale-symlink.sh cat stale-symlink.sh #!/bin/sh file="$1" if [ ! -e "$file" ]; then echo "stale symlink detected: $(ls -ld $file)" >&2 exit 1 else exit 0 fi
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e880dd644f63fbe068c38b73b44aa7e7c5f176f3 commit e880dd644f63fbe068c38b73b44aa7e7c5f176f3 Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2024-07-07 12:59:20 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> 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 (new +x) | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
Hello, > Maybe we should write a shell script and put it in src/tools/stale-symlinks.sh > and call it from `make installworld’ as the last step. Will this script be added to `make installworld` step soon? Thanks
(In reply to Nuno Teixeira from comment #3) >Will this script be added to `make installworld` step soon? If there are no problems we can add it to the installworld step. Note: I didn't tested if the script works with NFS or some special targets as universe, iso images, cross compiling etc.
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=cf1bc41b29a7bd90d70445c8cf99474ef7b767b2 commit cf1bc41b29a7bd90d70445c8cf99474ef7b767b2 Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2024-07-07 12:59:20 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2024-07-13 10:11:51 +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 (cherry picked from commit e880dd644f63fbe068c38b73b44aa7e7c5f176f3) tools/build/stale-symlink-buildworld.sh (new +x) | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3e8a2296e9ad827268d0398738a3ed95877d872e commit 3e8a2296e9ad827268d0398738a3ed95877d872e Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2024-07-07 12:59:20 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2024-07-13 10:14:27 +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 (cherry picked from commit e880dd644f63fbe068c38b73b44aa7e7c5f176f3) tools/build/stale-symlink-buildworld.sh (new +x) | 53 ++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
(In reply to Wolfram Schneider from comment #1) > Here is an example without perl, just the base tools: > ... > if [ ! -e "$file" ]; then You actually don't need this separate check, find(1) can do it all at once: $ find -L ${dirs} -type l
(In reply to Alexey Dokuchaev from comment #7) Good advice, thanks. However, you will always get exit status zero from `find -L ${dirs} -type l', whether it finds a stale symlink or not. The purpose of this script is to detect stale symlinks, report them to stderr and exit with a non-zero status. All other cases are ignored, such as no symlinks, missing directories, permission problems, etc.