Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.87k stars 9.59k forks source link

Suddenly a Frameworks dir is being created even though nothing uses it. #4877

Closed chdiza closed 6 years ago

chdiza commented 6 years ago

To my surprise, my HOMEBREW_PREFIX now contains a Frameworks dir, even though it's empty and nothing I brew (or ever have brewed) uses such a thing. This dir should only be created if it's needed.

If I delete it, it comes back sometime later automatically during some install step---even if the installed thing does not and could not use such a dir (e.g., markdown). But if I first run doctor, I get the following:

Warning: The following directories do not exist:
/usr/local/Frameworks

You should create these directories and change their ownership to your account.
  sudo mkdir -p /usr/local/Frameworks
  sudo chown -R $(whoami) /usr/local/Frameworks

No, I should not. The dir's absence is not a problem, its presence is irritating, and that dir should not be auto-created by install (unless the formula I'm installing needs it).

That doctor check should only complain if I already have a Frameworks dir but it has the wrong permissions.

brew config
HOMEBREW_VERSION: 1.7.4-8-ga1fd93a
ORIGIN: https://github.com/Homebrew/brew
HEAD: a1fd93aacea37bbc234d347e3e5089f22846be18
Last commit: 26 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 969f49df56e2749badf92d913a1ea79fa04dab2e
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/hb
HOMEBREW_CACHE: /stuff/brache
HOMEBREW_TEMP: /Users/chdiza/.tmp/tmpdir
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_GIT: git
HOMEBREW_LOGS: /Users/chdiza/Library/Homebrew
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_EMOJI: 1
HOMEBREW_NO_GITHUB_API: 1
CPU: quad-core 64-bit ivybridge
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.1 build 902
Git: 2.19.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: N/A
macOS: 10.13.6-x86_64
CLT: 9.4.1.0.1.1528165917
Xcode: 9.4.1
XQuartz: N/A
$ brew doctor
Your system is ready to brew.
chdiza commented 6 years ago

Bisection reveals:

7615d3a8121a251dc747ddcbe3e040ddf64963d6 is the first bad commit
commit 7615d3a8121a251dc747ddcbe3e040ddf64963d6
Author: Mike McQuaid <mike@mikemcquaid.com>
Date:   Thu Sep 6 18:38:43 2018 +0100

    Improve writable directory handling

    Consolidate the handling of which directories need to exist and which
    need to be writable. Additionally, add a fatal check for formula
    installations to ensure that any directories that need to be writable
    are so before attempting an installation.

    Fixes #4626.
MikeMcQuaid commented 6 years ago

@chdiza This is intentional, I'm afraid. This directory is created by the installer and (as demonstrated by the linked issue) this is much more graceful than failing hard when it's created at install time.

chdiza commented 6 years ago

Fair enough. I still think the doctor is being overzealous here: why tell me to create the dir, when brew is going to automatically create it the instant I try to install anything? There is thus zero danger that the dir will fail to exist before it's needed, and there no need for me to do anything.