Skip to content

config: a good-till expiry in US/Eastern fails to parse on a default Linux install, and the GTD order goes out with no expiry #335

Description

@userFRM

Problem

parse_ib_expiry resolves the timezone straight against the system database:

let zoned = dt
    .in_tz(zone)
    .map_err(|e| format!("expiry '{}': unknown timezone '{}': {}", input, zone, e))?;

US/Eastern and its siblings are backward-compatibility links in the tz database, and Debian and Ubuntu ship those in a separate tzdata-legacy package that is not installed by default. Plain tzdata contains no zoneinfo/US/* entries at all:

$ dpkg -c tzdata.deb        | grep -c 'zoneinfo/US/'
0
$ dpkg -c tzdata-legacy.deb | grep 'US/Eastern'
./usr/share/zoneinfo/US/Eastern -> ../America/New_York

So on a stock modern install — including a default container image — the lookup fails.

That is IB's own spelling. It is what the gateway sends as a contract's time_zone_id, and it is the example ibx's own warning suggests when a time arrives without a zone:

Pass an explicit zone (e.g. 'US/Eastern') or UTC.

Impact

The parse error is not surfaced to the caller. attrs() catches it and drops the field:

Err(e) => {
    log::warn!("dropping good_till_date: {}", e);
    (0, 0)
}

So a GTD order whose expiry is stated the way IB states it goes to the gateway with no expiry, on any host without the legacy package. The order does not expire when it was meant to. It rests instead, and the only trace is a warning in the log.

The repository's own test suite shows it: config::expiry_tests::named_zone_converts_with_dst and instant_round_trips_to_wire fail on such a host, for exactly this reason.

Solution

Resolve the legacy names in ibx rather than depending on an optional OS package. They are fixed aliases — US/Eastern is America/New_York and always has been — so a small mapping applied before the lookup makes the parse work wherever the primary names exist, which is everywhere.

That is preferable to requiring tzdata-legacy at deploy time: the failure is silent, the requirement is invisible, and a library should not need a non-default package to accept the timezone its own vendor uses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions