Conflicting file path assertions in `delegate()` and `add_paths()`
See original GitHub issueDescription of issue or feature request:
Related to #957
The Targets.delegate()
method fails if one of the file paths or patterns passed via the paths
argument is absolute, i.e. starts with a directory separator. At the same time it warns if it the path does not have self._targets_directory
as prefix, which very well may be an absolute path.
The Targets.add_paths()
methods emits a similar message (with debug level). Note that the method does not check whether the passed paths have a leading directory separator, although it should, in order to be consistent with above function.
Current behavior:
Targets.delegate()
andTargets.add_paths()
emit warning/debug message if a passed path or path pattern is not prefixed with the targets directory base path, i.e.self._targets_directory
.Targets.add_paths
does not check if the passed paths are indeed relative.
Expected behavior:
Either,
Targets.delegate()
andTargets.add_paths()
should not care about the prefix of the passed paths or path patterns.Targets.add_paths
should probably assert that the passed paths are relative, to be consistent with the sibling the corresponding functionality ofdelegate()
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
conflicting files on the build path - java - Stack Overflow
t seems to me that the two slf4j*.jar files cause the conflict. I tried to remove one jar file from the built path....
Read more >Diff - 63fab7f6fe..c092e144b5 - chromium/src - Git at Google
The user selects this to verify their identity on a web site (i.e. sign in) using a Security Key (an external physcial device...
Read more >pytest Documentation - Read the Docs
The first test passed and the second failed. You can easily see the intermediate values in the assertion to help you under-.
Read more >BuildXL/SandboxedProcessPipExecutor.cs at main - GitHub
Path.Combine(SpecialFolderUtilities.GetFolderPath(Environment. ... Combine(GetStandardDirectory(), file. ... Assert(ShouldSandboxedProcessExecuteInVm);.
Read more >Solved: Resolve conflicts - Missing file problem - NI Community
Solved: Any ideas on how to resolve the conflicts below? I've tried: Unloading the broken VI and reloading it with the correct path....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also just saw that I didn’t suggest an expected behavior for the other issue, i.e. the warning/debug messages on
not path.startswith(targets_directory)
.I strongly suggest to remove them, because if a PATHPATTERN does indeed start with a targets directory, I think, it won’t even match TARGETPATHs, as they explicitly leftstrip the targets directory, see e.g.
add_target
: https://github.com/theupdateframework/tuf/blob/409eef1a4872a88b610e81b375f36b07a8e0f996/tuf/repository_tool.py#L1962To make sure we are on the same page, we are not talking about
TARGETPATH
butPATHPATTERN
here. But the specification states something similar:Also, just to double check, do others think raising an exception is reasonable? The spec only recommends relative paths, but IIRC we agreed (theupdateframework/specification#63, theupdateframework/specification#67) that an implementation can be more assertive than the spec in this regard. So I think leaving the strict behavior in
delegate
and adding it toadd_paths
is indeed reasonable.