Code Monkey home page Code Monkey logo

Comments (4)

twpayne avatar twpayne commented on June 17, 2024

Thanks for reporting this.

I need more information to be able to reproduce this:

  1. Is there anything special about any of the path elements in ~/.config/helix/themes/ayu_custom.toml, for example, are you using .chezmoiexternal or external_?
  2. What is the output of chezmoi dump ~/.config/helix?

from chezmoi.

jakeswenson avatar jakeswenson commented on June 17, 2024

Hey thanks for getting back to me @twpayne.
I manually worked around this issue by doing the copy myself, so i can't reproduce it anymore with the same commands, but I think i narrowed down the issue to doing chemoi add on a file in a directory that doesn't exist in the source...

i.e.

$ mkdir ~/.config/helix/t/
$ cp ~/.config/helix/themes/ayu_custom.toml ~/.config/helix/t/custom.toml
$ chezmoi add ~/.config/helix/t/custom.toml
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x11 pc=0x10356e890]

goroutine 1 [running]:
github.com/twpayne/chezmoi/v2/internal/chezmoi.(*SourceState).Add(0x140001aed80, {0x1045d5d60, 0x14000588500}, {0x1045d30b0, 0x1400045acf0}, {0x1045d5ec0, 0x140002f6ba0}, 0x14000637740, 0x140007b5868)
        github.com/twpayne/chezmoi/v2/internal/chezmoi/sourcestate.go:420 +0x1540
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).runAddCmd(0x140003dd008, 0x14000254908?, {0x1400042b1c0?, 0x0?, 0x0?}, 0x140001aed80)
        github.com/twpayne/chezmoi/v2/internal/cmd/addcmd.go:179 +0x280
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).newAddCmd.(*Config).makeRunEWithSourceState.func2(0x14000254908, {0x1400042b1c0, 0x1, 0x1})
        github.com/twpayne/chezmoi/v2/internal/cmd/config.go:1533 +0x88
github.com/spf13/cobra.(*Command).execute(0x14000254908, {0x1400042b190, 0x1, 0x1})
        github.com/spf13/[email protected]/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x14000254308)
        github.com/spf13/[email protected]/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(...)
        github.com/spf13/[email protected]/command.go:1039
github.com/twpayne/chezmoi/v2/internal/cmd.(*Config).execute(0x140007b5dd8?, {0x1400003c340, 0x2, 0x2})
        github.com/twpayne/chezmoi/v2/internal/cmd/config.go:1202 +0x70
github.com/twpayne/chezmoi/v2/internal/cmd.runMain({{0x10427d790, 0x6}, {0x10427e9e0, 0x28}, {0x10427e720, 0x14}, {0x10427e638, 0x8}}, {0x1400003c340, 0x2, ...})
        github.com/twpayne/chezmoi/v2/internal/cmd/cmd.go:269 +0x18c
github.com/twpayne/chezmoi/v2/internal/cmd.Main({{0x10427d790, 0x6}, {0x10427e9e0, 0x28}, {0x10427e720, 0x14}, {0x10427e638, 0x8}}, {0x1400003c340?, 0x10303d468?, ...})
        github.com/twpayne/chezmoi/v2/internal/cmd/cmd.go:105 +0x54
main.main()
        github.com/twpayne/chezmoi/v2/main.go:24 +0xd8

$ mkdir ~/.local/share/chezmoi/dot_config/exact_helix/t/

$ chezmoi add ~/.config/helix/t/custom.toml
works fine here ^

Fails with seg fault. my source path looks like ~/.local/share/chezmoi/dot_config/exact_helix/

i wonder if it has to do with exact_helix adding a new file + dir into that?

to you questions:

  1. nothing special. I don't use externals.
  2. not sure this is needed given the repro details above... it just spits out a json dump of that directory...

from chezmoi.

jakeswenson avatar jakeswenson commented on June 17, 2024

I'd guess that the sourceStateDir is nil here:

case sourceStateDir.Attr.External:

from chezmoi.

twpayne avatar twpayne commented on June 17, 2024

Thank you for the extra information. It's the exact_ directory that triggers the bug. I can reproduce this now.

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.