Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misplaced END:VCALENDAR #205

Open
JM-Lemmi opened this issue Jan 10, 2024 · 9 comments
Open

Misplaced END:VCALENDAR #205

JM-Lemmi opened this issue Jan 10, 2024 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@JM-Lemmi
Copy link
Owner

JM-Lemmi commented Jan 10, 2024

history file includes a misplaced END:VCALENDAR somewhere in the middle, which leads to a parser error on the next history run.

broken files can be found like this:

for f in *.ics; do echo -n "$f "; cat "$f" | grep "END:VCALENDAR" | wc -l; done;

instead of BEGIN:VEVENT an END:VCALENDAR is placed in the middle somwhere

68,69c68,69
< BEGIN:VEVENT
< UID:20231220T080000-20231220T140000@egid.lp-parser.r110
---
> END:VCALENDAR
> ID:20231220T080000-20231220T140000@egid.lp-parser.r110

fehler scheint am 27.12. zw 5 uhr und 12 uhr aufgetreten zu sein

@JM-Lemmi JM-Lemmi added the bug Something isn't working label Jan 10, 2024
@JM-Lemmi JM-Lemmi self-assigned this Jan 10, 2024
@JM-Lemmi
Copy link
Owner Author

grep -rn /etc/ical-relay/calstore -e '^ID:' findet den fehler auch

@JM-Lemmi
Copy link
Owner Author

JM-Lemmi commented Jan 10, 2024

grep -l -rn /etc/ical-relay/calstore -e '^ID:' <- all files with the error

sed -i 's/^ID:/UID:/' <- fix error

grep -l -rn /etc/ical-relay/calstore -e '^ID:' | xargs -I '{}' sed -i 's/^ID:/UID:/' {} <- all in one line

@JM-Lemmi
Copy link
Owner Author

END:VCALENDAR tritt am Ende der Timezone auf, mit dem ersten Event

image

@JM-Lemmi
Copy link
Owner Author

Fehler scheint erstmal nicht wieder aufgetreten zu sein. Möglicherweise ein einmaliger Fehler dank Out Of Memory?

@robske110 robske110 removed the bug Something isn't working label Jan 14, 2024
@robske110
Copy link
Collaborator

Closing this for now, most likely caused by a bad OOM crash of the server

@JM-Lemmi JM-Lemmi reopened this Mar 20, 2024
@JM-Lemmi
Copy link
Owner Author

The issue persists.

@JM-Lemmi
Copy link
Owner Author

It looks to me, like the misplaced END:VCALENDAR is directly following END:VTIMEZONE. This element also seems wildly misplaced. Instead of the very beginning its somewhere in the middle.

root@j-bwc-cal:/home/debian# grep -rn /etc/ical-relay/calstore -e '^ID:'
/etc/ical-relay/calstore/TEL23D-past.ics:1451:ID:20231122T100555Z-384609001@group-e.dhbw-mannheim.de
/etc/ical-relay/calstore/TINF21CS1-past.ics:86:ID:20240320T090000Z-386958001@group-e.dhbw-mannheim.de
/etc/ical-relay/calstore/WWI23SCB-past.ics:799:ID:20240129T074346Z-390621001@group-e.dhbw-mannheim.de

@JM-Lemmi JM-Lemmi added the bug Something isn't working label Mar 20, 2024
@JM-Lemmi
Copy link
Owner Author

grep for all files, where END:VCALENDAR appears twice

for f in *.ics; do echo -n "$f "; cat "$f" | grep "END:VCALENDAR" | wc -l; done | grep " 2"

@JM-Lemmi
Copy link
Owner Author

replacing:

multiline sed or grep or awk is horrible, I couldnt do it. So here ismy other proposed fix:

we have a command that prints all the filenames, and we know that the first VCALENDAR is probably the wrong one, so we just match for that.

❗ this command is dangerous and might corrupt other files!

sed -i -z 's/END:VCALENDAR/BEGIN:VEVENT/' file.ics <- replace in place the first occurence of END:VCALENDAR mit BEGIN:VEVENT. dass er nur das erste matcht liegt an dem fehlenden G.

Sanity check: sed -z 's/END:VCALENDAR/BEGIN:VEVENT/' TEL23D-past.ics | grep END:VCALENDAR -A5 -B5 ohne -i printet das auf stdout und mit dem grep danach sehen wir, ob es am ende noch steht und sonst nicht mehr auftacuht, genau wie wir es haben wollen.

wir bekommen die Liste mit dateinamen mit dem wc hinten dran zum filtern, der muss also wieder weg: sed 's/..$//'

der command muss im richtigen ordner ausgeführt werden, da er keine absoluten pfade enthält

for f in *.ics; do echo -n "$f "; cat "$f" | grep "END:VCALENDAR" | wc -l; done | grep " 2" | sed 's/..$//' | xargs -I '{}' sed -i -z 's/END:VCALENDAR/BEGIN:VEVENT/' {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants