Skip to content
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

fix relative install path for updating packages #13

Closed
wants to merge 1 commit into from
Closed

fix relative install path for updating packages #13

wants to merge 1 commit into from

Conversation

payonel
Copy link

@payonel payonel commented Jul 11, 2015

When oppm updates a package it searches for any existing file from the package that is still defined in the package install definition. The purpose of the code is then to remove the destination path suffix so as to leave the original relative path used by the user, in case it wasn't simply /usr (default).
gsub is used to remove the install path suffix, but the given string is the installed file path string and thus the regular expression needs to remove the file name from the path. My solution is to include any non / chars from the end of the string. This should leave the relative path root used in the original install.
Note however that this is not a completely safe expectation. If the pkg owner changes the install path completely on an existing repo file, this code would assume gsub would have removed a part of the path that no longer would exist. For this purpose I've added the matches count check. Note also that it is possible that not a single file in the pkg still matches the previous path endings. In this case, /usr would be used and it is possible that the pkg would install twice in two separate paths (in case the user specified a custom install path a previous time). It's rather low risk, but I thought I'd point it out.

When oppm updates a package is search for any existing file from the package that is still defined in the package install definition. The purpose of the code is then to remove the destination path suffix so as to leave the original relative path used by the user, in case it was simply /usr (default).
gsub is used to remove the install path suffix, but the given string is the installed file path string and thus the regular expression needs to remove the file name from the path. My solution is to include any non / chars from the end of the string. This should leave the relative path root used in the original install.
Note however that this is not a completely safe expectation. If the pkg owner changes the install path completely on an existing repo file, this code would assume gsub would have removed a part of the path that no longer would exist. For this purpose I've added the matches count check. Note also that it is possible that not a single file in the pkg still matches the previous path endings. In this case, /usr would be used and it is possible that the pkg would install twice in two separate paths (in case the user specified a custom install path a previous time). It's rather low risk, but I thought I'd point it out.
@Vexatos
Copy link
Contributor

Vexatos commented Jul 12, 2015

Closing this as discussed on IRC.

@Vexatos Vexatos closed this Jul 12, 2015
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