Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try a temporary directory if the user cache fails #1800

Merged
merged 1 commit into from Apr 5, 2022

Commits on Apr 5, 2022

  1. Try a temporary directory if the user cache fails

    Since commit 58c17f6 ("addr.Suggest should lock a file instead of
    memory"), pkg/internal/testing/addr/manager.go’s init() function tries
    to create a directory using either os.UserCacheDir() or os.TempDir(),
    whichever succeeds first. In many build environments, $HOME is
    non-empty but points to an unusable directory; in such cases,
    os.UserCacheDir() returns an unusable directory, which causes init()
    to panic.
    
    This changes init() to first try os.UserCacheDir(), including creating
    the desired directory; if that fails, the whole operation is tried
    again with os.TempDir().
    
    Signed-off-by: Stephen Kitt <skitt@redhat.com>
    skitt committed Apr 5, 2022
    Copy the full SHA
    a5708a1 View commit details
    Browse the repository at this point in the history