Skip to content

Commit 1178796

Browse files
authored
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 <[email protected]> Signed-off-by: Tony Hutter <[email protected]> Closes #17766
1 parent 6ba51da commit 1178796

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/zfs-helpers.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ install() {
122122
src=$1
123123
dst=$2
124124

125+
# We may have an old symlink pointing to different ZFS workspace.
126+
# Remove the old symlink if it doesn't point to our workspace.
127+
if [ -h "$dst" ] && [ "$(readlink -f """$dst""")" != "$src" ] ; then
128+
echo "Removing old symlink: $dst -> $(readlink """$dst""")"
129+
rm "$dst"
130+
fi
131+
125132
if [ -h "$dst" ]; then
126133
echo "Symlink exists: $dst"
127134
elif [ -e "$dst" ]; then

0 commit comments

Comments
 (0)