-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental compilation creates file names too long for Windows #47186
Comments
as a friendly reminder, the Windows API has a separate "unicode" filename, which I confirmed works as expected on the install of Python 2.7 I had lying around (on both NTFS and ExFAT filesystems): >>> fh = open(r'\\?\c:\buildbot\slave\windows-msvc-dev\build\target\debug\incremental\script-1g52totqj6qac\s-ex1p8h0sua-1w9qs9v-hbvaqqvv1zrk\cgu-script-dom-bindings-codegen-Bindings-BluetoothCharacteristicPropertiesBinding-BluetoothCharacteristicPropertiesBinding.volatile.bc-compressed', 'w')
>>> fh.close() I'd have to dig in MSDN to find the gory details, but can do so if it would be helpful |
At first I was going to say “buildbot bug”, and indeed it could be resolved there with things like the Individual path components on most file systems currently in use (e.g. NTFS, ext*) can only be 255 characters, so as soon as you get a module path with a long enough name, it’s going to break regardless; therefore this isn’t solely a Windows bug—it simply showed up on Windows first! |
whoa, that was some creepy timing :-) |
Thanks for the bug report. We fixed this problem in the compiler itself more than a year ago by using the proper path format (the one @mdaniel mentions). We could probably add a flag that makes the compiler generate shorter, non-human-readable filenames for object files. Not sure about the priority of that though. Do you have a use case where you want incremental compilation in combination with buildbot? |
Right now Servo CI cleans the target directory for every build, so we’ll probably want to disable incremental compilation for now. But it’d be nice if we can enable it at some point and reduce the CI cycle time. We can try to patch this specific Buildbot code, but it’s just one example of possibly many tools that might break in the presence of such files. Why make this configurable? Are these file names ever read by humans, other than when working on the compiler itself? And for that case, do you actually manipulate these files directly rather than through some tool? Could that tool extract the Rust path from the contents of the file rather than its name? |
Incremental compilation has been a two-man-show so far, we don't have fancy tools like that The human-readable filenames have been useful for debugging so far and we need them for some of our auto-tests. However, we could default to short, mangled names and only have human-readable/predictable file names for our test suites. Note, however, that this does not completely solve the problem: We can only control the length of the last three components of these paths. Given a long enough prefix the path as a whole can still be longer than 260 characters. |
@michaelwoerister Is I remarked, it’s fundamentally a more serious, not-Windows-specific issue, because file names are capped at 255 characters on most filesystems, but long module paths could lead to an excessively long file name on almost any platform, regardless of the whole prefix aspect. |
@froydnj & @glandium @nnethercote , is m-c friendlier than Servo to > |
@larsbergstrom Eyeballing logs from m-c suggests that the paths would be roughly as long as the ones Servo uses, probably longer:
are the path prefixes for where Whether things would actually break would depend on the particular files and whatnot being compiled, and I don't have a good feel for things to say definitively one way or the other; I guess we should just try it and see? (Note too that adding more code--particularly generated code like @mystor wants to add in m-c--is liable to change whether things break, so just because things would work now doesn't mean they'd keep working...) |
Alright, it looks like this will keep causing complications if we don't do anything and fixing it should be relatively straightforward, so I'll just do that next week. |
To be fair incremental compilation doesn’t create long file names by itself. It creates file names based on Rust paths, and Servo’s DOM implementation happens to have a Firefox doesn’t use Servo’s DOM implementation, and so would not include this particular module. |
FWIW we had problems with overlong paths when running web-platform-tests on Windows in mozilla-central, so it's certainly an issue there. We ended up capping the upstream paths at 150 characters and the in-tree path prefix is about 30, so we are allowing about 75 characters for the build path. This character counting is obviously terrible, but I don't know of a better solution that works with all the tooling that's used during a build. |
…hton Shorten names of some compiler generated artifacts. This PR makes the compiler mangle codegen unit names by default. The name of every codegen unit name will now be a random string of 16 characters. It also makes the file extensions of some intermediate compiler products shorter. Hopefully, these changes will reduce the pressure on tools with path length restrictions like buildbot. The change should also solve problems with case-insensitive file system. cc #47186 and #47222 r? @alexcrichton
The latest nightly contains a fix for this issue. Can you test that, @SimonSapin? It would be good to confirm that this actually helps before doing a backport. |
The fix has been backported to the beta branch. Not sure if we release a new beta version yet though. |
I haven’t reproduced the actual buildbot failure (it breaks the CI infra until manual clean up that I don’t have access to do) but when removing the path prefix and starting from |
I suggest that you try the LongPathTool program , I think it will be very helpful in your case . |
Thanks @PeterCook1, but in case you meant this for me or Servo this is already not an issue for us anymore as we’ve explicitly disabled incremental compilation on Servo’s CI servers. (It wouldn’t help since we clean the |
Today I made a Servo try build with a rustc/cargo version that, if I understand correctly, enable incremental compilation by default. This left on CI builders some files with long names. On every subsequent builds, Buildbot would first try to clean the target directory and fail to remove files with too long names/paths such as
c:\buildbot\slave\windows-msvc-dev\build\target\debug\incremental\script-1g52totqj6qac\s-ex1p8h0sua-1w9qs9v-hbvaqqvv1zrk\cgu-script-dom-bindings-codegen-Bindings-BluetoothCharacteristicPropertiesBinding-BluetoothCharacteristicPropertiesBinding.volatile.bc-compressed
:Could the file names be made to not contain full Rust paths? Maybe using a hash instead?
CC @michaelwoerister @larsbergstrom @jonathandturner
The text was updated successfully, but these errors were encountered: