pub struct HardLinkRecord {
pub path: String,
pub target: String,
pub command: String,
}Expand description
A hard link the archive carried and the restore did not create.
A hard link is a second name for a file that already exists, and the archive says which one. That target is not carried in the pack and not checked against it — it names something on the machine the restore is landing on. A crafted archive can therefore name any file the operator can read, and creating the link would publish that file’s contents into the restored tree under a name of the archive’s choosing.
Nothing this crate writes produces one: the scan stores every file as its own regular entry, so two names for one inode come back as two files. A hard link entry is thus always from another producer, and there is no reading of it that makes creating it automatically the right thing to do.
It is also not passed over in silence. Skipping quietly would leave the restored tree missing a path the archive listed, with nothing to say why. The record names the link, the target as the archive wrote it, and a command that creates it — to be run once the operator has looked at what the target actually is.
Fields§
§path: StringPath of the link, relative to the restored root.
target: StringThe file the archive says the link should point at, exactly as written.
Two shapes occur. A target inside the payload is a link to another file
in this same pack, which is what a tar writer produces for a project
that contains hard links; it reads as an archive-relative path like
payload/b.txt. Anything else names a file on the machine doing the
restore, and is absolute and pointing anywhere if the archive says so.
command: StringA POSIX ln invocation that would create the link, both paths quoted.
A target inside the payload is resolved to where that entry actually landed, so the command works from any directory. One outside it is used as written, because that is the only thing it can mean.
Trait Implementations§
Source§impl Clone for HardLinkRecord
impl Clone for HardLinkRecord
Source§fn clone(&self) -> HardLinkRecord
fn clone(&self) -> HardLinkRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more