cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
940 stars 33 forks source link

segfault when backing up github repos #226

Closed Ramblurr closed 3 months ago

Ramblurr commented 3 months ago
gickup --version
0.10.28

This is my first time running gickup (so there are no existing local archives) and the crash looks like this:

$ gickup --dryrun config.yaml 
2024-04-13T12:40:57+02:00 INF this is a dry run dry=true
2024-04-13T12:40:57+02:00 INF Reading config.yaml file=config.yaml
2024-04-13T12:40:57+02:00 INF Configuration loaded destinations=1 pairs=1 sources=1
2024-04-13T12:40:57+02:00 INF Backup run starting
2024-04-13T12:40:57+02:00 INF grabbing the repositories from ramblurr stage=github url=https://github.com
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9ecd61]

goroutine 1 [running]:
github.com/cooperspencer/gickup/github.Get(0xc0002bc248?)
    github.com/cooperspencer/gickup/github/github.go:244 +0x1001
main.runBackup(0xc0002bc248, 0x0)
    github.com/cooperspencer/gickup/main.go:469 +0xc5
main.main()
    github.com/cooperspencer/gickup/main.go:683 +0x125a

My config looks like this:

---
source:
  github:
    - token: redacted
      user: ramblurr
      ssh: false
      filter:
        lastactivity: 2y
        excludeforks: true
destination:
  local:
    - path: /var/lib/git-archive/archive
      structured: true
      zip: true
      keep: 5
      bare: true
      lfs: false

log: # optional
  file-logging: # optional
    dir: /var/lib/git-archive/logs
    file: gickup.log
    maxage: 7

Since that line in github.go looks like it has something to do with the filter, I removed the filter: {...} from the config, but the same crash happens.

And FWIW it behaves the same when I omit --dryrun.

cooperspencer commented 3 months ago

Good Morning,

I'll have a look and get back to you asap.

cooperspencer commented 3 months ago

It's caused by an empty repository, https://github.com/Ramblurr/scriptsbots to be exact. That's a very good catch, thanks for that. I'll try to fix it and push a new release soon.

cooperspencer commented 3 months ago

Should be fixed with https://github.com/cooperspencer/gickup/pull/227

cooperspencer commented 3 months ago

I pushed a new release withe the fix