Giter Club home page Giter Club logo

Comments (6)

halostatue avatar halostatue commented on September 18, 2024

I’m not sure what you mean by "mackup is the source for the add command", because the chezmoi mackup support is mostly unsupported and undocumented, and I’m not sure that adding more explicit support for its idiosyncratic configuration mechanism would be a good thing. Especially as mackup support is only enabled for macOS, although it appears that mackup has some Linux support now.

I’m not seeing anything that suggests that ~/.config/iterm2/AppSupport/DynamicProfiles should be a link to ~/Library/Application Support/iTerm2/DynamicProfiles or something like that.

from chezmoi.

twpayne avatar twpayne commented on September 18, 2024

Part of the iterm2/AppSupport/DynamicProfiles file (directory) is a symlink, specifically the AppSupport:

~ ❯ ls -an ~/.config/iterm2/                                          
total 0
drwxr-xr-x   3 501  20   96 Jul 16  2021 .
drwxr-xr-x  10 501  20  320 Dec  8 23:42 ..
lrwxr-xr-x   1 501  20   46 Jul 16  2021 AppSupport -> /Users/<NAME>/Library/Application Support/iTerm2

Hence adding this won't work.

What do you mean by "adding this won't work"? chezmoi supports symlinks and running

chezmoi add ~/.config/iterm2

results in private_dot_config/iterm2/symlink_AppSupport being added to the source state with the contents /Users/<NAME>/Library/Application Support/iTerm2.

What different result would you want?

from chezmoi.

ronlut avatar ronlut commented on September 18, 2024

Maybe it wasn't clear enough, or I am missing something, I will try to explain a bit more:
iterm as an example stores files in /Users/<NAME>/.config/iterm2/AppSupport/DynamicProfiles which is actually, after symlink evaluation is /Users/<NAME>/Library/Application\ Support/iTerm2/DynamicProfiles.
What's important to backup here is not the symlink itself, but the files inside the target directory.
I am getting an error when trying to do that:

~ ❯ chezmoi add ~/.config/iterm2/AppSupport/DynamicProfiles            20:38:15
chezmoi: lstat /Users/<NAME>/.local/share/chezmoi/dot_config/iterm2/symlink_AppSupport/DynamicProfiles: not a directory

And I don't get an error with: chezmoi add /Users/<NAME>/Library/Application\ Support/iTerm2/DynamicProfiles

For example if a file named "a.txt" is in that directory, it will be backed up with method 2 but not with method 1.

from chezmoi.

ronlut avatar ronlut commented on September 18, 2024

What I am suggesting is just doing filepath.EvalSymlinks on each path passed to the add logic from mackup command (or in general actually).

from chezmoi.

halostatue avatar halostatue commented on September 18, 2024

I’m not sure that would quite do what you really want, as to me you would want chemzoi add ~/.config/iterm2/AppSupport/DynamicProfiles actually add:

  • private_dot_config/iterm2/symlink_AppSupport
  • private_Library/Application Support/iTerm2/DynamicProfiles/*

That feels like too much magic to be a default behaviour. At the same time, I think that the lstat error provided is not useful, especially as it happens even with --follow enabled (where I would expect it to traverse through but only add private_dot_config/iterm2/AppSupport/DynamicProfiles/*).

I think that we have two issues:

  1. chezmoi cannot pass through a directory symlink at all during add resolution, even with --follow. This is surprising and I think that it's a bug.

  2. chezmoi should not magic its way into doing the right thing, but with a two step command the right thing should be possible, although it may require new flags that I don't have good names for:

    chezmoi add ~/.config/iterm2/AppSupport
    chezmoi add ~/.config/iterm2/AppSupport/DynamicProfiles --resolve-to-real-files
    

from chezmoi.

ronlut avatar ronlut commented on September 18, 2024

I agree it's a bug, as I don't have enough history with chezmoi I thought it's expected.

Regarding the expected behaviour, I am not sure I agree:
The symlink is not something I try to backup at all. It's created by iterm and I'm OK with not backing it up, all I am interested in (and expect to work) is add private_dot_config/iterm2/AppSupport/DynamicProfiles/* which is what I suggest will happen when running chezmoi mackup add iterm2 (after symlink evaluation in the mackup cmd).

I agree there's an inherent problem of backing up this path and hoping it will apply successfully on another machine where iterm not necessarily set up the same symlink for AppSupport, but that is to handle by chezmoi user specifically for his use case (for example, having it apply to a different location depending on os).

What I am trying to say is the real value I see in the mackup integration is having the real backup paths available in a single command, hence I suggested to just evalsymlinks each mackup path before adding.

I am OK with closing this issue without any action, it's not that important, just wanted to explain my thoughts 🤓

from chezmoi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.