Skip to main content

HardLinkRecord

Struct HardLinkRecord 

Source
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: String

Path of the link, relative to the restored root.

§target: String

The 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: String

A 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

Source§

fn clone(&self) -> HardLinkRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HardLinkRecord

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for HardLinkRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more