scons icon indicating copy to clipboard operation
scons copied to clipboard

Generate identical cache MD5 for Linux and Windows

Open bdbaddog opened this issue 7 years ago • 5 comments

This issue was originally created at: 2010-07-19 22:42:49. This issue was reported by: 3dknut.

3dknut said at 2010-07-19 22:42:49

As of r5102, using the CacheDir function results in files being pushed with different MD5s on Linux and Windows. This is due to file paths using slashes on Linux and backslashes on Windows. Targets with no environment differences should be pushed to the same cache MD5 on both platforms.

3dknut said at 2010-07-19 22:44:07

Created an attachment (id=774) Patch to replace backslash with forward slash when calculating cache MD5

gregnoel said at 2010-08-08 12:53:35

Bug party triage. Requires release notes since not fully backward compatible. Hold for 3.0 since that's the next time incompatible changes are allowed.

3dknut attached cross_platform_cache_md5.patch at 2010-07-19 22:44:07.

Patch to replace backslash with forward slash when calculating cache MD5

bdbaddog avatar Jan 02 '18 14:01 bdbaddog

Copying over a comment from duplicate #2870 which originally proposed the same simple (one-liner) fix:

Unfortunately, the fix I proposed is not enough: different versions of python on different platforms have different executor.get_contents() values. It's the same for trivial actions, but differs for more complex ones. I didn't dig very deep into that issue, maybe it's worth investigating. For now to make use of shared cache you have to either disable adding executor content to cache signature or to make your action function trivial (for example, by delegating all work to another function right away).

mwichmann avatar Apr 20 '20 01:04 mwichmann

This topic is mentioned in #1908 as well.

mwichmann avatar Apr 20 '20 12:04 mwichmann

Hmmm, perhaps this is fixed in the codebase? The proposed patches show modifying a line sigs.append(self.path), but in the current code that line looks like sigs.append(self.get_internal_path()) which suggests to me maybe it's no longer using an os-dependent path string?

mwichmann avatar Apr 20 '20 13:04 mwichmann

Assigning to self so I remember to test this.

mwichmann avatar Dec 18 '23 23:12 mwichmann