-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize package paths to always contain a trailing slash #5178
Normalize package paths to always contain a trailing slash #5178
Conversation
This seems fine to me in principle, but I'll be honest I've never used |
3246d8a
to
199104c
Compare
Background: I use
Done! |
e64f523
to
f5fe757
Compare
tst/testinstall/package.tst
Outdated
@@ -640,5 +640,21 @@ false | |||
gap> IsPackageLoaded("mockpkg", ">=2.0"); | |||
false | |||
|
|||
# now add `tst` as a new root directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not do this, nor add tst/pkg
. Instead, we could create a temporary directory somewhere, then add a pkg
subdir into it and into that a symlink to mockpkg
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions:
- Can we rely on
IO_symlink
in the test? If not, I guess things might get messy. - What about Windows, would
IO_symlink
work there? Or can we somehow exclude this test on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In simple terms, you can assume everything unixy will work in Windows. I'll be sure to double check any test, but I just tried and IO_symlink works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not rely on IO_symlink
, which may not always be available (if IO
is not compiled). You could simply use Exec("ln -sf FOO BAR")
, or if you want to be able to detect errors, then use Process
(and if anyone wants a nicer alternative, comment on #5103 ???)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed a solution using Exec
. If an error occurs, ValidatePackageInfo
right after the Exec will fail saying that the file is not readable, so I think there is no need for an additional error check .
4588319
to
b2a4e4a
Compare
b2a4e4a
to
443e1ae
Compare
SetPackagePath
always appends a trailing "/" to the installation path of a package whileAddPackageInfos
did not before this PR. This could lead to the following error:i.e. an error is signaled because the installation path differs by a trailing slash.
This PR does two things to prevent this:
AddPackageInfos
to also include a trailing slash.Directory
in the comparison which triggers the error.Both changes would fix the error on their own, but I think both are sensible in general:
pkgpath
is a user input, so normalizing it is a good idea anyway (as users might enter paths including "~" or with or without trailing slashes).Text for release notes
none