From 41f919eb86a3b1f69876f8b97572615b06521538 Mon Sep 17 00:00:00 2001 From: Patrick Bajao Date: Thu, 15 Aug 2019 18:06:04 +0800 Subject: Replace symlinks with actual binaries We had `gitlab-shell-authorized-keys-check` and `gitlab-shell-authorized-principals-check` as symlinks to `gitlab-shell` before. We determine the `Command` and `CommandArgs` that we build based on the `Name` of the `Executable`. We also use that to know which fallback ruby executable should we fallback to. We use `os.Executable()` to do that. `os.Executable()` behaves differently depending on OS. It may return the symlink or the target's name. That can result to a buggy behavior. The fix is to create binaries for each instead of using a symlink. That way we don't need to rely on `os.Executable()` to get the name. We pass the `Name` of the executable instead. --- go/internal/executable/executable_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'go/internal/executable/executable_test.go') diff --git a/go/internal/executable/executable_test.go b/go/internal/executable/executable_test.go index 4d2174b..581821d 100644 --- a/go/internal/executable/executable_test.go +++ b/go/internal/executable/executable_test.go @@ -59,7 +59,7 @@ func TestNewSuccess(t *testing.T) { fake.Setup() defer fake.Cleanup() - result, err := New() + result, err := New("gitlab-shell") require.NoError(t, err) require.Equal(t, result.Name, "gitlab-shell") @@ -96,7 +96,7 @@ func TestNewFailure(t *testing.T) { fake.Setup() defer fake.Cleanup() - _, err := New() + _, err := New("gitlab-shell") require.Error(t, err) }) -- cgit v1.2.1