Skip to content

Conversation

@bertsky
Copy link
Collaborator

@bertsky bertsky commented Jan 29, 2026

fixes #1213

@bertsky bertsky requested review from MehmedGIT and kba January 29, 2026 11:26
Copy link
Contributor

@MehmedGIT MehmedGIT left a comment

Choose a reason for hiding this comment

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

I have not tested separately with my ocrd network configuration when reviewing. However, if the workspace paths resolve correctly with your network configuration, that should be good enough to be merged. After the new core release, I will still have to verify with the Operandi setup afterwards.

EDIT: To fix the single failing error, it should suffice to just remove the first 6 characters from the test string in this line.

file_dict['local_filename'] = srcpath.name # will be copied-in below

destpath = Path(workspace.directory, file_dict['local_filename'])
if srcpath != destpath and not destpath.exists():
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the ambiguity has already been resolved, could we use an underscore for src_path and dest_path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The diff will become bigger, but sure... (I'll wait for @kba first, though)

args=["ocrd", "workspace", "-U", f"{mets_server_url}", "-d", f"{ws_dir_path}", "server", "start"],
stdout=open(file=log_file, mode="w"), stderr=open(file=log_file, mode="a"), cwd=ws_dir_path,
stdout=open(file=log_file, mode="w"), stderr=open(file=log_file, mode="a"),
#cwd=ws_dir_path, # rs: if relative, this will cause wrong path resolution in the subprocess
Copy link
Contributor

Choose a reason for hiding this comment

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

Good point! Potentially setting the current working directory to workspace directory path was the only way to make it work without changing/fixing the Workspace class itself or the workspace CLI. However, that had other side effects leading to a different bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, could well be. The workspace CLI was obviously not tested enough for the case WS ≠ WD.

In fixing add and bulk-add, I hope I caught that. (But should add tests also.)

What still remains are the long-standing issues with clone (#1149) and find --download (#809).

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.

ocrd workspace: file paths should be made relative to self.directory

2 participants