4 ms·
What else should the test runner do?
by blueflow 2y ago
What else should the test runner do?
- pasc1878 2y agoUse the full path of sl and not rely on $PATH in the same way cron and macOS GUI apps do for I assume this exact reason.
- stonegray 2y agoIs the full path guaranteed? For example homebrew, snap, and apt might put it all in different places. $PATH is a useful tool.
- deleted 2y ago[deleted]
- pasc1878 2y agoBut not in this case where you have two executables with the same name. You have to know where the tool was installed or else be certain no other sl is on your path.
- charcircuit 2y agoFinding the full path of sl requires looking at $PATH
- pasc1878 2y agoIn this case not as then you find the wrong sl - you need to know where the correct sl was installed.
- skipants 2y agoWhat if the full path is just `/usr/bin/sl`?
- pasc1878 2y agoThen yopu get the sl there which could be correct.
- Joker_vD 2y agoHow would knowing the full path help you anyway? It's either in "/usr/bin/sl", or "/usr/local/bin", or "~/.local/bin", now what? By the way, believe it or not, POSIX compliance requires existence of only two directories (/dev and /tmp) and three files (/dev/console, /dev/null, and /dev/tty) on the system; everything else is completely optional, including existence of /bin, /etc, and /usr.
- pasc1878 2y agoBecause you know what you installed and so which sl to use.
- Joker_vD 2y agoBut the sl is not invoked by you. It is invoked by some npm module (a 5-times-removed dependency from any side) which hopes that either there is "sl" in the $PATH and it is the Sapling CLI, or there is no "sl" in the $PATH. This module can't use absolute paths because it does not know how the end user's system looks.
- pasc1878 2y agoIn that case it is a large security risk as well as it does not work as per the article
- Joker_vD 2y agoA program invoking some other the program that the user themself consciously have installed on their system (and put into the PATH) is not a security risk per se, it's literally UNIX Way™ working as intended.
- pavel_lishin 2y agoThere must be a better way to tell if a repo is a Sapling repo than by running some arbitrary binary, right?
- Symbiote 2y agoFor Git one could look for .git/config. There must be something equivalent.
- remram 2y ago.git will be a file and not a directory, if you are in a submodule or a worktree. You just illustrated why trying to assume the functionality of a third-party app instead of calling it creates even more bugs.