Skip to content
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

Cargo build does not update access times for existing files #11

Open
holmgr opened this issue Nov 26, 2018 · 6 comments
Open

Cargo build does not update access times for existing files #11

holmgr opened this issue Nov 26, 2018 · 6 comments
Labels
bug Something isn't working

Comments

@holmgr
Copy link
Owner

holmgr commented Nov 26, 2018

Was looking into #8 and #9 when I seemed to discover an issue with access times on Windows.
After making sure that NtfsDisableLastAccessUpdate was disabled I did the following.

cargo clean
cargo build
// Now all build artifacts are the latest version, and that only.
cargo sweep -s
cargo build
// Now all build artifacts "should" have been accessed and thus be newer than the timestamp file
cargo sweep -f
// Now everything get removed :(

Will look into this more in the coming days when I have the time as this is quite the serious issue for the windows platform.

@holmgr holmgr added the bug Something isn't working label Nov 26, 2018
@holmgr
Copy link
Owner Author

holmgr commented Dec 3, 2018

Have been really busy but now have tried this on OSX as well. Here we run in to the exact same issue. This very aggressive cleaning (i.e only keeping latest version) points out an issue with the general approach of access/modified times where Cargo can completely jump over reading many of the needed build files. And with unmodified access times there is no way to distinguish what is being used or not. One possible "solution" is to do something as discussed in #6 in which only certain build files are cleaned keeping the partial results intact and therefor the build times fast. Otherwise we might simply have to wait for the stabilization of --build-plan to do this properly.

@holmgr
Copy link
Owner Author

holmgr commented Dec 3, 2018

After a little more research into the output directories of Cargo. Only the incremental folder can cleanly be removed in its entirety without affecting the build at all. Both deps and build are checked and rebuilt; unfortunately this is where most of the build size is contained.

A short time solution might be to remove the -s and -f commands until build-plan is stabilized. Or alternatively create an nightly only option to get the feature working correctly so it can be released as soon as stabilization occurs.

For earlier discussions on regarding this see #9

@Eh2406
Copy link
Collaborator

Eh2406 commented Dec 15, 2018

I would love to see an implementation based on the build-plan. If using build-plan is difficult, now would be the best time to request changes. If having used it the build-plan is exactly what you need that would be a big push for Cargo to go ahead and stabilize it.

@holmgr
Copy link
Owner Author

holmgr commented Dec 20, 2018

I hope to manage to allocate some time to work on a nightly-only implementation using build-plan during the holidays and see what I can come up with. Would be nice to get it stabilized since I think it could solve the problems outlined above.

@Ten0
Copy link

Ten0 commented Sep 10, 2019

Same issue here on Linux. Given that it does remove files even if they are somewhat needed for next compilations, that makes the tool pointless for me : I might as well just cargo clean.

Couldn't we identify which artifacts are built for the current version of each library present in the Cargo.lock and remove any of these that is not present there ? This would allow for an easy cleaning of all the library versions that were updated and most likely won't be downgraded.

bors bot added a commit to jjs-dev/jjs that referenced this issue Sep 17, 2019
39: Don't use cargo sweep in CI r=MikailBag a=MikailBag

It seems that until holmgr/cargo-sweep#11 is resolved, cargo-sweep in CI is broken

bors r+

Co-authored-by: Mikail Bagishov <[email protected]>
@rbtcollins
Copy link

@Ten0 thats exactly what the build-plan is for: avoiding reimplementing all the cargo internals that are used to determine exactly what files an artifact depends on, recursively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants