Skip to content

Return {0, -1} for missing files in last_modified_and_size/1#15259

Open
emancu wants to merge 1 commit intoelixir-lang:mainfrom
emancu:fix/stale-external-epoch-zero
Open

Return {0, -1} for missing files in last_modified_and_size/1#15259
emancu wants to merge 1 commit intoelixir-lang:mainfrom
emancu:fix/stale-external-epoch-zero

Conversation

@emancu
Copy link
Copy Markdown

@emancu emancu commented Apr 12, 2026

Closes #15258.

last_modified_and_size/1 returns {0, 0} for both missing files and existing 0-byte files with epoch-0 mtime. The {0, 0} branch in stale_external? assumed the file was missing, causing perpetual recompilation.

This changes the sentinel for missing files to {0, -1}, which cannot conflict with any real disk entry, and updates the pattern match in stale_external? accordingly.

@josevalim
Copy link
Copy Markdown
Member

Let’s change the size to be -1 instead. This way it cannot conflict with disk entries.

@emancu
Copy link
Copy Markdown
Author

emancu commented Apr 12, 2026

@josevalim Don't you think that will be worse?

I mean, it changes a public interface Mix.Utils.last_modified_and_size/1

I will prepare a separate PR, in case you prefer to add this as a quick fix now, and change the interface in a bigger release.

@josevalim
Copy link
Copy Markdown
Member

Mix.Utils module is private. We can change it as we prefer.

@emancu
Copy link
Copy Markdown
Author

emancu commented Apr 12, 2026

@josevalim Ok, I will work on that fix then, and update the descriptions.

@emancu emancu force-pushed the fix/stale-external-epoch-zero branch from 1732588 to 5323767 Compare April 12, 2026 19:36
@emancu emancu changed the title Fix stale_external? treating 0-byte epoch-0 files as missing Return {0, -1} for missing files in last_modified_and_size/1 Apr 12, 2026
@emancu
Copy link
Copy Markdown
Author

emancu commented Apr 12, 2026

@josevalim Thanks, it looks even simpler :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

stale_external? treats 0-byte epoch-0 files as missing, causing perpetual recompilation

2 participants