Fix Mix.Dep.Lock.write/2 ignoring :file option when comparing changes#15361
Fix Mix.Dep.Lock.write/2 ignoring :file option when comparing changes#15361jisung-02 wants to merge 1 commit into
Conversation
Signed-off-by: Chae-JS <jschae02@khu.ac.kr>
ea9599b to
4cd577b
Compare
|
Hi @jisung-02, can you please explain when this is a bug? My understanding is that the |
|
I looked into this again, and I think you are right. I opened this PR because, while reading I also created a local reproduction by calling the internal module However, after checking the actual callers again, it looks like this does not affect the supported public behavior. So this PR is probably better described as an internal consistency cleanup rather than a bug fix. After checking again based on your explanation, I’m fine closing this PR if you don’t think this internal cleanup is necessary. |
Mix.Dep.Lock.write/2accepts a:fileoption to write to a custom lockfile path. However, when checking whether the lock has changed, it calledread/0without arguments, comparing the new lock against the defaultmix.lockrather than the target file.For example, given:
vendor.lockis already up to date, so this should be a no-op. Instead, the new map is compared againstmix.lock, the values differ, andMix.Erroris raised:Without
check_locked, the same mismatch causes a spurious rewrite of the up-to-date file and an unnecessaryMix.Task.run("will_recompile").The fix passes the resolved
lockfilepath toread/1so the comparison and the write target the same file. A regression test for thecheck_locked: truecase is added.