Skip to content

Fileinstall: Permit directories containing broken symlinks#2948

Merged
wxtim merged 1 commit intometomi:masterfrom
wxtim:fix.install_broken_symlinks_in_directories
Nov 26, 2025
Merged

Fileinstall: Permit directories containing broken symlinks#2948
wxtim merged 1 commit intometomi:masterfrom
wxtim:fix.install_broken_symlinks_in_directories

Conversation

@wxtim
Copy link
Contributor

@wxtim wxtim commented Oct 24, 2025

When complete will close #2946 .

After discussion with @dpmatthews we think that broken links inside directories being installed should not cause a failure.

@wxtim wxtim self-assigned this Oct 24, 2025
@wxtim wxtim force-pushed the fix.install_broken_symlinks_in_directories branch from be40402 to 554a546 Compare November 4, 2025 13:58
@wxtim wxtim force-pushed the fix.install_broken_symlinks_in_directories branch from a4984c3 to e0ae6c3 Compare November 4, 2025 14:14
``~/.ssh/config`` to specify the user ID for logging into ``HOST``
if required.

.. note::
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this could probably use a larger re-write, but simply getting this bit of info into the docs is a start.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was no prior unit testing at all for this module.

run_pass "${TEST_KEY_BASE}-git" rose app-run --config=../config
file_grep_fail "${TEST_KEY_BASE}-git.err" \
"No such file" \
"${TEST_KEY_BASE}-git.err"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally there should be an SVN test here too.

@wxtim wxtim force-pushed the fix.install_broken_symlinks_in_directories branch from 8a6fc88 to b13feb6 Compare November 4, 2025 16:55
Comment on lines +74 to +81
if os.path.islink(source) and not os.path.exists(source):
# If the source is a broken link within a directory
# install without failing (unlike a single file)
checksum = os.path.realpath(source)
mode = os.lstat(source).st_mode
else:
checksum = checksum_func(source, name)
mode = os.stat(os.path.realpath(source)).st_mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When installing directories using Git or Rsync broken symlinks will be copied.

This change targets the get_checksum function in general, not the git / rsync methods specificity.

Are we sure this method is only called for these methods, or should we pass the method name through to this function to ensure this logic is only activated when intended?

Also, this impacts Git, does it also impact SVN?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this method is only called for these methods, or should we pass the method name through to this function to ensure this logic is only activated when intended?

I think that it makes sense to be consistent. The only other place this logic is used is Rose arch. I think it makes sense there too.

Also, this impacts Git, does it also impact SVN?

I hope so - I would have tested it (and still can if you insist) but setting up the test would have taken extra time.

@dpmatthews - what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should (and does) apply to all cases including SVN (I've tested this)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oliver-sanders please resolve if you're happy...

Copy link
Contributor

@ChrisPaulBennett ChrisPaulBennett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wxtim wxtim requested a review from dpmatthews November 25, 2025 10:32
Add some documentation

a little more unit test coverage of some of  this

Update rsync_remote_check.py

Response to review
@wxtim wxtim force-pushed the fix.install_broken_symlinks_in_directories branch from 2acf76f to e2e9a69 Compare November 25, 2025 13:43
@wxtim wxtim merged commit 49b96c9 into metomi:master Nov 26, 2025
13 checks passed
@wxtim wxtim deleted the fix.install_broken_symlinks_in_directories branch November 26, 2025 11:16
@wxtim wxtim added this to the 2.6.x milestone Nov 26, 2025
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.

Fileinstall fails if installing broken link

4 participants