Skip to content

Commit

Permalink
Rollup merge of rust-lang#46421 - mnd:fix-build-for-guix, r=alexcrichton
Browse files Browse the repository at this point in the history
build_helper: destination file can't be up to date when not exists

Function "up_to_date" return incorrect result if mtime for all fetched sources is set to epoch time. Add existence check to function.

This fix required for a [Guix](https://www.gnu.org/software/guix/) package because a Nix builder set mtime of all sources to epoch time.
  • Loading branch information
kennytm authored Dec 1, 2017
2 parents 662f902 + f2df1f5 commit 5617477
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ pub fn mtime(path: &Path) -> FileTime {
///
/// Uses last-modified time checks to verify this.
pub fn up_to_date(src: &Path, dst: &Path) -> bool {
if !dst.exists() {
return false;
}
let threshold = mtime(dst);
let meta = match fs::metadata(src) {
Ok(meta) => meta,
Expand Down

0 comments on commit 5617477

Please sign in to comment.