Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of URL SCM issues #552

Merged
merged 19 commits into from
Feb 10, 2024

Conversation

jkloetzke
Copy link
Member

Most importantly, usage of local mirrors should not result in unpredictable checkout results any more.

There was a typo in the switching logic when testing for the
"recurseSubmodules" property. Use the correct spelling. Effectively, the
recurseSubmodules property was not ignored in some cases as it should
have been.
Instead of comparing the recipe specs, compare Scm instances. Otherwise
any newly introduces properties will always show up in the diff. By
comparing parsed Scm instances, the default values of all attributes
will be applied and there should be no false negatives because of older
checkouts that lacked some attributes.
This attribute has no influence on the result.
This attribute has no influence on the result.
The mirrors are only used for deterministic instances. If they change,
the result won't be influenced at all.
If the URL is changed but the hashes are stable, and at least one hash is
set, the result cannot change.
If the copy fails half way, we don't want to retain a corrupt file in
the workspace. In case of a deterministic SCM the copy won't be done
again but the digest check will fail consistently.
The mtime itself is irrelevant for the workspace hash. But if a file is
copied from a local mirror we don't want to get the file a newer mtime
than the source mirror file. Otherwise the mirror will be updated with
the same file again. Likewise, the mirror should get the same file
attributes like the fetched file.
If a file is fetched from remote, it's mode has historically been set to
0600. We must retain this behaviour even if the file is fetched from a
local mirror instead. Otherwise, if the mirror has not the right file
mode, the result will be wrong compared a fetch from the primary URL.
Some SCM properties may have different formats where some are better
readable for humans. Give the SCM a hint how the properties should be
returned.
Allow to set a mode explicitly, regardless of the source file. Without
the mode, remotely fetched files will have a 0600 mode while locally
copied files will retain their mode.
Remove some redundant information to make it more readable. Also explain
what the asterisk means.
Copy link

codecov bot commented Feb 10, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (93af2d1) 88.73% compared to head (47f1bdf) 88.92%.

Files Patch % Lines
pym/bob/scm/git.py 83.33% 2 Missing ⚠️
pym/bob/scm/url.py 96.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #552      +/-   ##
==========================================
+ Coverage   88.73%   88.92%   +0.18%     
==========================================
  Files          46       46              
  Lines       14724    14774      +50     
==========================================
+ Hits        13066    13138      +72     
+ Misses       1658     1636      -22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Historically the URL SCM applies a file mode of 0600 (user
read/write only) to all files that are fetched via HTTP(S) or FTP. For
locally copied files (``file://`` URLs or bare file names) though, the
file mode of the source file is retained. This is both inconsistent and
not predictable for local file because the result will depend on the
source file.

The defaultFileMode policy will enforce a mode of 0600 to all files,
regardless of the origin. This will prevent any accidental checkout
inconsistencies in the future.
It's only detected at runtime if the extractor does not support
stripComponents.
@jkloetzke jkloetzke merged commit 47a0c29 into BobBuildTool:master Feb 10, 2024
11 checks passed
@jkloetzke jkloetzke deleted the url-permissions branch February 10, 2024 22:40
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