-
Notifications
You must be signed in to change notification settings - Fork 32
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
added fix for findutilsport #575
added fix for findutilsport #575
Conversation
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.
This might be a difference between /bin/sed and our sed so to be safe you may want to also say /bin/sed ?
Hmm, I was just making a change to all the sed occurances in the file and going to make it ie hermetic build thing. Then I thought I should clarify with you, how do you want to do that? Or, perhaps do in a follow up issue. ie. this patch fixes the zopen install findutilsport problem where the strip port does nto work. Then do a separate patch to ensure sed is from zopen rather than USS default sed. If I file as an issue, I can always revisit. I'm kind of thinking gnport is higher priority. |
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.
The code here is meant to do an up-front check to make sure that the port prefix (whether followed by a version, tag or "port") is valid. Further processing within handlePackageInstall uses that additional information for searching for versioned/tagged releases so stripping that now [ie passing toolrepo] will break that processing later.
The actual fix needs to be in handlePackageInstall()
name=$(echo "${fullname}" | sed -e 's#[=%].*##')
repo="${name}" <- this should have the "${name%port}" expansion
The twin parsing is so that the list of supplied packages can be parsed first; if the check is only done in the second instance, then you might have a number of packages specified and it would only be after installing all the previously "well specified" packages that you'd find the broken one.
The sed should probably use the zossed function [which maps to /bin/sed] - we don't want to hardcode the use of any zopen "sed" as that might not be installed...
Now that we rely on the zopen_releases.json cache (which doesn't have a port) suffix, the code to handle projects ending with port was removed. I'm fine with adding that support back in. Do you get different results with zopen sed vs /bin/sed? The regex doesn't seem overly complex here so I doubt it will differ. We would we need to embed sed as we do with curl and jq if we wanted to go this route. |
fwiw, this is the code in
and then later this in there
I don't know all the variants for testing installs. (Do we have a unit test for install options?). So I was conjecturing in the comments above. The second test in the original comment shows that the .*port is not stripping "port", but instead stripping all text ending in port. Consquently, why I simply removed the match all bit. In the second stanza, it seems its another bug. Its "stripping" text, but then the installarray adds the original non stripped entry. I was thinking the point of this code is to strip info and then add the stripped version to the list of repo's to install. Based upon the comments I'm doubly confused now.
|
Nope, not dead code - it's an initial sanity check that what was specified on the command line correlates to a valid package name before handing it off to more specialized processing later *That being said... as @IgorTodorovskiIBM mentions earlier, the port suffix was dropped from the actual naming of a package so we shouldn't really need to do any stripping of it these days [the version/tag will still be needed at this point]. If a user specifies 'pkgport', it should get rejected as an invalid package, with 'pkg' being the required install parameters. It would solve any issues if ever there was package called something like "export" or "thisport" - so just treat the input as the proper package and not worry about 'port' suffixes. And as for unit testing, there is a framework that Mike put together that we are adding to, but a lot of testing of this type of thing is manual at the moment. [hopefully that makes any sense!] |
The santity check before continuing makes sense. That is why you strip, verify the strip is in the list, but then add back
That is a good point. I'll update the diff to reflect that port could be anywhere in the string and only remove the last entry.
This I'm unclear on. Possibly I understand some portion of it. If a
Ok, so in this case, the conclusion is don't worry about stripping, simply look for the name and if its not a proper repo name, tell them during the sanity check. ie.
return
Having tests would be a great help in this situation.
Yes, DT, it helps. |
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.
We are taking a just in time approach here to improve our quality and testing so when we add new code or fix bugs please add a new test or two.
the testing framework is pretty simple - you add a test to the tests directory that exits with 0 if it works or non zero if it fails.
when I am back give me a shout if you aren’t sure or ask @IgorTodorovskiIBM - he has written at least one
sounds great I’ll work on that with Igor tomorrow |
Here's a simple one for update-cacert: https://github.com/ZOSOpenTools/metaport/pull/16/files. @DevonianTeuchter has added a couple as well recently |
Thanks. I’ll use that as a guide. |
95df89e
to
58aacac
Compare
/run tests |
bin/zopen-install
Outdated
# findutilsport -> findutils | ||
# findutils -> findutils | ||
if [[ "${nameSansPort}" != "${name}" ]] ; then | ||
echo "Usage error: please install using base name without port suffix." |
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.
echo "Usage error: please install using base name without port suffix." | |
echo "Usage error: please install using base project name without port suffix." |
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.
Will do tomorrow
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.
done
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.
LGTM
58aacac
to
4ef395c
Compare
@DevonianTeuchter @MikeFultonDev are you ok with this? @netskink looks like there's a conflict in |
I’ll address on Monday. Thanks for the update |
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.
LGTM
@netskink , regarding @DevonianTeuchter's comment here:
I think what we want here is an upfront error when installing multiple ports. So for example:
Will it install git first and then print the about findutilsport having the port suffix? |
I don't know if it will handle multiple install packages. To be honest I never tired it. I just tried to do things like this:
The original code never seemed to match. The subsquent comparison clause was never hit. ie if x==y where y was the result of the sed, was always blank for y. FWIW, I removed the code in the clause and moved it to the top of the file since you said the first check was a sanity check. What remains at the bottom was based upon your request to collect the matching group. I can test to see what multiple install packages do, but to be honest I believe this change is way over due and beyond the original objective. I propose we merge this one and raise a new issue. Fix one issue at a time and move on. I'm all for collaboration and am happy to adjust accordingly. Please don't let my ability to talk be taken negative. I just want to drive this to completion. |
exercise with code in patch pull request presentUsing the patch plus some debug code:
TestsTry with port suffix added
Try with just repo name specified
Trying with some unknown repo and port suffix
Trying with some unknown repo
exercise without patch present
TestsTry with port suffix added
Try with just repo name specified
Trying with some unknown repo and port suffix
Trying with some unknown repo
I'm not certain what the first clause is doing, but without the group, the toolrepo is mostly blank. I thought this would at least provide a response. I looked to verify the if = clause check vs if ==, this is indeed the original code. I'm not certain if its valid or not. If its invalid or needs comment, i propose we move to a new issue. See here |
Regarding the multiple install issueWith the patch in pull request present:
|
with the original code present, it looks like this:
|
with patch present for multiple installs and port suffix added
|
with original code(Note the check at top is still present, just the regex with sed grouping is not)
|
Igor, regarding:
Yes.
|
Ok, thanks for verifying. Let's open an issue to track that. I'll merge this PR in the meantime. |
Thanks for merging. Good idea on a new PR. Please assign to me since I don’t quite follow what is the follow up problem. A fresh issue should convey the remaining issue. |
This is a fix for this bug #567
It appears the original code was attempting to strip strings but it did not work. Here is some explantion.
@MikeFultonDev @DevonianTeuchter