Skip to content

Commit

Permalink
Rename biome keychain to login instead of yb
Browse files Browse the repository at this point in the history
Cherry-pick of 6ec6c9d.

There are many tools that seem to hardcode "login" as the name of the
default keychain, and it would be better to have a default that is
compatible rather than try to be different for the sake of shaking out
code relying on implicit interfaces.

[Updates ch4145]
  • Loading branch information
zombiezen committed Mar 8, 2021
1 parent 4b21fd7 commit 2a0cedf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ The format is based on [Keep a Changelog][], and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[Keep a Changelog]: https://keepachangelog.com/en/1.0.0/
[Unreleased]: https://github.com/yourbase/yb/compare/v0.5.7...HEAD
[Unreleased]: https://github.com/yourbase/yb/compare/v0.5.8...HEAD

## [0.5.8][] - 2021-03-08

Version 0.5.8 backports a change to the build environment keychain name.

[0.5.8]: https://github.com/yourbase/yb/releases/tag/v0.5.8

### Changed

- On macOS, the empty, default keychain that yb creates will now be called
`login` instead of `yb` for compatibility with more programs.

## [0.5.7][] - 2021-03-01

Expand Down
2 changes: 1 addition & 1 deletion cmd/yb/keychain.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func ensureKeychain(ctx context.Context, bio biome.Biome) error {
keychainList := parseKeychainOutput(stdout.String())

// Create a passwordless keychain.
const keychainName = "yb.keychain"
const keychainName = "login.keychain"
if err := runCommand(ctx, bio, "security", "create-keychain", "-p", "", keychainName); err != nil {
return fmt.Errorf("ensure build environment keychain: %w", err)
}
Expand Down
8 changes: 7 additions & 1 deletion cmd/yb/keychain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"context"
"path/filepath"
"strings"
"testing"

Expand Down Expand Up @@ -72,8 +73,13 @@ func TestEnsureKeychain(t *testing.T) {
if err != nil {
t.Error("security default-keychain:", err)
}
if len(parseKeychainOutput(stdout.String())) == 0 {
if keychains := parseKeychainOutput(stdout.String()); len(keychains) == 0 {
t.Error("No default keychain set")
} else if got, want := keychains[0], "login.keychain-db"; filepath.Base(got) != want {
// Many tools depend on the default keychain name being "login", so turn the
// implicit interface into an explicit test.
// See https://app.clubhouse.io/yourbaseio/story/4145 for more details.
t.Errorf("default keychain = %q; want name to be %q", got, want)
}

// Verify that running multiple times does not return an error and does not
Expand Down

0 comments on commit 2a0cedf

Please sign in to comment.