Skip to content

concoredocker.hpp has several broken functions that don't match Python behavior #224

Description

@avinxshKD

I was comparing concoredocker.hpp against concoredocker.py (similar to what I did for the Java side in #197) and found a few functions that don't actually work correctly. This file was added in PR #143 and the author mentioned it wasn't tested, looks like a few things slipped through.

1.safe_literal_eval() always returns the default value

std::unordered_map<std::string, std::string> safe_literal_eval(const std::string& filename, std::unordered_map<std::string, std::string> defaultValue) {
    std::ifstream file(filename);
    if (!file) {
        std::cerr << "Error reading " << filename << "\n";
        return defaultValue;
    }
    return defaultValue;  // returns default even when the file opens fine
}

The file is opened but the content is never read or parsed. So iport and oport are always empty {}, which means port mappings are completely ignored.

  1. load_params() never populates the params map
    The function reads concore.params, transforms the string with regex, but never actually inserts anything into this->params. The transformed string is just discarded. So tryparam() always returns the default.

  2. read() doesn't parse the data or track simtime
    Python's read() does:

  • Parse the list with literal_eval

  • Extract simtime from inval[0]

  • Return inval[1:] (data without simtime)

The C++ version just returns the raw string {ins} without any parsing. Simtime is never updated from reads.

  1. Missing initval()
    Both concoredocker.py and concoredocker.java have initval() which parses a string like "[0.0, 0.0]", sets simtime from the first element, and returns the rest. This function doesn't exist in the .hpp file at all.

Where, All in concoredocker.hpp. I can put up a fix that brings these in line with the Python version.

Activity

  1. avinxshKD commented on Feb 8, 2026

    @avinxshKD
    ContributorAuthor

    @pradeeban working on the fix, pls do let me know, thanks

  2. pradeeban commented on Feb 8, 2026

    @pradeeban
    Member

    ok, go ahead, @avinxshKD. Make sure to check and develop against the dev branch.

  3. added a commit that references this issue on Feb 9, 2026
    bef87a5
  4. added a commit that references this issue on Feb 10, 2026
    d62356c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions