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

emacs 28.1 bottle does not contain dir file #100190

Closed
2 tasks done
timvisher opened this issue Apr 26, 2022 · 6 comments · Fixed by Homebrew/brew#13215
Closed
2 tasks done

emacs 28.1 bottle does not contain dir file #100190

timvisher opened this issue Apr 26, 2022 · 6 comments · Fixed by Homebrew/brew#13215
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age

Comments

@timvisher
Copy link

timvisher commented Apr 26, 2022

brew gist-logs

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

Use emacs packaged info manuals.

What happened (include all command output)?

The manuals included with emacs are not shown when opening info from inside emacs. The initially presenting problem is that there is no dir file initialized in the linked directory inside "$(brew --prefix)"/share/info:

$ ls -lA "$(brew --prefix)"/Cellar/emacs/28.1/share/info/dir
ls: cannot access '/opt/homebrew/Cellar/emacs/28.1/share/info/dir': No such file or directory

Running M-x info RET inside emacs -Q at that point yields a buffer that doesn't contain, for instance, Htmlfontify:

File Edit Options Buffers Tools Info Help
No next, prev or up links  --  This is the top of the INFO tree
(dir)Top

  This (the Directory node) gives a menu of major topics.
  Typing "q" exits, "?" lists all Info commands, "d" returns here,
  "h" gives a primer for first-timers,
  "mEmacs<Return>" visits the Emacs manual, etc.

  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.

* Menu:

Libraries
* autosprintf           Support for printf format strings in C++.
…

Emacs
* Ada mode              The GNU Emacs mode for editing Ada.
<No Htmlfontify>

Once I run the following fixup script

(
  cd "$(dirname "$(readlink -f "$(type -p emacs)")")"/../share/info/emacs &&
    for f in *.info.*
    do
      install-info "$f" dir
    done
)

I get an entry for Htmlfontify

File Edit Options Buffers Tools Info Help
No next, prev or up links  --  This is the top of the INFO tree
(dir)Top

  This (the Directory node) gives a menu of major topics.
  Typing "q" exits, "?" lists all Info commands, "d" returns here,
  "h" gives a primer for first-timers,
  "mEmacs<Return>" visits the Emacs manual, etc.

  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.

* Menu:
…

Emacs
* Autotype              Convenient features for text that you enter
                          frequently in Emacs.
…
* Htmlfontify           Convert source code to html.

Note that entries that have files inside #{info}/emacs do properly use them when visiting. It's just that all of the files available inside there aren't in the menu until running the install-info fixup.

It's worth nothing that a local installation does generate a dir file:

$ pwd; grep Htmlfontify info/dir
/Users/tim.visher/git/emacs
* Htmlfontify: (htmlfontify).   Convert source code to html.

while the bottle does not (though it does contain htmlfontify.info.gz)

$ tar -tzf ~/Library/Caches/Homebrew/downloads/4d23ccbd955636f080b9112261babb7655741242ecc1a81b4dc5af679fbe0f76--emacs--28.1.arm64_monterey.bottle.tar.gz -- emacs/28.1/share/info/emacs/{htmlfontify.info.gz,dir}
emacs/28.1/share/info/emacs/htmlfontify.info.gz
tar: emacs/28.1/share/info/emacs/dir: Not found in archive
tar: Error exit delayed from previous errors.

My only guess is that the bottle code is zipping up *.info rather than *.info dir here since the build process should be producing one.

That said, I did attempt to install brew install emacs --HEAD and it also failed to produce or at least copy in the generated dir file.

$ ls -lA /opt/homebrew/Cellar/emacs/HEAD-516ff42/share/info/emacs/{htmlfontify.info.gz,dir}
ls: cannot access '/opt/homebrew/Cellar/emacs/HEAD-516ff42/share/info/emacs/dir': No such file or directory
-rw-r--r-- 1 tim.visher 22K Apr 26 16:30 /opt/homebrew/Cellar/emacs/HEAD-516ff42/share/info/emacs/htmlfontify.info.gz

I see no evidence that the info directory was even produced although it's possible make clean or similar is run by the the install --HEAD process:

$ ls -lAd ~/Library/Caches/Homebrew/emacs--git/info
ls: cannot access '/Users/tim.visher/Library/Caches/Homebrew/emacs--git/info': No such file or directory

What did you expect to happen?

Be able to utilize all the manuals packaged with emacs.

Step-by-step reproduction instructions (by running brew commands)

#!/usr/bin/env bash

brew uninstall emacs

ls -lA "$(brew --prefix)"/Cellar/emacs/28.1/share/info/emacs/dir

ls -lAd "$(brew --prefix)"/share/info/emacs

brew install emacs

ls -lA "$(brew --prefix)"/Cellar/emacs/28.1/share/info/emacs/dir

ls -lAd "$(brew --prefix)"/share/info/emacs

"$(brew --prefix)"/bin/emacs -Q --batch --eval '
  (progn
    (info)
    (message "%S" Info-directory-list)
    (occur "Htmlfontify")
    ;; Commented out because when `occur` does not find a match it does
    ;; not generate a buffer

    ;; (with-current-buffer "*Occur*"
    ;;  (message "%s" (buffer-substring (point-min)
    ;;                                    (point-max))))
  )'

(
  cd "$(brew --prefix)"/share/info/emacs &&
    for f in *.info.gz
    do
      install-info "$f" dir
    done
)

"$(brew --prefix)"/bin/emacs -Q --batch --eval '
  (progn
    (info)
    (message "%S" Info-directory-list)
    (occur "Htmlfontify")
    (with-current-buffer "*Occur*"
     (message "%s" (buffer-substring (point-min)
                                       (point-max))))
  )'

See my own logs of the above here.

@timvisher timvisher added the bug Reproducible Homebrew/homebrew-core bug label Apr 26, 2022
@SMillerDev
Copy link
Member

What happens if you compile emacs outside of brew?

@timvisher
Copy link
Author

timvisher commented Apr 27, 2022

What happens if you compile emacs outside of brew?

A dir file gets created in the info directory:

Sorry I misspoke here. It turns out that there's just a dir file in the distribution archive and it contains Htmlfontify:

$ curl --silent 'https://ftp.gnu.org/gnu/emacs/emacs-28.1.tar.xz' | tar -JxO -- emacs-28.1/info/dir | grep Htmlfontify
* Htmlfontify: (htmlfontify).   Convert source code to html.

I'm working on getting together a reproduction script that can be run on a macOS box. I'll reupdate with a gist when I get that together.

So here's a full reproduction script that doesn't involve brew and I believe shows that the dir file is correctly included when doing something that, at least to my eyes, appears to be more or less identical to what I'd expect brew to be doing:

For some reason I'm not able to link to lines in the gist but the important ones to call out are 6335 through 6406 in x.log. Specifically these lines show that

  1. make install does copy the compressed info files with the dir file into the infodir correctly.
  2. Running the small elisp program in batch shows that after activating Info you can see the Htmlfontify manual which is missing from the macOS system dir file.

@carlocab
Copy link
Member

I think there is special handling of info pages in brew, but I'm a bit hazy on the details. The difference might lie there.

CC @Homebrew/brew in case this rings a bell for someone.

@cho-m
Copy link
Member

cho-m commented Apr 27, 2022

Maybe https://github.com/Homebrew/brew/blob/master/Library/Homebrew/cleaner.rb#L31-L35

    # Get rid of any info 'dir' files, so they don't conflict at the link stage
    Dir.glob(@f.info/"**/dir").each do |f|
      info_dir_file = Pathname(f)
      observe_file_removal info_dir_file if info_dir_file.file? && !@f.skip_clean?(info_dir_file)
    end

The problem being the symlink conflict at HOMEBREW_PREFIX/share/info/dir

@timvisher
Copy link
Author

@cho-m That seems like a likely culprit. In this instance the dir file shouldn't conflict because it's buried in a subdirectory, #{info}/emacs/dir. This appears to be at least somewhat uncommon just examining my local install.

@Bo98
Copy link
Member

Bo98 commented Apr 27, 2022

Excluding #{info}/#{name}/dir from deletion is probably a reasonable adjustment to make.

timvisher pushed a commit to timvisher/brew that referenced this issue Apr 28, 2022
Still cleans `info/dir` and `info/<arch>/dir` files.

Fixes Homebrew/homebrew-core#100190
timvisher pushed a commit to timvisher/brew that referenced this issue Apr 28, 2022
Still cleans `info/dir` and `info/<arch>/dir` files.

Fixes Homebrew/homebrew-core#100190
@github-actions github-actions bot added the outdated PR was locked due to age label May 30, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/homebrew-core bug outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants