Linuxbrew / brew

:beer::penguin: The Homebrew package manager for Linux
https://linuxbrew.sh
BSD 2-Clause "Simplified" License
2.66k stars 237 forks source link

brew update is broken due to donation note #820

Closed xu-cheng closed 6 years ago

xu-cheng commented 6 years ago

Please fill out the issue checklist below and provide all the requested information.

If the system git is too old, brew update will report the errors similar to the below.

 $ brew update
==> Linuxbrew is run entirely by unpaid volunteers. Please consider donating:                                                                     
  https://github.com/Linuxbrew/brew#donations                                                                                                     
error: unknown option `local'                                                                                                                     
usage: git config [options]                                                                                                                       

Config file location                                                                                                                              
    --global              use global config file                                                                                                  
    --system              use system config file                                                                                                  
    -f, --file <FILE>     use given config file                                                                                                   

Action                                                                                                                                            
    --get                 get value: name [value-regex]                                                                                           
    --get-all             get all values: key [value-regex]                                                                                       
    --get-regexp          get values for regexp: name-regex [value-regex]                                                                         
    --replace-all         replace all matching variables: name value [value_regex]                                                                
    --add                 adds a new variable: name value                                                                                         
    --unset               removes a variable: name [value-regex]                                                                                  
    --unset-all           removes all matches: name [value-regex]                                                                                 
    --rename-section      rename section: old-name new-name                                                                                       
    --remove-section      remove a section: name                                                                                                  
    -l, --list            list all                                                                                                                
    -e, --edit            opens an editor                                                                                                         
    --get-color <slot>    find the color configured: [default]                                                                                    
    --get-colorbool <slot>                                                                                                                        
                          find the color setting: [stdout-is-tty]                                                                                 

Type                                                                                                                                              
    --bool                value is "true" or "false"                                                                                              
    --int                 value is decimal number                                                                                                 
    --bool-or-int         value is --bool or --int                                                                                                
    --path                value is a path (file or directory name)                                                                                

Other                                                                                                                                             
    -z, --null            terminate values with NUL byte                                                                                          

Error: Failure while executing; `git config --local --replace-all homebrew.donationmessage true` exited with 129.           

This will only happen if the system git is too old to support --local flag. Noted that due to the Homebrew path filtering, brew update-report cannot find the brew git.

To workaround the issue, one can set HOMEBREW_NO_ENV_FILTERING=1. As for the fix, I would suggest:

My brew config:

$ brew config
HOMEBREW_VERSION: 1.7.1-356-gc918fcc
ORIGIN: https://github.com/Linuxbrew/brew.git
HEAD: c918fcc1d954078f54a3475dcacc99377ec9b745
Last commit: 15 hours ago
Core tap ORIGIN: https://github.com/Linuxbrew/homebrew-core
Core tap HEAD: c82d598bc313e228592f283b88bf163635a9f215
Core tap last commit: 16 minutes ago
HOMEBREW_PREFIX: /home/comp/chengxu/usr
HOMEBREW_REPOSITORY: /home/comp/chengxu/usr
HOMEBREW_CELLAR: /home/comp/chengxu/usr/Cellar
HOMEBREW_CACHE: /tmp/chengxu/cache/homebrew
HOMEBREW_BOTTLE_DEFAULT_DOMAIN_LINUX: https://linuxbrew.bintray.com
HOMEBREW_BOTTLE_DEFAULT_DOMAIN_MACOS: https://homebrew.bintray.com
HOMEBREW_DEVELOPER: true
HOMEBREW_FORCE_VENDOR_RUBY: true
HOMEBREW_LOGS: /tmp/chengxu/cache/homebrew/logs
HOMEBREW_NO_ANALYTICS: true
HOMEBREW_NO_AUTO_UPDATE: true
HOMEBREW_SANDBOX: true
CPU: 24-core 64-bit westmere
Homebrew Ruby: 2.3.7 => /home/comp/chengxu/usr/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 6.0 build 601
Git: 2.18.0 => /home/comp/chengxu/usr/bin/git
Curl: 7.19.7 => /usr/bin/curl
Java: N/A
Kernel: Linux 2.6.32-754.el6.x86_64 x86_64 GNU/Linux
OS: CentOS release 6.10 (Final) (Final)
Host glibc: 2.14
/usr/bin/gcc: 4.4.7
glibc: 2.23
gcc: 5.5.0_4
xorg: 20170115
sjackman commented 6 years ago

Thanks for the bug report! Here's a quick fix PR https://github.com/Linuxbrew/brew/pull/821 which removes --local. The better solution is as you say is to use shims/scm/git.

xu-cheng commented 6 years ago

Thanks again for the fixing.

sjackman commented 6 years ago

No worries. Thanks for the bug report!