Azure / Azure/homebrew-functions

Allow for non-admin installs where brew can only be run by another user

Open
#13 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
16
Forks
30
Avg merge
56m
Merged PRs (30d)
1

Description

The extension just tried to self-upgrade, and failed because `brew upgrade azure-functions-core-tools` gave the following output:

```
Updating Script templates for runtime "~2" to version "2.11.1"...
Successfully updated templates.
Updating .NET templates for runtime "~2" to version "2.11.1"...
Successfully updated templates.
Running command: "brew upgrade azure-functions-core-tools"...
Error: /usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
sudo chown -R $(whoami) /usr/local/Cellar
Error: The following directories are not writable by your user:
/usr/local/Cellar
/usr/local/Frameworks
/usr/local/Homebrew
/usr/local/bin
/usr/local/etc/bash_completion.d
/usr/local/include
/usr/local/lib/pkgconfig
/usr/local/lib/python3.7/site-packages
/usr/local/opt
/usr/local/share/aclocal
/usr/local/share/doc
/usr/local/share/locale
/usr/local/share/man/man1
/usr/local/share/man/man2
/usr/local/share/man/man3
/usr/local/share/man/man4
/usr/local/share/man/man5
/usr/local/share/man/man6
/usr/local/share/man/man7
/usr/local/share/man/man8
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew/linked
/usr/local/var/homebrew/locks
/usr/local/var/log

You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/Cellar /usr/local/Frameworks /usr/local/Homebrew /usr/local/bin /usr/local/etc/bash_completion.d /usr/local/include /usr/local/lib/pkgconfig /usr/local/lib/python3.7/site-packages /usr/local/opt /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/locale /usr/local/share/man/man1 /usr/local/share/man/man2 /usr/local/share/man/man3 /usr/local/share/man/man4 /usr/local/share/man/man5 /usr/local/share/man/man6 /usr/local/share/man/man7 /usr/local/share/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/linked /usr/local/var/homebrew/locks /usr/local/var/log
```

This is normal in my case because I _never_ run _any_ `brew` command under my own user account (I only run non-App Store installers and `brew` under an admin account), but needs to be handled correctly, because even though it is (sadly) common practice for Mac users to run everything under admin accounts, using that as an install/upgrade assumption will break things for those of us who are more careful about security.

The ask here is that the non-admin scenario be taken into account, and (hopefully) the way it's handled become a standard practice for this and other extensions.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the self-upgrade entry point that runs `brew upgrade azure-functions-core-tools` and inspect the Homebrew formula for its assumptions about the invoking user. Verify the change against an install where brew is run by another user, and consider the issue done when non-admin installs no longer fail because Homebrew paths are unwritable.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.