thoughtbot / thoughtbot/dotfiles

zsh function .zwc parse errors

Open
#742 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
8.2k
Forks
1.8k
Avg merge
10d 14h
Merged PRs (30d)
1

Description

After installing, I get errors every time I open a new iTerm window:

/Users/bengolder/.zsh/functions/_git_delete_branch.zwc:1: parse error near `)'
/Users/bengolder/.zsh/functions/change-extension.zwc:1: no such file or directory: ^G^F^E^D^A^H^A
/Users/bengolder/.zsh/functions/envup.zwc:1: no such file or directory: ^G^F^E^D^Ax^A
[3] 75334
/Users/bengolder/.zsh/functions/g.zwc:1: no such file or directory: ^G^F^E^D^A
[4] 75335
/Users/bengolder/.zsh/functions/g.zwc:1: no such file or directory:
[4]  + exit 127    ��
[3]  + exit 127    �A
/Users/bengolder/.zsh/functions/g.zwc:1: command not found: A
/Users/bengolder/.zsh/functions/mcd.zwc:1: no such file or directory: ^G^F^E^D^A\M-T
Wed Apr 24 10:42 AM ~ %

It's clear that these are occurring when the zshrc file runs this loop to source all the files in .zsh/functions:

# load custom executable functions
for function in ~/.zsh/functions/*; do
  source $function
done

If I delete the ~/.zsh directory and rerun rcup, the errors are absent until new .zwc files are autogenerated for each file in ~/.zsh/functions:

Wed Apr 24 10:49 AM functions % pwd
/Users/bengolder/.zsh/functions
Wed Apr 24 10:49 AM functions % ls -la
total 40
drwxr-xr-x  12 bengolder  staff  384 Apr 24 10:47 .
drwxr-xr-x   5 bengolder  staff  160 Apr 24 10:46 ..
lrwxr-xr-x   1 bengolder  staff   58 Apr 24 10:46 _git_delete_branch -> /Users/bengolder/dotfiles/zsh/functions/_git_delete_branch
-rw-r-----   1 bengolder  staff  480 Apr 24 10:47 _git_delete_branch.zwc
lrwxr-xr-x   1 bengolder  staff   56 Apr 24 10:46 change-extension -> /Users/bengolder/dotfiles/zsh/functions/change-extension
-rw-r-----   1 bengolder  staff  528 Apr 24 10:47 change-extension.zwc
lrwxr-xr-x   1 bengolder  staff   45 Apr 24 10:46 envup -> /Users/bengolder/dotfiles/zsh/functions/envup
-rw-r-----   1 bengolder  staff  752 Apr 24 10:47 envup.zwc
lrwxr-xr-x   1 bengolder  staff   41 Apr 24 10:46 g -> /Users/bengolder/dotfiles/zsh/functions/g
-rw-r-----   1 bengolder  staff  512 Apr 24 10:47 g.zwc
lrwxr-xr-x   1 bengolder  staff   43 Apr 24 10:46 mcd -> /Users/bengolder/dotfiles/zsh/functions/mcd
-rw-r-----   1 bengolder  staff  424 Apr 24 10:47 mcd.zwc

System details:

  • MacOS 14.4.1
  • iTerm2 3.4.23
  • zsh 5.9 (arm-apple-darwin23.0.0), installed via homebrew

Any questions or debugging suggestions welcome!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the zshrc loop that sources every entry under ~/.zsh/functions, then reproduce the issue by opening a new shell after rcup generates the .zwc files. Check how the loop handles compiled files alongside the symlinked functions. Done means new shells start without parse or command errors while the custom functions remain available.

Written by the indexing model from the issue text.

Assessment

Tech stack
zsh
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.