Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello.
I love Unison, and have been using it for the past 3 years. Since I like to be able to control my software build process + version, I build Unison from scratch whenever possible. To date, I have built Unison on many different platforms (OSx, FreeBSD, Debian, Ubuntu, Arch Linux, Synology Linux). However, in every build (except OSx, where the 'etags' executable exists), I have encountered the same (non-fatal) error at the very end of the build process:
Despite the build completing successfully, and everything running fine, this error has always bothered me, as the code indicates that the 'etags' executable is not necessary to complete the build of the unison executable. I've tracked down the error to this line of code in the source Makefile.
First, the 'which' command (which is not as portable as 'command' or 'type') will return nothing if the file is not found, which means that '[ -f "" ]' will be the command run, which is both valid and evaluates true. This combination is what yields the error above.
To fix the problem, we can instead interpret the (which, command, or type) executable generating some output to stdout as an indication that the directive exists or executable file is present on the PATH. Our saviour here is the syntax '[ -n "/x/y/z" ]', which tests if the string is not empty. In this case, '[ -n "/some/path/etags" ]' evaluates to true, and we know the command exists and we can proceed to run the etags command. If not, then we instead get '[ -n "" ]', which evaluates false, allowing us to skip.
I've tested this on Ubuntu 16.04 with BASH, and it works fine. Easy peasy. Hopefully you will accept this pull request, as it is pretty straightforward.
Thanks,
Rob