kovetskiy / mark

Sync your markdown files with Confluence pages.
https://samizdat.dev
Other
972 stars 143 forks source link

SIGSEV on WSL/Debian 12 #413

Open Coalmine-Canary opened 5 months ago

Coalmine-Canary commented 5 months ago

What happened? A SIGSEV (invalid memory address or nil pointer dereference)

What did you expect to happen?

How can we reproduce the behavior you experienced? Steps to reproduce the behavior:

  1. Add PAT token as "password" and base_url to config file
  2. Run mark with -c $config_file -f file_name and -l $confluence_page_path

May be related to using WSL (debian 12)

In case this is related to specific markdown, please provide a minimal markdown example here.

Information (please complete the following information)

Logs or other output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xabda95]

goroutine 1 [running]:
main.processFile({0x7ffe6933bca6, 0x19}, 0xb9df60?, 0x0?, {0x7ffe6933bd06?, 0x9}, {0x0, 0x0})
        /home/runner/work/mark/mark/main.go:290 +0x2f5
main.RunMark(0xc0001b88c0)
        /home/runner/work/mark/mark/main.go:241 +0x710
main.main.func2(0xc0001ac2c0?)
        /home/runner/work/mark/mark/main.go:175 +0x19
github.com/urfave/cli/v2.(*Command).Run(0xc0001ac2c0, 0xc0001b88c0, {0xc000034070, 0x7, 0x7})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x9eb
github.com/urfave/cli/v2.(*App).RunContext(0xc000238000, {0xfeacf8?, 0xc000038148}, {0xc000034070, 0x7, 0x7})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x616
github.com/urfave/cli/v2.(*App).Run(...)
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:309
main.main()
        /home/runner/work/mark/mark/main.go:179 +0x13a

Additional context Add any other context about the problem here.

mrueg commented 5 months ago

Which mark version is that trace from? Can you give me the output for v9.11.1 and the content of your config file.

Coalmine-Canary commented 5 months ago

Thanks for responding mrueg,

That is from v9.11.1 and from all the versions that proceeded it down to v9.6.2 (it was the same in all of them).

Config looks like this (I also tried with a username set): password = "CONFLUENCE_TOKEN" base_url = "https://confluence.company.domain.com"

I've just re-run on v9.11.1, here is the error on that version:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xae7eaa]

goroutine 1 [running]:
main.processFile({0xc0002101b0, 0x81}, 0xbce9a0?, 0x0?, {0x7ffdbbf68cec?, 0x9}, {0x0, 0x0})
        /home/runner/work/mark/mark/main.go:325 +0x3aa
main.RunMark(0xc000266900)
        /home/runner/work/mark/mark/main.go:274 +0x710
github.com/urfave/cli/v2.(*Command).Run(0xc0002322c0, 0xc000266900, {0xc000136000, 0x7, 0x7})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279 +0xa3c
github.com/urfave/cli/v2.(*App).RunContext(0xc000176600, {0x10423c8?, 0xc00012e078}, {0xc000136000, 0x7, 0x7})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337 +0x63a
github.com/urfave/cli/v2.(*App).Run(...)
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:311
main.main()
        /home/runner/work/mark/mark/main.go:212 +0x13a
mrueg commented 5 months ago

What happens if you add --space YOUR_SPACE to it? I believe there is a doc that hasn't a space set and the CLI doesn't set one either.

Coalmine-Canary commented 5 months ago

Same error, I was trying before with the space set in the document like the README suggests, I have just tried with --space too.

mrueg commented 5 months ago

Can you share the content of the file (or at least the rough patterns it has)?

Coalmine-Canary commented 5 months ago

This isn't the real content but it looks like this and it's quite a small file.

Heading:
 - Lorum ipsum dolor sit amet
 - Lorum ipsum dolor sit amet

Heading 2:
- Lorum ipsum dolor sit amet

Previously I had the space set like this <!-- Space: My Space -->

mrueg commented 5 months ago

This isn't the real content but it looks like this and it's quite a small file.

Heading:
 - Lorum ipsum dolor sit amet
 - Lorum ipsum dolor sit amet

Heading 2:
- Lorum ipsum dolor sit amet

Previously I had the space set like this <!-- Space: My Space -->

The Heading is using '#' ?

Coalmine-Canary commented 5 months ago

No not in this case.

mrueg commented 5 months ago

Have you tried adding a <!-- Title: My page --> in addition or supply that via the command line? Also, can you re-run it with --debug ?

Coalmine-Canary commented 5 months ago

Sorry for the delay on this, I have just tried that and here is the log. I have redacted company-specific stuff

2024-01-29 11:24:32.387 DEBUG config:
2024-01-29 11:24:32.387 DEBUG                files: /mnt/c/Users/-/notes/file.md
2024-01-29 11:24:32.387 DEBUG         compile-only: false
2024-01-29 11:24:32.387 DEBUG              dry-run: false
2024-01-29 11:24:32.387 DEBUG            edit-lock: false
2024-01-29 11:24:32.387 DEBUG              drop-h1: false
2024-01-29 11:24:32.387 DEBUG     strip-linebreaks: false
2024-01-29 11:24:32.387 DEBUG        title-from-h1: false
2024-01-29 11:24:32.387 DEBUG           minor-edit: false
2024-01-29 11:24:32.387 DEBUG                color: auto
2024-01-29 11:24:32.387 DEBUG                debug: true
2024-01-29 11:24:32.387 DEBUG                trace: false
2024-01-29 11:24:32.387 DEBUG             username:
2024-01-29 11:24:32.387 DEBUG             password: ******
2024-01-29 11:24:32.387 DEBUG           target-url: https://confluence.-.-.com/pages/viewpage.action?pageId=471074714
2024-01-29 11:24:32.387 DEBUG             base-url: https://confluence.-.-.com
2024-01-29 11:24:32.387 DEBUG               config: /home/joe/.config/mark/config.toml
2024-01-29 11:24:32.387 DEBUG                   ci: false
2024-01-29 11:24:32.387 DEBUG                space: Space Here
2024-01-29 11:24:32.387 DEBUG              parents:
2024-01-29 11:24:32.387 DEBUG    parents-delimiter: /
2024-01-29 11:24:32.387 DEBUG     mermaid-provider: cloudscript
2024-01-29 11:24:32.387 DEBUG        mermaid-scale: 1
2024-01-29 11:24:32.387 DEBUG         include-path:
2024-01-29 11:24:32.387 DEBUG                 help: false
2024-01-29 11:24:32.387 DEBUG              version: false
2024-01-29 11:24:32.387 INFO  processing /mnt/c/Users/-/file.md
2024-01-29 11:24:32.391 WARN  specified file contains metadata, but it will be ignored due specified command line URL
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xae7eaa]

goroutine 1 [running]:
main.processFile({0xc000164980, 0x7f}, 0xbce9a0?, 0x0?, {0x7ffe386dace1?, 0x9}, {0x0, 0x0})
        /home/runner/work/mark/mark/main.go:325 +0x3aa
main.RunMark(0xc000266900)
        /home/runner/work/mark/mark/main.go:274 +0x710
github.com/urfave/cli/v2.(*Command).Run(0xc0002322c0, 0xc000266900, {0xc000136000, 0xa, 0xa})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/command.go:279 +0xa3c
github.com/urfave/cli/v2.(*App).RunContext(0xc000176600, {0x10423c8?, 0xc00012e078}, {0xc000136000, 0xa, 0xa})
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:337 +0x63a
github.com/urfave/cli/v2.(*App).Run(...)
        /home/runner/work/pkg/mod/github.com/urfave/cli/v2@v2.27.1/app.go:311
main.main()
        /home/runner/work/mark/mark/main.go:212 +0x13a

Thanks for your help so far on this! :)

mrueg commented 5 months ago

Could you test this with a simple markdown file that you can share the content with? Something like:

<!-- Title: My test -->

This is my test markdown.
Coalmine-Canary commented 4 months ago

Thanks @mrueg, have just tried again with the below filecontent and same result.

Content:

<!-- Title: Test Sync -->
This is my test markdown.