Skip to content

Tempdir conflict with --appimage-extract-and-run on parallel runs #1215

@lalten

Description

@lalten

When an appimage is run with --appimage-extract-and-run, the path is calculated as $TMPDIR/appimage_extracted_$MD5DIGEST. This usually works, but it seems there are problems when the same appimage is run in parallel. Likely there is a race condition where one appimage is still running while the other one is removing its files already.

It seems this happened to me in this CI run: https://github.com/lalten/rules_appimage/actions/runs/3085571024/jobs/4989010345 where I added a testing matrix. I think that caused the same appimage to be run in parallel and led to really weird errors.

I wonder if it makes sense to include the date or maybe even just the pid of the process into the tempdir name as well.

Relevant places in the runtime code:

strcpy(temp_base, getenv("TMPDIR"));

AppImageKit/src/runtime.c

Lines 690 to 696 in 90704a0

hexlified_digest = appimage_hexlify(digest.bytes, sizeof(digest.bytes));
}
char* prefix = malloc(strlen(temp_base) + 20 + strlen(hexlified_digest) + 2);
strcpy(prefix, temp_base);
strcat(prefix, "/appimage_extracted_");
strcat(prefix, hexlified_digest);

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