-
Notifications
You must be signed in to change notification settings - Fork 6
Fix bugs in resolve_path() #1238
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
Conversation
Due to the fact we have to have (for our tools) ./ ahead of other paths (including the tool names themselves) and also allow for a user to specify a path (even a bogus one, which if they do we will look for a proper path) and also search for installed paths, a more careful check has to be done in the find_utils() functions as otherwise it does not work when out of the repo directory. Sync copyright fixes from jparse.
Force set nul_warning to false in mkiocccentry(1) and disable checking of it in chkentry(1). Post IOCCC28 it will be removed from struct info, the .info.json files and chkentry(1) that checks it. Rather than directly put in true in the writing of the .info.json file, force set first_rule_is_all to true in mkiocccentry(1) and reference that boolean in the writing of the .info.json file.
A couple bugs in the resolve_path() function ended up requiring an extra check in find_utils() per util in order to get it to find the utils even outside the directory: even if one had ./ or / in front of the path it could end up resolving a path that is not a regular executable file (when it did not have a / in the path this did not happen). Another bug was fixed where if $PATH is NULL or empty and the path is not a regular executable file it still would be a strdup()d copy of the original path. The above solved a problem where we could get the tools to be found (if they exist) if we also did a check for is_file() and is_exec() but with the above fixes we only have to check for != NULL. The find_utils() functions now takes a corresponding bool * for each tool to find. If the boolean is not NULL then we search for that tool. I it is NULL and the char ** is not NULL then we set the *tool to NULL. This way the caller can, if they wish and they are careful, decide whether or not to find all the tools. For example txzchk only looks for tar if test mode is not enabled. And although as a safety check before free()ing the pointer we do check that test mode was not used we do not technically need it as long as we pass in &tar (although we do give NULL so we do need to check it).
Now before you make a new release: should the versions be updated? You could test it on your end (tests of version checks worked on my end). If they work as expected then we could update the guidelines and FAQ to say that if the tools are installed they can use the tools there shouldn't be any problems as long as it's in their path (or in the repo directory if they wish). I leave this up to you. I know I do have to update the guidelines and maybe FAQ about the warnings recently disabled but I won't get to that today - have other things I need to do. I can do that 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.
👍
QUESTIONWhich versions are you suggesting be updated? BTW: We did fix the repo version in |
Well: mkiocccentry and chkentry: since those tools no longer check for certain things AND since mkiocccentry now searches under If we do that we could also do |
Please make those version changes that you deem appropriate. However, please note the repo version changes to |
Thanks. Will do once you address the below question.
In other words don't change it? Or something else? That was my fault. I thought I had pulled changes prior to sequencing exit codes. I already fixed it. |
Perhaps it would be worthwhile for you, @xexyl, to change the versions for As we are away from our computer keyboard (where can check or make any related test changes that might be needed), please make and test the above mentioned version changes @xexyl if you please. |
I have to think of another way to test it. Will think on it. I do know i tested it before though by manually updating the versions: before and earlier and the same and all was good. I guess I'll do that again after changing the versions. |
Done. |
A couple bugs in the resolve_path() function ended up requiring an extra
check in find_utils() per util in order to get it to find the utils even
outside the directory: even if one had ./ or / in front of the path
it could end up resolving a path that is not a regular executable file
(when it did not have a / in the path this did not happen). Another
bug was fixed where if $PATH is NULL or empty and the path is not a
regular executable file it still would be a strdup()d copy of the
original path.
The above solved a problem where we could get the tools to be found (if
they exist) if we also did a check for is_file() and is_exec() but
with the above fixes we only have to check for != NULL.
The find_utils() functions now takes a corresponding bool * for each
tool to find. If the boolean is not NULL then we search for that tool. I
it is NULL and the char ** is not NULL then we set the *tool to
NULL. This way the caller can, if they wish and they are careful, decide
whether or not to find all the tools. For example txzchk only looks
for tar if test mode is not enabled. And although as a safety check
before free()ing the pointer we do check that test mode was not used we
do not technically need it as long as we pass in &tar (although we do
give NULL so we do need to check it).