beyondcode / herd-community

89 stars 1 forks source link

[Bug]: symlink gets removed from `.zshrc` #208

Closed the-csaba closed 9 months ago

the-csaba commented 1 year ago

Operating system version

macOS Ventura/Sonoma

System architecture

ARM64 (M1, M2, etc)

Herd Version

1.2.2 to 1.3.0

PHP Version

No response

Bug description

When Herd writes its config to the .zshrc file, it breaks the symlink.

I'm one of the guys who has a "dotfiles" repo, and I store my zsh config in it and just symlink it to the home directory. But every time Herd installs a new PHP version or updates itself, the symlink breaks, and the content of the zsh config gets written directly to ~/.zshrc.

Steps to reproduce

Relevant log output

N/A
mpociot commented 1 year ago

Oh interesting, thanks for reporting this. I will update Herd so that we verify if the zshrc file is symlinked, and if it is write to the symlink origin instead of writing to the file itself. 👍

rynhndrcksn commented 12 months ago

I'm glad I found this issue. I thought I was going crazy for a second that it was happening.

@mpociot I'm not sure how much has happened for the development of this, but you are able to append things to symlinked files, you don't have to hunt down the original file.

For example, I have ~/.zshrc and it's pointing to ~/.dotfiles/shell/zshrc.

I can append to that file with the following command:

echo "export HERD_PHP_82_INI_SCAN_DIR='/Users/ryan/Library/Application Support/Herd/config/php/82/'" >> ~/.zshrc

This issue could also be stemming from the fact that after installing Herd, I noticed that the file permissions have a @ after them now.

image

It looks like this is specifically a MacOS thing. Stack Exchange Post.

After running xattr -l ~/.zshrc I get the following output:

com.apple.TextEncoding: utf-8;134217984

Hopefully this helps a bit.

mpociot commented 12 months ago

Yeah it seems like the issue is the way Swift writes to symlinked files as I'm using the macOS Filesystem API. I guess writing to that file via bash is easier in this case.

sschlein commented 9 months ago

Closing this issue because this has been fixed