Straight.el: #708 broke Org recipe on Mac with ZSH

Created on 9 Mar 2021  Β·  6Comments  Β·  Source: raxod502/straight.el

FYI, the change in #708 has broken my ability to build org on emacs on a mac with ZSH as my shell because of how ZSH handles globbing.

Perhaps straight-recipes-org-elpa--build could be a windows-only operation?

Core issue:

(let ((shell-file-name "/bin/zsh")
      (default-directory "~/.emacs.d/straight/repos/org"))
  (prin1 (shell-command-to-string "git describe --match release\* --abbrev=0 HEAD"))
  (prin1 (shell-command-to-string "noglob git describe --match release\* --abbrev=0 HEAD"))
  (setq shell-file-name "/bin/bash")
  (prin1 (shell-command-to-string "git describe --match release\* --abbrev=0 HEAD"))
  nil
  )
"zsh:1: no matches found: release*
""release_9.4.4
""release_9.4.4

_Originally posted by @cwhatley in https://github.com/raxod502/straight.el/issues/707#issuecomment-792812751_

bug external command

All 6 comments

@cwhatley: Thanks for bringing this to my attention. I will look into it ASAP.

Perhaps straight-recipes-org-elpa--build could be a windows-only operation?

If the issue is with ZSH and globbing, Windows users may still be affected by this same bug.
I may have made an error when translating that command over from Org's makefiles.
I'll do some testing and see if I can work out a solution that is operating system independent and works with bash/zsh.

In the meantime, you can override the :pre-build steps in your init with the previous steps as a workaround:

(straight-use-package
 '(org-plus-contrib
   :type git
   :repo "https://code.orgmode.org/bzg/org-mode.git"
   :local-repo "org"
   ;; `org-version' depends on repository tags
   :depth full
   :pre-build ("make" "autoloads")
   ;; Org's make autoloads generates org-version.el
   :build (:not autoloads)
   :files ( :defaults
            "lisp/*.el"
            ("etc/styles/" "etc/styles/*")
            "contrib/lisp/*.el")
   :includes org))

I think you copied the command over just fine. Since building org by hand creates org-version just fine with the same command, I think the core difference is that GNU make uses /bin/sh unless you define a SHELL in your makefile.

https://www.gnu.org/software/make/manual/make.html#Recipes

image

Also, durr on my part... just single-quote the pattern: 'release*' and that should fix it for both bash/zsh.

(let ((shell-file-name "/bin/zsh")
      (default-directory "~/.emacs.d/straight/repos/org"))
  (prin1 (shell-command-to-string "git describe --match release\* --abbrev=0 HEAD"))
  (prin1 (shell-command-to-string "noglob git describe --match release\* --abbrev=0 HEAD"))
  (prin1 (shell-command-to-string "git describe --match 'release*' --abbrev=0 HEAD"))
  (setq shell-file-name "/bin/bash")
  (prin1 (shell-command-to-string "git describe --match release\* --abbrev=0 HEAD"))
  (prin1 (shell-command-to-string "git describe --match 'release*' --abbrev=0 HEAD"))
  nil
  )
"zsh:1: no matches found: release*
""release_9.4.4
""release_9.4.4
""release_9.4.4
""release_9.4.4
"nil

I think an even better solution may be to avoid using the shell altogether via call-process.

I've successfully run the following test on my linux machine and a win 10 VM.
If you have time, please try evaluating the following test case in your *scratch* buffer:

Linux Test Case

(straight-bug-report
  :user-dir "org-no-glob.test"
  :pre-bootstrap 
  (setq straight-repository-user "progfolio" straight-repository-branch "fix/org-recipe-glob")
  :post-bootstrap 
  (straight-use-package 'org-plus-contrib)
  (org-version nil 'full 'message))

  • Test run at: 2021-03-09 15:05:09
  • system-type: gnu/linux
  • straight-version: prerelease (HEAD -> fix/org-recipe-glob, fork/fix/org-recipe-glob) f6db465 2021-03-09
  • emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-03-05

Output

Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...
Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...done
Looking for emacsmirror-mirror recipe β†’ Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe β†’ Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe β†’ Cloning el-get...
Looking for emacsmirror-mirror recipe β†’ Cloning el-get...done
Looking for straight recipe β†’ Cloning emacsmirror-mirror...
Looking for straight recipe β†’ Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> fix/org-recipe-glob, origin/fix/org-recipe-glob) f6db465 2021-03-09
Cloning org (for org-plus-contrib)...
Cloning org (for org-plus-contrib)...done
Building org-plus-contrib...
Building org-plus-contrib...done

Org mode version 9.4.4 (9.4.4-g37749c @ /tmp/org-no-glob.test/straight/build/org-plus-contrib/)

Windows Test Case

(straight-bug-report
  :user-dir "org-no-glob.test"
  :pre-bootstrap 
  (setq straight-repository-user "progfolio" straight-repository-branch "fix/org-recipe-glob")
  :post-bootstrap 
  (straight-use-package 'org-plus-contrib)
  (org-version nil 'full 'message))

  • Test run at: 2021-03-09 15:07:23
  • system-type: windows-nt
  • straight-version: prerelease (HEAD -> master, origin/master, origin/HEAD) d21e829 %cs
  • emacs-version: GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21

Output

Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe -> Cloning melpa...
Looking for gnu-elpa-mirror recipe -> Cloning melpa...done
Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe -> Cloning el-get...
Looking for emacsmirror-mirror recipe -> Cloning el-get...done
Looking for straight recipe -> Cloning emacsmirror-mirror...
Looking for straight recipe -> Cloning emacsmirror-mirror...done
Building straight...
Building straight...done
Cloning org (for org-plus-contrib)...
Cloning org (for org-plus-contrib)...done
Building org-plus-contrib...
Building org-plus-contrib...done
Bootstrapping straight.el...
Bootstrapping straight.el...done

Test run with version: prerelease
 nil

Org mode version 9.4.4 (9.4.4-g37749c @ c:/Users/win10/AppData/Local/Temp/org-no-glob.test/straight/build/org-plus-contrib/)

Seems good on emacs-mac 27.1

Test Case

(straight-bug-report
  :user-dir "org-no-glob.test"
  :pre-bootstrap 
  (setq straight-repository-user "progfolio" straight-repository-branch "fix/org-recipe-glob")
  :post-bootstrap 
  (straight-use-package 'org-plus-contrib)
  (org-version nil 'full 'message))

  • Test run at: 2021-03-09 18:17:34
  • system-type: darwin
  • straight-version: prerelease (HEAD -> develop, origin/develop, origin/HEAD) f88f828 %cs
  • emacs-version: GNU Emacs 27.1 (build 1, x86_64-apple-darwin20.1.0, Carbon Version 164 AppKit 2022.1) of 2020-11-16

Output

Bootstrapping straight.el...
Bootstrapping straight.el...done
Rebuilding all packages due to build cache schema change
Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...
Looking for gnu-elpa-mirror recipe β†’ Cloning melpa...done
Looking for emacsmirror-mirror recipe β†’ Cloning gnu-elpa-mirror...
Looking for emacsmirror-mirror recipe β†’ Cloning gnu-elpa-mirror...done
Looking for emacsmirror-mirror recipe β†’ Cloning el-get...
Looking for emacsmirror-mirror recipe β†’ Cloning el-get...done
Looking for straight recipe β†’ Cloning emacsmirror-mirror...
Looking for straight recipe β†’ Cloning emacsmirror-mirror...done
Building straight...
Building straight...done

Test run with version: prerelease (HEAD -> fix/org-recipe-glob, origin/fix/org-recipe-glob) 98988ea %cs
Cloning org (for org-plus-contrib)...
Cloning org (for org-plus-contrib)...done
Building org-plus-contrib...
Building org-plus-contrib...done

Org mode version 9.4.4 (9.4.4-g37749c @ /var/folders/8c/4q4hxcl15hgf1v1ktd_rk93c0000gn/T/org-no-glob.test/straight/build/org-plus-contrib/)

Looks good to me! Thanks for testing. I'll merge #715 into the develop branch.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aspiers picture aspiers  Β·  4Comments

omidmnz picture omidmnz  Β·  4Comments

aspiers picture aspiers  Β·  4Comments

dertuxmalwieder picture dertuxmalwieder  Β·  3Comments

raxod502 picture raxod502  Β·  3Comments