Skip to content

Conversation

drgrice1
Copy link
Member

If one of the course links that are now maintained by webwork points to a location inside a non existent directory, then the realpath calls in lib/WeBWorK/Utils/CourseDirectoryIntegrityCheck.pm throw exceptions. This occurs both when checking for course upgrades and when upgrading courses. So those calls are wrapped in evals to prevent the exceptions.

I have identified this as the cause of the issue discussed in https://forums.openwebwork.org/mod/forum/discuss.php?d=8757#p22321.

To test this delete the Contrib link in a course's templates directory, and create a bad link with something like

sudo ln -s /bad/location /opt/webwork/courses/courseId/templates/Contrib

Then go to the "Upgrade Courses" page in the admin course. It will give an error with the current develop or main branches. With this pull request it will show that the link structure of the course needs repair. Furthermore, repairing the link will work.

If one of the course links that are now maintained by webwork points to
a location inside a non existent directory, then the `realpath` calls in
`lib/WeBWorK/Utils/CourseDirectoryIntegrityCheck.pm` throw exceptions.
This occurs both when checking for course upgrades and when upgrading
courses.  So those calls are wrapped in evals to prevent the exceptions.

I have identified this as the cause of the issue discussed in
https://forums.openwebwork.org/mod/forum/discuss.php?d=8757#p22321.

To test this delete the Contrib link in a course's templates directory,
and create a bad link with something like

```bash
sudo ln -s /bad/location /opt/webwork/courses/courseId/templates/Contrib
```

Then go to the "Upgrade Courses" page in the admin course.  It will give
an error with the current develop or main branches.  With this pull
request it will show that the link structure of the course needs repair.
Furthermore, repairing the link will work.
Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

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

Fixes the issue.

Alex-Jordan added a commit that referenced this pull request Aug 20, 2025
…ix-hotfix

Fix a `realpath` failure when resolving course symlinks. (hotfix of #2793)
@Alex-Jordan Alex-Jordan merged commit 495e8ac into openwebwork:develop Aug 20, 2025
2 checks passed
@drgrice1 drgrice1 deleted the directory-integrity-realpath-fix branch August 20, 2025 19:30
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.

3 participants