pimutils / khal

:calendar: CLI calendar application
https://lostpackets.de/khal/
MIT License
2.54k stars 198 forks source link

When starting khal it throws critical: default_calendar may not be read_only! #1287

Closed Janik-Haag closed 11 months ago

Janik-Haag commented 11 months ago

Describe the bug A clear and concise description of what the bug is. I can't start khal because of the error: critical: default_calendar may not be read_only!

If applicable: Stack Trace Please copy the stack trace if khal crashes. No stacktrace

To Reproduce Steps to reproduce the behavior: I'm using this khal config:

[calendars]
[[c3voc]]
path = /home/janik/.cal/c3voc/
readonly = True
priority=10
type=calendar

[[nerdberg]]
path = /home/janik/.cal/nerdberg/
readonly = True
color=white
priority=10
type=calendar

[default]
default_calendar=c3voc
highlight_event_days=true

and this vdirsyncer config:

[general]
status_path = "/home/janik/.local/share/vdirsyncer/status"

### Pairs

[pair calendar_c3voc]
a = "calendar_c3voc_remote"
b = "calendar_c3voc_local"
collections = null
conflict_resolution = "a wins"

[pair calendar_nerdberg]
a = "calendar_nerdberg_remote"
b = "calendar_nerdberg_local"
collections = null
conflict_resolution = "a wins"

### Local storages

[storage calendar_c3voc_local]
fileext = ".ics"
path = "/home/janik/.cal/c3voc"
post_hook = "/nix/store/8gsphv5ady2r4k41bx4sc7smc5s59rhf-post-hook/bin/post-hook"
type = "filesystem"

[storage calendar_nerdberg_local]
fileext = ".ics"
path = "/home/janik/.cal/nerdberg"
post_hook = "/nix/store/8gsphv5ady2r4k41bx4sc7smc5s59rhf-post-hook/bin/post-hook"
type = "filesystem"

### Remote storages

[storage calendar_c3voc_remote]
type = "http"
url = "https://c3voc.de/eventkalender/events.ical"

[storage calendar_nerdberg_remote]
type = "http"
url = "https://kalender.nerdberg.de/events.ics"

after running:

vdirsyncer discover calendar_c3voc
vdirsyncer discover calendar_nerdberg
vdirsyncer sync

the calendars are indeed not readonly, so I did chmod -R 500 ~/.cal/ but that didn't solve it.

Expected behavior A clear and concise description of what you expected to happen. Start khal/ikhal as expected

OS, version, khal version and how you installed it:

{ config, ... }:
{
  services.vdirsyncer.enable = true;
  programs.khal = {
    enable = true;
    # need a locale to be set
  };

  programs.vdirsyncer = {
    enable = true;
  };

  accounts.contact.basePath = "${config.home.homeDirectory}/.con";
  accounts.calendar = {
    basePath = "${config.home.homeDirectory}/.cal";
    accounts = {
      c3voc = {
        primary = true;
        primaryCollection = "c3voc";
        khal = {
          enable = true;
          # color = "white";
          readOnly = true;
          type = "calendar";
        };
        local.type = "filesystem";
        local.fileExt = ".ics";
        name = "c3voc";
        remote = {
          type = "http";
          url = "https://c3voc.de/eventkalender/events.ical";
        };
        vdirsyncer = {
          enable = true;
          collections = null;
          conflictResolution = "remote wins";
        };
      };
      nerdberg = {
        khal = {
          enable = true;
          color = "white";
          readOnly = true;
          type = "calendar";
        };
        local.type = "filesystem";
        local.fileExt = ".ics";
        name = "Nerdberg";
        remote = {
          type = "http";
          url = "https://kalender.nerdberg.de/events.ics";
        };
        vdirsyncer = {
          enable = true;
          collections = null;
          conflictResolution = "remote wins";
        };
      };
    };
  };
}
WhyNotHugo commented 11 months ago

I guess that we can drop the warning if you’re not doing any write operation (new, edit, import, etc).

d7415 commented 11 months ago

It's complaining because the default calendar is mostly used for adding new events, which is a write action, and c3voc is set to read only in your configuration.

I take it from that and your vdirsyncer configuration you're trying to use khal without any new/edit functionality?

If so, try without the default_calendar=c3voc line.

Janik-Haag commented 11 months ago

I guess that we can drop the warning if you’re not doing any write operation (new, edit, import, etc).

It's not just complaining it's straight up crashing.

Janik-Haag commented 11 months ago

It's complaining because the default calendar is mostly used for adding new events, which is a write action, and c3voc is set to read only in your configuration.

I take it from that and your vdirsyncer configuration you're trying to use khal without any new/edit functionality?

If so, try without the default_calendar=c3voc line.

Thanks that fixed it, I didn't quite know what to make of the error, closing this since it works now but some more verbose error message might be nice :D