Skip to content

Fix Windows FileLike path resolution for background R report outputs#7524

Open
labkey-bpatel wants to merge 3 commits intodevelopfrom
fb_rreport_files
Open

Fix Windows FileLike path resolution for background R report outputs#7524
labkey-bpatel wants to merge 3 commits intodevelopfrom
fb_rreport_files

Conversation

@labkey-bpatel
Copy link
Contributor

@labkey-bpatel labkey-bpatel commented Mar 25, 2026

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

  • Fix R report output directory resolution
  • Add debug logs

FileLike substitutionMap;

if (reportDir.getName().equals(getJobIdentifier()))
String reportDirName = reportDir.toNioPathForRead().getFileName().toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

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).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now updated, please review.

// clean up the destination folder
for (FileLike file : parentDir.getChildren())
{
if (!file.isDirectory() && !"log".equalsIgnoreCase(FileUtil.getExtension(file)))
Copy link
Contributor

Choose a reason for hiding this comment

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

existing code, but file.isFile() seems better than !file.isDirectory()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

2 participants