Repository navigation
Warn about other rec commands instead of refusing to install - #53
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
The installer stopped whenever any other `rec` was on PATH. On macOS that name also belongs to the recorder in SoX, which Homebrew links at /opt/homebrew/bin/rec, so anyone with SoX installed could not install rec without deleting Homebrew's symlink, and `brew reinstall sox` restored the problem. The check also ignored PATH order, and blocked `rec update` on an existing install once another `rec` appeared. The installer never writes outside ~/.local/bin, so another `rec` is no reason to stop. Install as usual, then list the other commands and say how to reach this one. Listing them last keeps the warning in view above the shell prompt, and only reports it for an install that succeeded. The warning does not say which command wins. The current shell and a new terminal can disagree, because the installer's shell configuration line puts ~/.local/bin first for new terminals only. Compare with `-ef` rather than by name, so that PATH spellings such as ~/.local/bin/ are not reported as a conflict with this install. A ~/.local/bin/rec that rec does not manage still stops the install, since replacing it would overwrite another program.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #12.
install.shstopped whenever any otherrecwas on PATH, so anyone with SoX installed through Homebrew could not install rec without deleting Homebrew's symlink. The same check blockedrec updateon an existing install once anotherrecappeared.As discussed in #12, this downgrades that check to a warning that prints the path of each conflicting command. It looks like this after a successful install:
~/.local/bin/recthat rec doesn't manage, because replacing it would overwrite another program.~/.local/binfirst, but only for new terminals.recis now shadowed, which is worth knowing. This follows the "print all conflicting aliases" suggestion in install.sh cannot coexist with SoX's rec command #12, rather than staying silent as the reporter proposed.The
recursivefallback command also proposed in #12 is not included. It would add a second managed link forrec uninstallto handle, and it hasn't been agreed, so I'd rather leave it for a separate change if you want it.Tests
tests/installer_test.pyhas new cases for:recahead of the install, on the first install, on a later update and with--serve, checking that the other program never runsrecbehind the install, with a duplicated PATH entry listed oncerecis this install, including PATH spellings such as~/.local/bin/and~/.local/bin/.install.shonmainwithrec already resolves to .... They also fail if I remove the warning, the deduplication or the|| true, send the warning to stdout, or replace-efwith a string comparison.tests/installer_test.pypasses with macOS's/bin/bash3.2 and with bash 5.2 on Ubuntu. shellcheck and ruff pass.bashon stdin in a PTY, using a local release server, a stand-inrecbinary and a Homebrew-shaped symlink to a stand-in SoXrec:recstill wins in that shell until~/.local/binis added to PATH.~/.local/binfirst runs rec.make test, as no Go or engine code changed. I also didn't test against a real Homebrew SoX install.