include_target_in_component_name: bool,
is_preview: bool,
+ permit_symlinks: bool,
}
impl<'a> Tarball<'a> {
include_target_in_component_name: false,
is_preview: false,
+ permit_symlinks: false,
}
}
self.is_preview = is;
}
+ pub(crate) fn permit_symlinks(&mut self, flag: bool) {
+ self.permit_symlinks = flag;
+ }
+
pub(crate) fn image_dir(&self) -> &Path {
t!(std::fs::create_dir_all(&self.image_dir));
&self.image_dir
}
self.builder.run(&mut cmd);
+ // Ensure there are no symbolic links in the tarball. In particular,
+ // rustup-toolchain-install-master and most versions of Windows can't handle symbolic links.
+ let decompressed_output = self.temp_dir.join(&package_name);
+ if !self.builder.config.dry_run && !self.permit_symlinks {
+ for entry in walkdir::WalkDir::new(&decompressed_output) {
+ let entry = t!(entry);
+ if entry.path_is_symlink() {
+ panic!("generated a symlink in a tarball: {}", entry.path().display());
+ }
+ }
+ }
+
// Use either the first compression format defined, or "gz" as the default.
let ext = self
.builder
GeneratedTarball {
path: crate::dist::distdir(self.builder).join(format!("{}.tar.{}", package_name, ext)),
- decompressed_output: self.temp_dir.join(package_name),
+ decompressed_output,
work: self.temp_dir,
}
}