d12frosted/homebrew-emacs-plus

Could not reinstall with --with-emacs-27-branch

shuxiao9058 opened this issue · 15 comments

Please make sure to follow these steps (and mark the checkboxes):

  • run brew update and try to reproduce the issue again
  • run brew doctor, fix all issues and try to reproduce your issue again
  • run brew config and brew doctor and include their output

What you were trying to do

brew install emacs-plus --with-xwidgets --with-no-frame-refocus --with-modern-icon --with-ctags --with-jansson --with-emacs-27-branch --with-dbus --with-mailutils --HEAD

brew reinstall emacs-plus

What happened (include command output)

$ brew reinstall emacs-plus
Command output

❯ homebrew-emacs-plus (master) ✔ brew reinstall emacs-plus (master|) ✔
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/multicolor-fonts.patch
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/6e0bcfe5f86b21ca9f1bf349995832a6143baac4a74e000dff771b2839b6fa7d--multicolor-fonts.patch
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/patches/fix-window-role.patch

Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/b7046a273c114e23f734df97967f4016486f1d080bad1ba40dbd53a5c86a09e0--fix-window-role.patch
==> Downloading https://s3.amazonaws.com/emacs-mac-port/Emacs.icns.modern
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/bbbdfd42b5362b97f4f87a83f40e55b5a82dc5a46b3942127308c924dd9d8760--Emacs.icns.modern
==> Downloading https://github.com/nashamri/spacemacs-logo/blob/master/spacemacs.icns?raw=true
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/8012882bc66839266939eb427d278e4baa7019f4fa113e06e945f9f4892949ed--spacemacs.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon1.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/6435ba3a799135b0edca96a182e7cda1d539f2abf2fed2224a00bbe2e9c9dc2d--EmacsIcon1.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon2.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/f87ace30266dce8020d209339f0b349fc258e2bfdfcc09cb8ca7aa823babba77--EmacsIcon2.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon3.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/b5de09aa2ac62c5089df48cb73dfd24fc1d0e8ff16bfa8cf75ff47f3d42ea83c--EmacsIcon3.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon4.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/ba1f9be3e3a71a0fa364ae3ab974298bfed15674842e35bb328630b0858dd2f1--EmacsIcon4.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon5.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/26f3f7207fb49760f9d9d07e5c2987cf4f945a4a934c4ca1a323b57361be815b--EmacsIcon5.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon6.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/564038589d930d3a1fcc2fef6af9021e007ee437299821710a8aae778605339d--EmacsIcon6.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon7.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/fd39f2010081477ebef1e4fa8dcefbef068ece41bb4261e858c25fc4e4de8d60--EmacsIcon7.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon8.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/3fd5239d13e03501f2a19ed9d4cb33ff0528b7b4742383519f1f2505ef959d3a--EmacsIcon8.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/EmacsIcon9.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/bd46c47d7f6a51b1bdcb06510f031d632e891758201d73243a24924ad6d3919b--EmacsIcon9.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/emacs-card-blue-deep.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/efbdd97da45daa9e75c6b7c7aef914fb7f0efd6f1a0a27a1a75828a323d94642--emacs-card-blue-deep.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/emacs-card-british-racing-green.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/864255f3dbd6bc0d231e7b6fdd408658384566cb1026881207dc128bf5d59fbf--emacs-card-british-racing-green.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/emacs-card-carmine.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/2baaf59fb052c4cf34fe37a8879683b0e27c430933a1117d1cb4c0c235635956--emacs-card-carmine.icns
==> Downloading https://raw.githubusercontent.com/emacsfodder/emacs-icons-project/master/emacs-card-green.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/705a332c703ba11fba2b10debed9e5455a219dd68e2e3f33b43fecc7a7767d86--emacs-card-green.icns
==> Downloading https://raw.githubusercontent.com/d12frosted/homebrew-emacs-plus/master/icons/heckert_gnu.icns
Already downloaded: /Users/jiya/Library/Caches/Homebrew/downloads/66a8fbd29bcc5f4d32d6fe3bc02b1311b992bb112dd5e46fe05bab070b8c50e8--heckert_gnu.icns
==> Cloning https://github.com/emacs-mirror/emacs.git
Updating /Users/jiya/Library/Caches/Homebrew/emacs-plus--git
==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at a4671733b7b9 ; Fix warning after last change in cal-julian.el
==> Reinstalling d12frosted/emacs-plus/emacs-plus --with-ctags --with-xwidgets --with-jansson --with-emacs-27-branch --with-modern-icon --with-no-frame-refocus --with-dbus --with-mailutils
==> Patching
Error: An exception occurred within a child process:
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/jiya/Library/Caches/Homebrew/downloads/8bd90da21a7a4fcdb5c6efbf8c021fc8e894bf1675f6b5b2173af09f3ffa78b1--xwidgets_webkit_in_cocoa-emacs-27.patch

Output of brew config

$ brew config
❯ homebrew-emacs-plus (master) ✔ brew config                                                                                                                                                                                                                  (master|) ✔
HOMEBREW_VERSION: 2.2.16-56-g0723df3
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0723df3f86b2f399292a3dc4707fbae873b6cac8
Last commit: 14 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5326934c8388b0eee5ee9dc4807e79c156d19534
Core tap last commit: 11 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.63ghtMmMEU/org.macosforge.xquartz:0
HOMEBREW_EDITOR: nvim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
HOMEBREW_NO_GITHUB_API: set
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1103
Git: 2.26.2 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 12.0.2, 12.0.1, 11.0.2, 11.0.1, 9.0.4, 1.8.0_202, 1.8.0_192, 1.8.0_181, 1.8.0_172, 1.8.0_162, 1.8.0_152
macOS: 10.15.4-x86_64
CLT: 11.4.1.0.1.1586360307
Xcode: 11.4.1
XQuartz: 2.7.11 => /opt/X11

Output of brew doctor

$ brew doctor
❯ homebrew-emacs-plus (master) ✔ brew doctor                                                                                                                                                                                                                  (master|) ✔
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /usr/local/anaconda3/bin/icu-config
  /usr/local/anaconda3/bin/krb5-config
  /usr/local/anaconda3/bin/freetype-config
  /usr/local/anaconda3/bin/xslt-config
  /usr/local/anaconda3/bin/libpng16-config
  /usr/local/anaconda3/bin/python3.7-config
  /usr/local/anaconda3/bin/libpng-config
  /usr/local/anaconda3/bin/xml2-config
  /usr/local/anaconda3/bin/python3.7m-config
  /usr/local/anaconda3/bin/python3-config
  /usr/local/anaconda3/bin/curl-config
  /usr/local/anaconda3/bin/ncursesw6-config
  /usr/local/anaconda3/bin/pcre-config

Warning: Putting non-prefixed coreutils in your path can cause gmp builds to fail.

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libcaffe.1.0.0.dylib
  /usr/local/lib/libclang.dylib
  /usr/local/lib/librime.1.5.3.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/c++/v1/__bsd_locale_defaults.h
  /usr/local/include/c++/v1/__bsd_locale_fallbacks.h
  /usr/local/include/c++/v1/__cxxabi_config.h
  /usr/local/include/c++/v1/complex.h
  /usr/local/include/c++/v1/ctype.h
  /usr/local/include/c++/v1/cxxabi.h
  /usr/local/include/c++/v1/errno.h
  /usr/local/include/c++/v1/float.h
  /usr/local/include/c++/v1/inttypes.h
  /usr/local/include/c++/v1/limits.h
  /usr/local/include/c++/v1/locale.h
  /usr/local/include/c++/v1/math.h
  /usr/local/include/c++/v1/setjmp.h
  /usr/local/include/c++/v1/stdbool.h
  /usr/local/include/c++/v1/stddef.h
  /usr/local/include/c++/v1/stdint.h
  /usr/local/include/c++/v1/stdio.h
  /usr/local/include/c++/v1/stdlib.h
  /usr/local/include/c++/v1/string.h
  /usr/local/include/c++/v1/support/android/locale_bionic.h
  /usr/local/include/c++/v1/support/fuchsia/xlocale.h
  /usr/local/include/c++/v1/support/ibm/limits.h
  /usr/local/include/c++/v1/support/ibm/locale_mgmt_aix.h
  /usr/local/include/c++/v1/support/ibm/support.h
  /usr/local/include/c++/v1/support/ibm/xlocale.h
  /usr/local/include/c++/v1/support/musl/xlocale.h
  /usr/local/include/c++/v1/support/newlib/xlocale.h
  /usr/local/include/c++/v1/support/solaris/floatingpoint.h
  /usr/local/include/c++/v1/support/solaris/wchar.h
  /usr/local/include/c++/v1/support/solaris/xlocale.h
  /usr/local/include/c++/v1/support/win32/limits_msvc_win32.h
  /usr/local/include/c++/v1/support/win32/locale_win32.h
  /usr/local/include/c++/v1/support/xlocale/__nop_locale_mgmt.h
  /usr/local/include/c++/v1/support/xlocale/__posix_l_fallback.h
  /usr/local/include/c++/v1/support/xlocale/__strtonum_fallback.h
  /usr/local/include/c++/v1/support/xlocale/xlocale.h
  /usr/local/include/c++/v1/tgmath.h
  /usr/local/include/c++/v1/wchar.h
  /usr/local/include/c++/v1/wctype.h
  /usr/local/include/caffe/proto/caffe.pb.h
  /usr/local/include/caffe/util/signal_handler.h
  /usr/local/include/reproc/reproc.h
  /usr/local/include/rime_api.h
  /usr/local/include/rime_levers_api.h

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libcaffeproto.a
  /usr/local/lib/libreproc.a

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  perl
  protobuf

Warning: Some installed formulae are not readable:
  protobuf@3.1: "cxx11" is not a recognized standard

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
  smtpd2.7.py
  zgrep
  zmore
  idle2.7
  idle
  cmp
  db_upgrade
  ctags
  zdiff
  strings
  db_hotbackup
  git-receive-pack
  objdump
  2to3-2.7
  c++filt
  strip
  diff3
  python3
  ssh-keyscan
  easy_install
  pydoc
  db_printlog
  python
  python2
  pythonw
  db_archive
  pip3
  awk
  zless
  mail
  python2.7-config
  db_stat
  db_load
  from
  znew
  sftp
  pydoc2.7
  gzip
  git-upload-archive
  diff
  pythonw2.7
  slogin
  gperf
  ssh-agent
  python-config
  db_verify
  ssh
  easy_install-2.7
  nm
  ssh-add
  screen
  ssh-keygen
  ar
  gzexe
  python2.7
  db_checkpoint
  git-shell
  zcat
  size
  scp
  sdiff
  db_deadlock
  git-upload-pack
  ranlib
  zcmp
  zegrep
  uncompress
  db_recover
  db_dump
  smtpd.py
  git
  zfgrep
  zipdetails
  zforce
  gunzip
Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
  brew install openssl@1.0 ffmpeg x264

Run `brew missing` for more details.

it seems that build with master branch, rather than emacs-27 branch.

Hi @shuxiao9058

It's a question to brew and not to the formula itself. As you can see, --with-emacs27-branch or --HEAD is not passed to the formula during reinstall. Normally I advise against using reinstall command at all.

(update the option name)

Hi @shuxiao9058

It's a question to brew and not to the formula itself. As you can see, --HEAD is not passed to the formula during reinstall. Normally I advise against using reinstall command at all.

but what confused me is that it was success with reinstall before recent commit of emacs-plus.

I don't know. It really sounds like a brew bug to me. Right now they are changing something in options parsing and it's breaking time to time (I already reported two issues during the last month).

Formula doesn't control what options are passed to it. Also, it's not formulas' responsibility to make reinstall behave like install. In my understanding if brew install formula options works, then the next brew reinstall formula must behave exactly the same as brew uninstall formula && brew install formula options. In this case it doesn't happen.

before recent commit of emacs-plus.

But brew changes also. And you are on the latest version of it. It automatically updates itself unless you explicitly disable automatic updates.

I will try to come up with simpler reproducible scenario for this issue to see if it's really brew or emacs-plus.


Let me analyse the output (it's mostly thinking out loud).

==> Checking out branch master

Already on 'master'

Your branch is up to date with 'origin/master'.

If you just install, it says that emacs-27 branch is checkout out instead of master.

==> Reinstalling d12frosted/emacs-plus/emacs-plus --with-ctags --with-xwidgets --with-jansson --with-emacs-27-branch --with-modern-icon --with-no-frame-refocus --with-dbus --with-mailutils

I don't see --HEAD here 😿

Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/jiya/Library/Caches/Homebrew/downloads/8bd90da21a7a4fcdb5c6efbf8c021fc8e894bf1675f6b5b2173af09f3ffa78b1--xwidgets_webkit_in_cocoa-emacs-27.patch

Inspecting which resources are downloaded is also interesting. It didn't download xwidgets patch, but checked for all icons and multicolor-fonts.patch, which is available only on Emacs 26.

  if build.with? "multicolor-fonts"
    unless build.head?
      patch do
        url (PatchUrlResolver.url "multicolor-fonts")
        sha256 "7597514585c036c01d848b1b2cc073947518522ba6710640b1c027ff47c99ca7"
      end
    end
  end

It really looks like reinstall messes up options.


Wow, while trying to setup a new formula to reproduce this bug I've noticed that options parsing is broken again... ah, I was on the broken version of brew.

Ok, found an easy way to reproduce.

class Foo < Formula
  desc "Search tool like grep, but optimized for programmers"
  homepage "https://beyondgrep.com/"
  url "https://beyondgrep.com/ack-v3.3.1"
  sha256 "e4fd286d5a56f459147d562660d2f8bc4548f2f1e2d8cf3a5265b70beedbfc87"

  option "with-ham", "Description of the option"
  option "without-spam", "Another description"

  if build.with? "ham"
    puts "[pre] with-ham"
  else
    puts "[pre] without-ham"
  end

  if build.with? "spam"
    puts "[pre] with-spam"
  else
    puts "[pre] without-spam"
  end

  def install
    if build.with? "ham"
      puts "[install] with-ham"
    else
      puts "[install] without-ham"
    end

    if build.with? "spam"
      puts "[install] with-spam"
    else
      puts "[install] without-spam"
    end

    bin.install "ack-v#{version.to_s.tr("-", "_")}" => "ack"
  end

  test do
    system "true"
  end
end

Save it as Foo.rb and then:

$ brew install Foo.rb --with-ham --without-spam
[pre] with-ham
[pre] without-spam
==> Downloading https://beyondgrep.com/ack-v3.3.1
Already downloaded: /Users/d12frosted/Library/Caches/Homebrew/downloads/e2eb0cdbad3035791e95d763143cd83170f5871125bf10c7311b33e4fab3fb8e--ack-v3.3.1
[pre] with-ham
[pre] without-spam
[install] with-ham
[install] without-spam
/* brew link message */
[pre] without-ham
[pre] with-spam
==> Summary
🍺  /usr/local/Cellar/Foo/3.3.1: 3 files, 157.6KB, built in 2 seconds
[pre] with-ham
[pre] without-spam

Now if I reinstall:

$ brew reinstall Foo.rb
[pre] without-ham
[pre] with-spam
==> Downloading https://beyondgrep.com/ack-v3.3.1
Already downloaded: /Users/d12frosted/Library/Caches/Homebrew/downloads/e2eb0cdbad3035791e95d763143cd83170f5871125bf10c7311b33e4fab3fb8e--ack-v3.3.1
==> Reinstalling Foo --with-ham --without-spam
[pre] with-ham
[pre] without-spam
[install] with-ham
[install] without-spam
/* brew link message */
[pre] without-ham
[pre] with-spam
==> Summary
🍺  /usr/local/Cellar/Foo/3.3.1: 3 files, 157.6KB, built in 2 seconds
[pre] without-ham
[pre] with-spam

As you can see, first it enters the formula with the default options (no ham but with spam) and then only it gets to the right ones (with ham and no spam).

but what confused me is that it was success with reinstall before recent commit of emacs-plus.

In order to report this issue, I need to find which commit has broken desired behaviour. I never use reinstall (and I advise against it whenever I have a chance), so don't know when it broke. I've tried to move back in the brew history a little bit, but I still get this behaviour:

[pre] without-ham
[pre] with-spam

I am already running out of time, so won't be able to look into this issue until evening/next morning, sorry. Best what I can tell now - stop using reinstall :) brew doesn't like when formula has many options and they are making it harder and harder to maintain formula like emacs-plus, which is beefed with multiple options (that's why I am actually working on decreasing amount of options).

but what confused me is that it was success with reinstall before recent commit of emacs-plus.

In order to report this issue, I need to find which commit has broken desired behaviour. I never use reinstall (and I advise against it whenever I have a chance), so don't know when it broke. I've tried to move back in the brew history a little bit, but I still get this behaviour:

[pre] without-ham
[pre] with-spam

I am already running out of time, so won't be able to look into this issue until evening/next morning, sorry. Best what I can tell now - stop using reinstall :) brew doesn't like when formula has many options and they are making it harder and harder to maintain formula like emacs-plus, which is beefed with multiple options (that's why I am actually working on decreasing amount of options).

Thanks for your advice, without reinstall it build and install success.

No problem 😸 I am happy that in the end you have your Emacs with desired options! 💯 This is what I care about 😸

@d12frosted very nice explanation of how the reinstall option works. The only way I found to overcome this issue is to unconditionally download all od the patches declaring them as resources. Please have a look to daviderestivo/homebrew-emacs-head@f03b7c9.

@daviderestivo interesting. Maybe we should repeat this trick here as well 🤔

As you can see, first it enters the formula with the default options (no ham but with spam) and then only it gets to the right ones (with ham and no spam).

Inspecting which resources are downloaded is also interesting. It didn't download xwidgets patch, but checked for all icons and multicolor-fonts.patch, which is available only on Emacs 26.

So downloading all patches unconditionally really fixes this issue.

I don't see --HEAD here 😿

==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.

On the other hand, I am not sure that it will ever fix the --HEAD option.

So downloading all patches unconditionally really fixes this issue.

Yes, at leat it seems to me that nothing is missing ...

On the other hand, I am not sure that it will ever fix the --HEAD option.

I went through the home-brew docs and I found this. So, in short, it seems that the --HEAD is not officially supported by the reinstall option. We could ask homebrew core team the reason why it's not supported but I guess it would be complicated to ask them to introduce it ...

Thanks for the link. I think, maybe it's a good idea breaking the package into three (I think I've already shared this idea somewhere). Maybe I will prepare a PR this week just to take a look.

Thanks for the link. I think, maybe it's a good idea breaking the package into three (I think I've already shared this idea somewhere).

Yes. I agree as well this is the best approach otherwise the number of combination option would become easily unmanageable.

@daviderestivo I actually prepared a PR (#226). Please check it out and let me know what you think 😸