Fix Windows FileLike path resolution for background R report outputs#7524
Open
labkey-bpatel wants to merge 3 commits intodevelopfrom
Open
Fix Windows FileLike path resolution for background R report outputs#7524labkey-bpatel wants to merge 3 commits intodevelopfrom
labkey-bpatel wants to merge 3 commits intodevelopfrom
Conversation
| FileLike substitutionMap; | ||
|
|
||
| if (reportDir.getName().equals(getJobIdentifier())) | ||
| String reportDirName = reportDir.toNioPathForRead().getFileName().toString(); |
Contributor
There was a problem hiding this comment.
Everywhere we explicitly try to escape from the given FileSystemLike really needs a comment.
It would be preferable, if possible, to pass in the the required parent FileSystemLike (either as a parameter or as a new method provided by the report).
Contributor
Author
There was a problem hiding this comment.
Now updated, please review.
| // clean up the destination folder | ||
| for (FileLike file : parentDir.getChildren()) | ||
| { | ||
| if (!file.isDirectory() && !"log".equalsIgnoreCase(FileUtil.getExtension(file))) |
Contributor
There was a problem hiding this comment.
existing code, but file.isFile() seems better than !file.isDirectory()
…e caller already have the right path.
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.
Rationale
Test failure: https://teamcity.labkey.org/buildConfiguration/LabKey_263Release_Premium_CommunitySqlserver_DailyASqlserver/3903944?buildTab=tests&status=failed&name=DataReportsTest.doRReportsTest&expandedTest=build%3A%28id%3A3903944%29%2Cid%3A2000000031
This failure revealed an underlying path-resolution bug: on Windows, FileLike’s internal LabKey Path was getting malformed because Path.parse() was fed a backslash-separated string (resulting in report dir path like so: /reports_temp/851e5acd-09f3-103f-a81c-b7028cf24fe8\Report_db_182\46502904-09f4-103g-a81c-b6028cf24fe8).
FileLike's getName() and getParent() were therefore computing against the wrong path.
Related Pull Requests
Changes