Conversation
syscall.c: Add fchmodat(), if it exists on the system, as a last-resort attempt to change the Unix access permissions for a symlink (on those systems that support it). This is done just prior to finally abandoning such an attempt and after any other available options for this, such as lchmod() or setattrlist(). This option is required to preserve symlink access permissions when making copies using rsync on OpenBSD. The patch itself is not OS-specific. testsuite: Add a test, symlink-unix-perms_test.py, to testsuite to check on the success of setting symlink access changes using rsync. The test is skipped on those systems that do not allow symlink access permission changes. The test checks at runtime whether or not the system permits symlink access changes. As with the patch, this test is not OS-specific.
Member
|
Make the test deterministic, use a normal Python shebang and catch only the expected unsupported-operation errors. A programming error or unexpected filesystem failure must fail the test rather than silently skip it. Please also add a configure-time compile check for the four-argument |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many (perhaps all) BSD Unix systems allow users to set/modify the Unix access permissions on a symlink (as opposed to its target). OpenBSD does permit this but requires the use of fchmodat() to do so. Rsync does not provide the use of fchmodat() in this situation so it does not preserve symlink permissions when copying in OpenBSD.
The patch in the PR modifies syscall.c to provide the use of fchmodat(), on those systems that have it, as a last resort effort to setting a symlink permission prior to (ultimately) giving up on the attempt. This patch is not specific to any operating system; it only relies on the availability of fchmodat();
The PR also includes a testsuite test in that checks so see if symlink Unix access permissions are preserved on those systems that permit their change. The test is skipped on systems, such as (most) Linux variants, that don't allow changes to symlink Unix access permissions. The test, too, is not OS-specific. It tests at runtime to see if symlink access can be changed on the system and behaves accordingly.
I've run the testsuite with this patch applied on OpenBSD (7.9), FreeBSD (15.1), MacOS (Sequoia), ArchLinux (7.2.7-arch1-1), Debian (13), and Ubuntu (26.04.1 LTS). The results were all as expected. I've also run a complete system copy with Rsync on OpenBSD and Debian. On comparison of the results, the original and the copy were the same. The comparison made use of values obtained via the Unix lstat() system routine as well as MD5 checksums of file contents.
My apologies if I've submitted incorrectly. This is my first attempt at a PR.
Thanks for your attention.