uICAL icon indicating copy to clipboard operation
uICAL copied to clipboard

Fix: Respect `UNTIL` field in `RRULE` evaluation

Open HGinnerup opened this issue 4 months ago • 10 comments

What was wrong

The RRULE property UNTIL was being silently ignored.

How

Although RRuleIter had a DateTime until member (src/uICAL/rruleiter.h:36), it was never initialized.

As the until value is already parsed and stored in the parent RRule rr, and there appears to be no reason for them to differ, I updated RRuleIter::expired() to reference this->rr->until directly.

New failing tests

Some tests fail with TZAwarenessConflictError, e.g.

test/cpp/test_rrule.cpp:146: FAILED:
explicitly with message:
  EXEP: 19980101T090000 RRULE:FREQ=YEARLY;UNTIL=20000131T140000Z;BYMONTH=1;
  BYDAY=TH,SA
   msg: TZAwarenessConflictError: 20000131T140000ZZ <> 19980101T090000

It's in the binary comparison between datetimes, it expects both to have the same timezone. I don't think it's a new bug, so much as it just failed to compare until before.

No other cpp tests fail after disabling these checks - I don't know how to run the python tests.

HGinnerup avatar Jul 30 '25 17:07 HGinnerup

Thank you @HGinnerup for your contribution.

Please can you investigate/resolve the issue with the failing C++ test. And run the Python tests.

To run tests see DEVELOPMENT.md, e.g.:

devenv/make-devenv.sh
./de
make test-cpp
make test-python

The environment does however need an update. This has been done in v0.0.3, please rebase.

It would be good if all C++ and Python tests can run in the Docker env.

sourcesimian avatar Jul 31 '25 12:07 sourcesimian

Just to update, I intended to just respond along with a fix, but it's dragging out as I'm unfamliar with GDB. I'm more from the C# level of things.

I think I've so far narrowed it down to test_rrule.ccp:test_basic never assigning the timezone the tested datetimes, but it gets set correctly for until.

I'm still working to figure out the best way to resolve it.

HGinnerup avatar Aug 01 '25 13:08 HGinnerup

Your efforts are very much appreciated!

sourcesimian avatar Aug 01 '25 19:08 sourcesimian

Hi, sorry for the big / growing PR.

It took some work to understand the test setup and incorporate timezones. While doing so, I noticed that "test_basic" didn't previously check if the rruleiter could produce past the expected.

Errors in rrule.txt

Fixing test_basic has revealed some errors in test/data/rrule.txt, e.g. Case at line 27:

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=DAILY;UNTIL=19970907T090000 # Missing timezone, but every example on icalendar.org uses timezone Z, which is UTC
 - 19970902T090000
 - 19970903T090000
 - 19970904T090000
 - 19970905T090000
 - 19970906T090000
 - 19970907T090000 # Would be past the UNTIL if using timezone Z

(See comments in snippet)

test/data/rrule.txt:452

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z
 - 19970902T090000
 - 19970902T120000
 - 19970902T150000 # Past the UNTIL - I've messaged icalendar.org about this one, as this exact case is in their examples

(See comment in snippet)

test/data/rrule.txt:567

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=DAILY;COUNT=4
EXDATE;TZID=America/New_York:19970903T090000
EXDATE;TZID=America/New_York:19970904T090000
 - 19970902T090000
 - 19970905T090000

This one I believe is missing 2 cases. I've struggled to find anything about the combination of UNTIL and EXDATE on icalendar.org, but the implementation returns more than 2 occurances, and I think it makes sense that it would return 4, but just jumping past the EXDATE dates.

I believe these cases are straight forward to fix, but I bring it up as I'm a bit cautious about changing the expected test values.

Next up

Cpp is done, but the python tests are still very upset about the timezone differences. I'll have a look at it later if you're okay with my changes so far.

HGinnerup avatar Aug 02 '25 17:08 HGinnerup

Wow this is an awesome contribution!

When I was coding this (which was actually my third attempt) I encountered a fair bit of ambiguity in interpreting the RFC, sometimes so much it made my head want to explode. Thus I resolved to take a TDD approach of adding as many known tests as I could find or come up with, and then just make sure all the tests passed. I still wish that this code could be simpler, perhaps there is some far more elegant implementation? But RRULE does not make it easy.

Thank you for your time and efforts!

sourcesimian avatar Aug 02 '25 18:08 sourcesimian

Timezone info has been added to the python tests, and all tests pass now 🥳

I ended up engaging in python abuse to infer the tzmap, as tzmap isn't exported to python and I don't understand the python-module, but eh.. Python now reads the test-cases the same as cpp does, and everything is tested and passes.

HGinnerup avatar Aug 04 '25 08:08 HGinnerup

Good work! Thank you.

I would like to provide you with the TZMap python exports, but I can only do so at towards the end of the month. BTW: I did try using an AI, by giving it the rrule [cpp/h ]and python [cpp/h], and then gave it the tzmap [cpp/h], and it did a pretty good job. I just don't have time to read through and test.

Note: When I run the Python tests:

FAILED test/python/test_rrule.py::test_rrule[---------1] - AssertionError: assert ['19970902T09...-0300', '...'] == ['19970902T09...T090000-0300']
FAILED test/python/test_rrule.py::test_rrule[---------7] - AssertionError: assert ['19970902T09...-0300', '...'] == ['19970902T09...T090000-0300']
FAILED test/python/test_rrule.py::test_rrule[---------9] - AssertionError: assert ['19970902T09...00-0300', ...] == ['19970902T09...00-0300', ...]
FAILED test/python/test_rrule.py::test_rrule[---------14] - AssertionError: assert ['19970905T09...-0300', '...'] == ['19970905T09...T090000-0300']
FAILED test/python/test_rrule.py::test_rrule[---------34] - AssertionError: assert ['19970902T09...-0300', '...'] == ['19970902T09...T120000-0300']
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------1] - AssertionError: Rolling index=1
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------7] - AssertionError: Rolling index=1
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------9] - AssertionError: Rolling index=1
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------14] - AssertionError: Rolling index=1
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------34] - AssertionError: Rolling index=1

sourcesimian avatar Aug 04 '25 13:08 sourcesimian

Attached are some AI generated Python bindings for TZMap - apologies, completely untested?? tzmap.h.txt tzmap.cpp.txt

sourcesimian avatar Aug 04 '25 13:08 sourcesimian

Note: When I run the Python tests:

FAILED test/python/test_rrule.py::test_rrule[---------1] - AssertionError: assert <['19970902T09...-0300', '...'] == ['19970902T09...T090000-0300']
( ... )
FAILED test/python/test_rrule.py::test_rrule_stepping_begin[---------34] - AssertionError: Rolling index=1

Try recompiling. It works for me, but I can replicate those fails by compiling from a different branch, e.g. git checkout updated_makefile; ./de make test-python; git checkout master; PYTHONPATH=. pytest

It should work if you try ./de make test-python

The failing tests seem to be the ones that use UNTIL, but the tests previously didn't check if rrule could generate results past the expected length.

Click for the failing cases from test/data/rrule.txt
DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=DAILY;UNTIL=19970907T090000Z
- 19970902T090000
- 19970903T090000
- 19970904T090000
- 19970905T090000
- 19970906T090000

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971004T090000Z
- 19970902T090000
- 19970909T090000
- 19970916T090000
- 19970923T090000
- 19970930T090000

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=WEEKLY;UNTIL=19971007T000000Z;WKST=SU;BYDAY=TU,TH
- 19970902T090000
- 19970904T090000
- 19970909T090000
- 19970911T090000
- 19970916T090000
- 19970918T090000
- 19970923T090000
- 19970925T090000
- 19970930T090000
- 19971002T090000

DTSTART;TZID=America/New_York:19970905T090000
RRULE:FREQ=MONTHLY;UNTIL=19971224T000000Z;BYDAY=1FR
- 19970905T090000
- 19971003T090000
- 19971107T090000
- 19971205T090000

DTSTART;TZID=America/New_York:19970902T090000
RRULE:FREQ=HOURLY;INTERVAL=3;UNTIL=19970902T170000Z
- 19970902T090000
- 19970902T120000
# - 19970902T150000 # This case exists on icalendar.org, but consider this occurance in UTC, 19970902T180000Z and it's past the UNTIL field

Python module

Sorry, but I don't know how much I really want to mess with the python module right now - maybe some other time.

As it is, I can compile just fine before I add the tzmap.cpp and tzmap.h files you gave me - after I add them, I get this:

Click for 383 lines of compile log
~/repos/uICAL$ pip3 install --editable .

Obtaining file:///home/henrik/repos/uICAL
Preparing metadata (setup.py) ... done
Installing collected packages: uICAL
Running setup.py develop for uICAL
    error: subprocess-exited-with-error
    
    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [182 lines of output]
        running develop
        /home/henrik/repos/uICAL/virtualenv/lib/python3.10/site-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
        /home/henrik/repos/uICAL/virtualenv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
        running egg_info
        writing uICAL.egg-info/PKG-INFO
        writing dependency_links to uICAL.egg-info/dependency_links.txt
        writing top-level names to uICAL.egg-info/top_level.txt
        reading manifest file 'uICAL.egg-info/SOURCES.txt'
        adding license file 'LICENSE'
        writing manifest file 'uICAL.egg-info/SOURCES.txt'
        running build_ext
        building 'uICAL' extension
        x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/calendar.cpp -o build/temp.linux-x86_64-3.10/./python-module/calendar.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
        x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/error.cpp -o build/temp.linux-x86_64-3.10/./python-module/error.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
        x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/rrule.cpp -o build/temp.linux-x86_64-3.10/./python-module/rrule.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
        x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/tzmap.cpp -o build/temp.linux-x86_64-3.10/./python-module/tzmap.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
        In file included from ./src/uICAL/tzmap.h:7,
                        from ./python-module/tzmap.cpp:5:
        ./src/uICAL/base.h:21:52: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
        21 |     ostream& operator << (ostream& out, const std::shared_ptr<T>& b) {
            |                                                    ^~~~~~~~~~
        ./src/uICAL/base.h:1:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
        +++ |+#include <memory>
            1 | /*############################################################################
        ./src/uICAL/base.h:21:62: error: expected ‘,’ or ‘...’ before ‘<’ token
        21 |     ostream& operator << (ostream& out, const std::shared_ptr<T>& b) {
            |                                                              ^
        ./src/uICAL/base.h: In function ‘uICAL::ostream& uICAL::operator<<(uICAL::ostream&, int)’:
        ./src/uICAL/base.h:22:9: error: ‘b’ was not declared in this scope
        22 |         b->str(out);
            |         ^
        In file included from ./python-module/tzmap.cpp:5:
        ./src/uICAL/tzmap.h: At global scope:
        ./src/uICAL/tzmap.h:16:28: error: ‘VObject_ptr’ does not name a type
        16 |             void add(const VObject_ptr& timezone);
            |                            ^~~~~~~~~~~
        ./src/uICAL/tzmap.h:31:24: error: field ‘name’ has incomplete type ‘uICAL::string’
        31 |                 string name;
            |                        ^~~~
        In file included from ./src/uICAL/tzmap.h:7,
                        from ./python-module/tzmap.cpp:5:
        ./src/uICAL/base.h:8:11: note: forward declaration of ‘class uICAL::string’
            8 |     class string;
            |           ^~~~~~
        In file included from ./python-module/tzmap.cpp:5:
        ./src/uICAL/tzmap.h:34:18: error: ‘map’ in namespace ‘std’ does not name a template type
        34 |             std::map<string, attribs_t> id_attrib_map;
            |                  ^~~
        ./src/uICAL/tzmap.h:8:1: note: ‘std::map’ is defined in header ‘<map>’; did you forget to ‘#include <map>’?
            7 | #include "uICAL/base.h"
        +++ |+#include <map>
            8 |
        In file included from ./python-module/tzmap.cpp:6:
        ./src/uICAL/vobject.h:19:13: error: ‘VLine_ptr’ does not name a type
        19 |             VLine_ptr getPropertyByName(const string& name) const;
            |             ^~~~~~~~~
        ./src/uICAL/vobject.h:20:33: error: ‘vector’ in namespace ‘std’ does not name a template type
        20 |             using vector = std::vector<VObject_ptr>;
            |                                 ^~~~~~
        ./src/uICAL/vobject.h:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
        +++ |+#include <vector>
            1 | /*############################################################################
        ./src/uICAL/vobject.h:21:13: error: ‘vector’ does not name a type
        21 |             vector listObjects(const string& name) const;
            |             ^~~~~~
        ./src/uICAL/vobject.h:27:20: error: field ‘name’ has incomplete type ‘uICAL::string’
        27 |             string name;
            |                    ^~~~
        In file included from ./src/uICAL/tzmap.h:7,
                        from ./python-module/tzmap.cpp:5:
        ./src/uICAL/base.h:8:11: note: forward declaration of ‘class uICAL::string’
            8 |     class string;
            |           ^~~~~~
        In file included from ./python-module/tzmap.cpp:6:
        ./src/uICAL/vobject.h:28:18: error: ‘vector’ in namespace ‘std’ does not name a template type
        28 |             std::vector<VLine_ptr> lines;
            |                  ^~~~~~
        ./src/uICAL/vobject.h:28:13: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
        28 |             std::vector<VLine_ptr> lines;
            |             ^~~
        ./src/uICAL/vobject.h:29:18: error: ‘vector’ in namespace ‘std’ does not name a template type
        29 |             std::vector<VObject_ptr> children;
            |                  ^~~~~~
        ./src/uICAL/vobject.h:29:13: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
        29 |             std::vector<VObject_ptr> children;
            |             ^~~
        ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_new(PyTypeObject*, PyObject*, PyObject*)’:
        ./python-module/tzmap.cpp:29:45: warning: unused parameter ‘args’ [-Wunused-parameter]
        29 |     TZMap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
            |                                   ~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp:29:61: warning: unused parameter ‘kwds’ [-Wunused-parameter]
        29 |     TZMap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
            |                                                   ~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp: In function ‘int uical_python::TZMap_init(uical_python::TZMapObject*, PyObject*, PyObject*)’:
        ./python-module/tzmap.cpp:40:29: warning: unused parameter ‘self’ [-Wunused-parameter]
        40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
            |                ~~~~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp:40:45: warning: unused parameter ‘args’ [-Wunused-parameter]
        40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
            |                                   ~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp:40:61: warning: unused parameter ‘kwds’ [-Wunused-parameter]
        40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
            |                                                   ~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_add(uical_python::TZMapObject*, PyObject*)’:
        ./python-module/tzmap.cpp:55:35: error: ‘string’ is not a member of ‘std’
        55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
            |                                   ^~~~~~
        ./python-module/tzmap.cpp:13:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        12 | #include "error.h"
        +++ |+#include <string>
        13 |
        ./python-module/tzmap.cpp:55:54: error: ‘string’ is not a member of ‘std’
        55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
            |                                                      ^~~~~~
        ./python-module/tzmap.cpp:55:54: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        ./python-module/tzmap.cpp:55:73: error: ‘string’ is not a member of ‘std’
        55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
            |                                                                         ^~~~~~
        ./python-module/tzmap.cpp:55:73: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        ./python-module/tzmap.cpp:57:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
        57 |         } catch (uICAL::Error& ex) {
            |                         ^~~~~
        ./python-module/tzmap.cpp:58:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
        58 |             PyErr_SetString(UicalError, ex.message.c_str());
            |                                         ^~
            |                                         exp
        ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_get_offset(uical_python::TZMapObject*, PyObject*)’:
        ./python-module/tzmap.cpp:71:54: error: ‘string’ is not a member of ‘std’
        71 |             int offset = self->tzmap->getOffset(std::string(tzid));
            |                                                      ^~~~~~
        ./python-module/tzmap.cpp:71:54: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        ./python-module/tzmap.cpp:73:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
        73 |         } catch (uICAL::Error& ex) {
            |                         ^~~~~
        ./python-module/tzmap.cpp:74:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
        74 |             PyErr_SetString(UicalError, ex.message.c_str());
            |                                         ^~
            |                                         exp
        ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_get_name(uical_python::TZMapObject*, PyObject*)’:
        ./python-module/tzmap.cpp:87:18: error: ‘string’ is not a member of ‘std’
        87 |             std::string name = self->tzmap->getName(std::string(tzid));
            |                  ^~~~~~
        ./python-module/tzmap.cpp:87:18: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        ./python-module/tzmap.cpp:88:41: error: ‘name’ was not declared in this scope; did you mean ‘tzname’?
        88 |             return PyUnicode_FromString(name.c_str());
            |                                         ^~~~
            |                                         tzname
        ./python-module/tzmap.cpp:89:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
        89 |         } catch (uICAL::Error& ex) {
            |                         ^~~~~
        ./python-module/tzmap.cpp:90:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
        90 |             PyErr_SetString(UicalError, ex.message.c_str());
            |                                         ^~
            |                                         exp
        ./python-module/tzmap.cpp:80:33: warning: unused parameter ‘self’ [-Wunused-parameter]
        80 |     TZMap_get_name(TZMapObject *self, PyObject *args)
            |                    ~~~~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_find_id(uical_python::TZMapObject*, PyObject*)’:
        ./python-module/tzmap.cpp:103:18: error: ‘string’ is not a member of ‘std’
        103 |             std::string id = self->tzmap->findId(std::string(nameOrId));
            |                  ^~~~~~
        ./python-module/tzmap.cpp:103:18: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
        ./python-module/tzmap.cpp:104:41: error: ‘id’ was not declared in this scope
        104 |             return PyUnicode_FromString(id.c_str());
            |                                         ^~
        ./python-module/tzmap.cpp:105:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
        105 |         } catch (uICAL::Error& ex) {
            |                         ^~~~~
        ./python-module/tzmap.cpp:106:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
        106 |             PyErr_SetString(UicalError, ex.message.c_str());
            |                                         ^~
            |                                         exp
        ./python-module/tzmap.cpp:96:32: warning: unused parameter ‘self’ [-Wunused-parameter]
        96 |     TZMap_find_id(TZMapObject *self, PyObject *args)
            |                   ~~~~~~~~~~~~~^~~~
        ./python-module/tzmap.cpp: At global scope:
        ./python-module/tzmap.cpp:129:5: error: designator order for field ‘_typeobject::tp_basicsize’ does not match declaration order in ‘PyTypeObject’ {aka ‘_typeobject’}
        129 |     };
            |     ^
        error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [182 lines of output]
    running develop
    /home/henrik/repos/uICAL/virtualenv/lib/python3.10/site-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
    /home/henrik/repos/uICAL/virtualenv/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
    warnings.warn(
    running egg_info
    writing uICAL.egg-info/PKG-INFO
    writing dependency_links to uICAL.egg-info/dependency_links.txt
    writing top-level names to uICAL.egg-info/top_level.txt
    reading manifest file 'uICAL.egg-info/SOURCES.txt'
    adding license file 'LICENSE'
    writing manifest file 'uICAL.egg-info/SOURCES.txt'
    running build_ext
    building 'uICAL' extension
    x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/calendar.cpp -o build/temp.linux-x86_64-3.10/./python-module/calendar.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
    x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/error.cpp -o build/temp.linux-x86_64-3.10/./python-module/error.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
    x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/rrule.cpp -o build/temp.linux-x86_64-3.10/./python-module/rrule.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
    x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I./python-module -I./src -I/home/henrik/repos/uICAL/virtualenv/include -I/usr/include/python3.10 -c ./python-module/tzmap.cpp -o build/temp.linux-x86_64-3.10/./python-module/tzmap.o -std=c++11 -Wall -Wextra -Wno-missing-field-initializers -g3 -O0 -DDEBUG=1 -UNDEBUG -DUICAL_LOG_LEVEL=5
    In file included from ./src/uICAL/tzmap.h:7,
                    from ./python-module/tzmap.cpp:5:
    ./src/uICAL/base.h:21:52: error: ‘shared_ptr’ in namespace ‘std’ does not name a template type
    21 |     ostream& operator << (ostream& out, const std::shared_ptr<T>& b) {
        |                                                    ^~~~~~~~~~
    ./src/uICAL/base.h:1:1: note: ‘std::shared_ptr’ is defined in header ‘<memory>’; did you forget to ‘#include <memory>’?
    +++ |+#include <memory>
        1 | /*############################################################################
    ./src/uICAL/base.h:21:62: error: expected ‘,’ or ‘...’ before ‘<’ token
    21 |     ostream& operator << (ostream& out, const std::shared_ptr<T>& b) {
        |                                                              ^
    ./src/uICAL/base.h: In function ‘uICAL::ostream& uICAL::operator<<(uICAL::ostream&, int)’:
    ./src/uICAL/base.h:22:9: error: ‘b’ was not declared in this scope
    22 |         b->str(out);
        |         ^
    In file included from ./python-module/tzmap.cpp:5:
    ./src/uICAL/tzmap.h: At global scope:
    ./src/uICAL/tzmap.h:16:28: error: ‘VObject_ptr’ does not name a type
    16 |             void add(const VObject_ptr& timezone);
        |                            ^~~~~~~~~~~
    ./src/uICAL/tzmap.h:31:24: error: field ‘name’ has incomplete type ‘uICAL::string’
    31 |                 string name;
        |                        ^~~~
    In file included from ./src/uICAL/tzmap.h:7,
                    from ./python-module/tzmap.cpp:5:
    ./src/uICAL/base.h:8:11: note: forward declaration of ‘class uICAL::string’
        8 |     class string;
        |           ^~~~~~
    In file included from ./python-module/tzmap.cpp:5:
    ./src/uICAL/tzmap.h:34:18: error: ‘map’ in namespace ‘std’ does not name a template type
    34 |             std::map<string, attribs_t> id_attrib_map;
        |                  ^~~
    ./src/uICAL/tzmap.h:8:1: note: ‘std::map’ is defined in header ‘<map>’; did you forget to ‘#include <map>’?
        7 | #include "uICAL/base.h"
    +++ |+#include <map>
        8 |
    In file included from ./python-module/tzmap.cpp:6:
    ./src/uICAL/vobject.h:19:13: error: ‘VLine_ptr’ does not name a type
    19 |             VLine_ptr getPropertyByName(const string& name) const;
        |             ^~~~~~~~~
    ./src/uICAL/vobject.h:20:33: error: ‘vector’ in namespace ‘std’ does not name a template type
    20 |             using vector = std::vector<VObject_ptr>;
        |                                 ^~~~~~
    ./src/uICAL/vobject.h:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    +++ |+#include <vector>
        1 | /*############################################################################
    ./src/uICAL/vobject.h:21:13: error: ‘vector’ does not name a type
    21 |             vector listObjects(const string& name) const;
        |             ^~~~~~
    ./src/uICAL/vobject.h:27:20: error: field ‘name’ has incomplete type ‘uICAL::string’
    27 |             string name;
        |                    ^~~~
    In file included from ./src/uICAL/tzmap.h:7,
                    from ./python-module/tzmap.cpp:5:
    ./src/uICAL/base.h:8:11: note: forward declaration of ‘class uICAL::string’
        8 |     class string;
        |           ^~~~~~
    In file included from ./python-module/tzmap.cpp:6:
    ./src/uICAL/vobject.h:28:18: error: ‘vector’ in namespace ‘std’ does not name a template type
    28 |             std::vector<VLine_ptr> lines;
        |                  ^~~~~~
    ./src/uICAL/vobject.h:28:13: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    28 |             std::vector<VLine_ptr> lines;
        |             ^~~
    ./src/uICAL/vobject.h:29:18: error: ‘vector’ in namespace ‘std’ does not name a template type
    29 |             std::vector<VObject_ptr> children;
        |                  ^~~~~~
    ./src/uICAL/vobject.h:29:13: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
    29 |             std::vector<VObject_ptr> children;
        |             ^~~
    ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_new(PyTypeObject*, PyObject*, PyObject*)’:
    ./python-module/tzmap.cpp:29:45: warning: unused parameter ‘args’ [-Wunused-parameter]
    29 |     TZMap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        |                                   ~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp:29:61: warning: unused parameter ‘kwds’ [-Wunused-parameter]
    29 |     TZMap_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
        |                                                   ~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp: In function ‘int uical_python::TZMap_init(uical_python::TZMapObject*, PyObject*, PyObject*)’:
    ./python-module/tzmap.cpp:40:29: warning: unused parameter ‘self’ [-Wunused-parameter]
    40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
        |                ~~~~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp:40:45: warning: unused parameter ‘args’ [-Wunused-parameter]
    40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
        |                                   ~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp:40:61: warning: unused parameter ‘kwds’ [-Wunused-parameter]
    40 |     TZMap_init(TZMapObject *self, PyObject *args, PyObject *kwds)
        |                                                   ~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_add(uical_python::TZMapObject*, PyObject*)’:
    ./python-module/tzmap.cpp:55:35: error: ‘string’ is not a member of ‘std’
    55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
        |                                   ^~~~~~
    ./python-module/tzmap.cpp:13:1: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    12 | #include "error.h"
    +++ |+#include <string>
    13 |
    ./python-module/tzmap.cpp:55:54: error: ‘string’ is not a member of ‘std’
    55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
        |                                                      ^~~~~~
    ./python-module/tzmap.cpp:55:54: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    ./python-module/tzmap.cpp:55:73: error: ‘string’ is not a member of ‘std’
    55 |             self->tzmap->add(std::string(tzid), std::string(name), std::string(offset));
        |                                                                         ^~~~~~
    ./python-module/tzmap.cpp:55:73: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    ./python-module/tzmap.cpp:57:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
    57 |         } catch (uICAL::Error& ex) {
        |                         ^~~~~
    ./python-module/tzmap.cpp:58:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
    58 |             PyErr_SetString(UicalError, ex.message.c_str());
        |                                         ^~
        |                                         exp
    ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_get_offset(uical_python::TZMapObject*, PyObject*)’:
    ./python-module/tzmap.cpp:71:54: error: ‘string’ is not a member of ‘std’
    71 |             int offset = self->tzmap->getOffset(std::string(tzid));
        |                                                      ^~~~~~
    ./python-module/tzmap.cpp:71:54: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    ./python-module/tzmap.cpp:73:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
    73 |         } catch (uICAL::Error& ex) {
        |                         ^~~~~
    ./python-module/tzmap.cpp:74:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
    74 |             PyErr_SetString(UicalError, ex.message.c_str());
        |                                         ^~
        |                                         exp
    ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_get_name(uical_python::TZMapObject*, PyObject*)’:
    ./python-module/tzmap.cpp:87:18: error: ‘string’ is not a member of ‘std’
    87 |             std::string name = self->tzmap->getName(std::string(tzid));
        |                  ^~~~~~
    ./python-module/tzmap.cpp:87:18: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    ./python-module/tzmap.cpp:88:41: error: ‘name’ was not declared in this scope; did you mean ‘tzname’?
    88 |             return PyUnicode_FromString(name.c_str());
        |                                         ^~~~
        |                                         tzname
    ./python-module/tzmap.cpp:89:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
    89 |         } catch (uICAL::Error& ex) {
        |                         ^~~~~
    ./python-module/tzmap.cpp:90:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
    90 |             PyErr_SetString(UicalError, ex.message.c_str());
        |                                         ^~
        |                                         exp
    ./python-module/tzmap.cpp:80:33: warning: unused parameter ‘self’ [-Wunused-parameter]
    80 |     TZMap_get_name(TZMapObject *self, PyObject *args)
        |                    ~~~~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp: In function ‘PyObject* uical_python::TZMap_find_id(uical_python::TZMapObject*, PyObject*)’:
    ./python-module/tzmap.cpp:103:18: error: ‘string’ is not a member of ‘std’
    103 |             std::string id = self->tzmap->findId(std::string(nameOrId));
        |                  ^~~~~~
    ./python-module/tzmap.cpp:103:18: note: ‘std::string’ is defined in header ‘<string>’; did you forget to ‘#include <string>’?
    ./python-module/tzmap.cpp:104:41: error: ‘id’ was not declared in this scope
    104 |             return PyUnicode_FromString(id.c_str());
        |                                         ^~
    ./python-module/tzmap.cpp:105:25: error: ‘Error’ in namespace ‘uICAL’ does not name a type
    105 |         } catch (uICAL::Error& ex) {
        |                         ^~~~~
    ./python-module/tzmap.cpp:106:41: error: ‘ex’ was not declared in this scope; did you mean ‘exp’?
    106 |             PyErr_SetString(UicalError, ex.message.c_str());
        |                                         ^~
        |                                         exp
    ./python-module/tzmap.cpp:96:32: warning: unused parameter ‘self’ [-Wunused-parameter]
    96 |     TZMap_find_id(TZMapObject *self, PyObject *args)
        |                   ~~~~~~~~~~~~~^~~~
    ./python-module/tzmap.cpp: At global scope:
    ./python-module/tzmap.cpp:129:5: error: designator order for field ‘_typeobject::tp_basicsize’ does not match declaration order in ‘PyTypeObject’ {aka ‘_typeobject’}
    129 |     };
        |     ^
    error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

My curiousity and annoyance at not understanding things will probably bring me back to the module eventually, but I can feel a headache resurfacing from last I tried to touch the module, so it'll wait for now.

HGinnerup avatar Aug 05 '25 09:08 HGinnerup

Very much appreciated. Unfortunately I can only give this more attention towards the end of the month.

sourcesimian avatar Aug 06 '25 11:08 sourcesimian