Skip to content

mir-json-translate-libs: Prompt user to delete and recreate rlibs directory if it already exists #260

Description

@RyanGlScott

What happens if you run mir-json-translate-libs and put the generated MIR JSON files in an rlibs directory that was created from a previous mir-json-translate-libs invocation? At the moment, it appears that mir-json-translate-libs will selectively overwrite some---but not necessarily all---of the files in the rlibs directory. Notably, if the previous mir-json-translate-libs invocation used a different MIR JSON schema version than the version that is being used in the new invocation, then this can potentially result in a mixture of MIR JSON files with different schema. This is disastrous, and it can cause mir-json to fail with inscrutable errors such as the following:

called `Result::unwrap()` on an `Err` value: ErrorImpl { code: Message("Expected MIR JSON schema version 10, but found a crate using version 5"), offset: 0 }

The most direct way to avoid this problem is to delete rlibs (and rlibs_real, which rlibs symlinks to) before re-invoking mir-json-translate-libs. This is easy to forget to do, however. It would be nice if mir-json-translate-libs could check to see if the directory it is about to write files to already exists, and if so, ask the user if they wish to delete the directory beforehand.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions