From 2380e0b67944f6d6ea78edf9fc5436b20e920924 Mon Sep 17 00:00:00 2001 From: Tony Hutter Date: Tue, 23 Sep 2025 12:58:14 -0700 Subject: [PATCH] ZTS: Fix stale symlinks with zfs-helpers.sh zfs-helpers.sh is a utility script that sets up udev symlinks so you can run ZTS from a local ZFS git workspace. However, it doesn't check that the udev symlinks point to the current workspace. They may point to an old workspace that has been deleted. This means the udev rules never get executed, which in turn causes the zvol tests to fail. This commit removes old symlinks that do not point to the current ZFS workspace. Reviewed-by: Brian Behlendorf Signed-off-by: Tony Hutter Closes #17766 --- scripts/zfs-helpers.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/zfs-helpers.sh b/scripts/zfs-helpers.sh index b45384a9a..2e97d40db 100755 --- a/scripts/zfs-helpers.sh +++ b/scripts/zfs-helpers.sh @@ -122,6 +122,13 @@ install() { src=$1 dst=$2 + # We may have an old symlink pointing to different ZFS workspace. + # Remove the old symlink if it doesn't point to our workspace. + if [ -h "$dst" ] && [ "$(readlink -f """$dst""")" != "$src" ] ; then + echo "Removing old symlink: $dst -> $(readlink """$dst""")" + rm "$dst" + fi + if [ -h "$dst" ]; then echo "Symlink exists: $dst" elif [ -e "$dst" ]; then