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

fix _zsh_highlight_load_highlighters when executing zsh with sudo rights #518

Merged
merged 1 commit into from Jun 3, 2018
Merged

Conversation

qoomon
Copy link
Contributor

@qoomon qoomon commented May 30, 2018

I am facing following error message if i start my zsh with sudo right e.g. sudo zsh

Error Log
_zsh-syntax-highlighting: 'README.md' highlighter should define both required functions '_zsh_highlight_highlighter_README.md_paint' and 'zsh_highlight_highlighter_README.md_predicate' in '/Users/USERNAME/.zsh.zgem/gems/zsh-syntax-highlighting/highlighters/README.md/README.md-highlighter.zsh'.

this is caused by a really strange behaviour of zsh itself.

ZSH Issue Example

If you create a file and folder

mkdir -p folder
touch file

...,if you want to print only folders globing works as expected

echo ./*/
>> ./folder/

..., however if you run the same command with sudo it will also print the file, as a folder.
thats totally weird.

sudo zsh -c 'echo ./*/'
>> ./file/ ./folder/

Solution

Because thats a zsh issue I adjust the globing expression, now it works as expected.

@danielshahaf
Copy link
Member

Cross-referencing #506. More below

..., however if you run the same command with sudo it will also print the file, as a folder.
thats totally weird.

sudo zsh -c 'echo ./*/'

./file/ ./folder/

I can't reproduce that. Please change -c to -fc and try again. What's the zsh version, distro, and mount output for the relevant mountpoint?

Solution

Because thats a zsh issue I adjust the globing expression, now it works as expected.

Thanks for the analysis. I'd still like to double-check whether it's really a bug in the */ syntax, before I avoid it.

@qoomon
Copy link
Contributor Author

qoomon commented May 30, 2018

macOS 10.13.4 (17E202)
zsh 5.5.1 (x86_64-apple-darwin17.5.0)

I changed parameter to -fc still wrong result with sudp

@danielshahaf
Copy link
Member

danielshahaf commented May 30, 2018 via email

@danielshahaf
Copy link
Member

danielshahaf commented May 30, 2018 via email

@qoomon
Copy link
Contributor Author

qoomon commented May 30, 2018

It was me :-D

so i test with ubuntu and i can not reproduce it there, however i tried it on macos of my colleges and it seem like its not a problem only on my mashines

@qoomon
Copy link
Contributor Author

qoomon commented May 30, 2018

zsh --version => zsh 5.5.1 (x86_64-apple-darwin17.5.0)
sudo zsh --version => zsh 5.5.1 (x86_64-apple-darwin17.5.0)

@qoomon
Copy link
Contributor Author

qoomon commented Jun 2, 2018

Hey, would be great if you could except my pull request, cause I think it will take some time until zsh is fixed :-(
And may patch is only 3 characters long :-D

@phy1729
Copy link
Member

phy1729 commented Jun 3, 2018

I'd like to move to autoloading the highlighters in the future, but this patch is tiny as you point out, so I think it's reasonable to merge it. Could you rebase into a single commit and match the commit message style? (Something like main: Add glob qualifier to work around zsh/macOS bug and perhaps link to the mailing list thread as well.)

@qoomon
Copy link
Contributor Author

qoomon commented Jun 3, 2018

done

@phy1729 phy1729 merged commit db6cac3 into zsh-users:master Jun 3, 2018
@phy1729
Copy link
Member

phy1729 commented Jun 3, 2018

Thanks for the report and fix!

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

Successfully merging this pull request may close these issues.

None yet

3 participants