Skip to content

Conversation

@airtower-luna
Copy link

When running with --removable-device, the basename of dest is used to construct the path of the "removable" sysfs file for the device. However, if dest is a symlink the basename may be very different from the actual device name, and theoretically might even match a different device. Make the path absolute and resolve any symlinks before taking the basename to avoid that problem.

This is of practical importance because it allows using /dev/disk/... symlinks created by udev, which is much less error-prone than using e.g. /dev/sdX.

When running with --removable-device, the basename of dest is used to
construct the path of the "removable" sysfs file for the
device. However, if dest is a symlink the basename may be very
different from the actual device name, and theoretically might even
match a different device. Make the path absolute and resolve any
symlinks before taking the basename to avoid that problem.

This is of practical importance because it allows using
/dev/disk/... symlinks created by udev, which is much less error-prone
than using e.g. /dev/sdX.

Signed-off-by: Fiona Klute <[email protected]>
@airtower-luna airtower-luna force-pushed the fix-removable-dev-symlink branch from 7ae5ae3 to f2fc471 Compare April 25, 2025 08:27
@airtower-luna
Copy link
Author

Reformatted as suggested by black.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant