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

Windows line-endings? #51

Closed
SturmB opened this issue Nov 16, 2020 · 7 comments
Closed

Windows line-endings? #51

SturmB opened this issue Nov 16, 2020 · 7 comments

Comments

@SturmB
Copy link

SturmB commented Nov 16, 2020

I ran this role a few days ago and now, each time I start up a shell instance, I receive a bunch of error messages, all of which show ^M at the end of their lines:

Seems zsh-users/zsh-autosuggestions is already installed!
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/cli.zsh:2: command not found: ^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/cli.zsh:34: parse error near `elif'
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/functions.zsh:3: parse error near `|'
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/git.zsh:31: parse error near `in^M'
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/history.zsh:4: not an identifier: list^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/misc.zsh:21: command not found: env_default
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/misc.zsh:22: command not found: env_default
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/nvm.zsh:7: parse error near `\n'
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/termsupport.zsh:setopt:11: no such option: prompt_subst^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/termsupport.zsh:12: command not found: ^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/termsupport.zsh:14: command not found: ^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/termsupport.zsh:18: command not found: ^M
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/lib/termsupport.zsh:19: parse error near `in^M'
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/kubectl/kubectl.plugin.zsh:181: parse error near `\n'
/home/sturm/.antigen/bundles/urbainvaes/fzf-marks/fzf-marks.plugin.zsh:38: parse error near `elif'
/home/sturm/.antigen/bundles/joel-porquet/zsh-dircolors-solarized/zsh-dircolors-solarized.plugin.zsh:source:2: no such file or directory: /home/sturm/.antigen/bundles/joel-porquet/zsh-dircolors-solarized/zsh-dircolors-solarized.zsh^M
/home/sturm/.antigen/bundles/zsh-users/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh:187: parse error near `elif'
zsh-syntax-highlighting: 'main' highlighter should define both required functions '_zsh_highlight_highlighter_main_paint' and '_zsh_highlight_highlighter_main_predicate' in '/home/sturm/.antigen/bundles/zsh-users/zsh-syntax-highlighting/highlighters/main/main-highlighter.zsh'.
/home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh:typeset:6: not valid in this context: less_termcap^M

I've also documented this issue on Antigen's repo, but I have a feeling it has something to do with this role.

For info, I'm running this on an Ubuntu-20.04 WSL2 instance.

Can anyone please help me to understand what's going on?

@popstas
Copy link
Contributor

popstas commented Nov 17, 2020

Please, check git of oh-my-zsh:

cd /home/sturm/.antigen/bundles/robbyrussell/oh-my-zsh
git status
git log

@popstas
Copy link
Contributor

popstas commented Nov 17, 2020

Just installed at WSL2 on Windows 19042.630 with curl https://raw.githubusercontent.com/viasite-ansible/ansible-role-zsh/master/install.sh | bash, all right...

@SturmB
Copy link
Author

SturmB commented Nov 17, 2020

Please, check git of oh-my-zsh:

Status is clean, log also doesn't show anything wrong:

commit 9b119866dd0e2d5054abd992f4dfbf346ac81b0d (HEAD -> master, origin/master, origin/HEAD)
Author: ratijas <me@ratijas.tk>
Date:   Thu Nov 12 21:32:17 2020 +0300

    refactor(colored-man-pages): move nroff wrapper and refactor logic in `colored` function (#9437)

commit 51772732f54f01522ad5720e8ed0ba16ca3147ae
Author: Alisson B. Santos <alissonbruno.sa@gmail.com>
Date:   Thu Nov 12 16:17:28 2020 +0100

    feat(git): support trunk branches in `git_main_branch` (#9417)

commit 874d83f7b86afbc395915e796cff4e4fe949a204
Author: Subhaditya Nath <56714626+subnut@users.noreply.github.com>
Date:   Thu Nov 12 01:55:32 2020 +0530

    feat(sudo): support aliases to $EDITOR (#9431)

    Co-authored-by: Marc Cornellà <marc.cornella@live.com>

commit 1beac5958ede29855ef2ac4313ada83ed37f5ea8
Author: Rob Vadai <rvadai@segence.com>
Date:   Wed Nov 11 15:14:57 2020 +0000

    docs(aws): add config examples (#9422)

Checking out some of the files in the repo, such as lib/cli.zsh and lib/nvm.zsh does, indeed, indicate that they have CRLF line endings.

So what's the best way to change them to normal Linux LF line endings, assuming that's the only problem with these files?

@SturmB
Copy link
Author

SturmB commented Nov 17, 2020

I was able to fix the problem (for now) by just removing antigen with rm -rf ~/.antigen and then re-running my ansible playbook that contains this role.

I'm still getting the odd message Seems zsh-users/zsh-autosuggestions is already installed! and it also still doesn't explain how things got messed up in the first place, but at least zsh is now working as expected.

@popstas
Copy link
Contributor

popstas commented Nov 18, 2020

Check core.autocrlf config:

git config --global core.autocrlf

And change it to input for avoid future line endings convert:

git config --global core.autocrlf input

Autosuggestions: check ~/.zshrc, is it contains one zsh-users/zsh-autosuggestions include?

@SturmB
Copy link
Author

SturmB commented Nov 18, 2020

The global core.autocrlf is not set, so I guess it uses the default (auto?)

However, for a short time, a different—but related—repo had autocrlf = true set in its .gitconfig file. I removed that line before removing and reinstalling antigen as I mentioned in my last comment. I can only surmise that played some part in this weirdness.

@popstas
Copy link
Contributor

popstas commented Nov 18, 2020

auto is OS-dependent, so better set it to input, it more explicit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants