Skip to content

File unexpectedly modified during compilation #1804

@cgay

Description

@cgay

".../lsp-dylan/sources/protocol.dylan was unexpectedly modified during compilation."

I see this now and then when working on lsp-dylan because (I assume) of its relatively long compile times. Can we mitigate this by caching source file content early in the build process?

define class <flat-file-source-record> (<file-source-record>)
  ...
  slot cached-source-record-contents :: false-or(<byte-vector>) = #f;

define method source-record-contents
   (sr :: <flat-file-source-record>) => (bytes :: <byte-vector>)
  cached-source-record-contents(sr)
    | (cached-source-record-contents(sr)
         := with-input-from-source-record (stream = sr)
              read-to-end(stream);
            end)
end method;

🤔 So someone already planned to do that, it seems, but it doesn't seem to be working.

I'm not familiar enough with the build process to know if it's structured this way, but it seems like it should only take a few seconds to find dependencies and read all the source files into memory these days, obviously depending on the size of the project.

// A hack to avoid more pervasive source changes, but allow some calls to bypass
// the timestamp check
define thread variable *check-source-record-date?* = #t;

If we're caching the file contents, why do we ever need to re-read the file? Isn't that just asking for this error to occur? Maybe we can just set this to #f? Oh, maybe the source records persist across multiple builds because of the interactive compiler?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions