fix(tvix/castore/import): symlink targets are Vec<u8>
These can be arbitrary bytes in theory. Some of our libraries might be more strict, or inconsistent w.r.t. their representation of path separators. Change-Id: I7981b74fc7d3dd79f5589cf2ef52ced7b71dd003 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11551 Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
parent
ca64881cb3
commit
5e8cfcfcd6
3 changed files with 9 additions and 4 deletions
|
@ -150,7 +150,9 @@ where
|
||||||
target: entry
|
target: entry
|
||||||
.link_name()?
|
.link_name()?
|
||||||
.ok_or_else(|| Error::MissingSymlinkTarget(path.clone()))?
|
.ok_or_else(|| Error::MissingSymlinkTarget(path.clone()))?
|
||||||
.into(),
|
.into_owned()
|
||||||
|
.into_os_string()
|
||||||
|
.into_encoded_bytes(),
|
||||||
path,
|
path,
|
||||||
},
|
},
|
||||||
// Push a bogus directory marker so we can make sure this directoy gets
|
// Push a bogus directory marker so we can make sure this directoy gets
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use futures::stream::BoxStream;
|
use futures::stream::BoxStream;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
|
use std::os::unix::ffi::OsStringExt;
|
||||||
use std::os::unix::fs::MetadataExt;
|
use std::os::unix::fs::MetadataExt;
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -108,7 +109,9 @@ where
|
||||||
Ok(IngestionEntry::Dir { path })
|
Ok(IngestionEntry::Dir { path })
|
||||||
} else if file_type.is_symlink() {
|
} else if file_type.is_symlink() {
|
||||||
let target = std::fs::read_link(entry.path())
|
let target = std::fs::read_link(entry.path())
|
||||||
.map_err(|e| Error::UnableToStat(entry.path().to_path_buf(), e))?;
|
.map_err(|e| Error::UnableToStat(entry.path().to_path_buf(), e))?
|
||||||
|
.into_os_string()
|
||||||
|
.into_vec();
|
||||||
|
|
||||||
Ok(IngestionEntry::Symlink { path, target })
|
Ok(IngestionEntry::Symlink { path, target })
|
||||||
} else if file_type.is_file() {
|
} else if file_type.is_file() {
|
||||||
|
|
|
@ -114,7 +114,7 @@ where
|
||||||
}
|
}
|
||||||
IngestionEntry::Symlink { ref target, .. } => Node::Symlink(SymlinkNode {
|
IngestionEntry::Symlink { ref target, .. } => Node::Symlink(SymlinkNode {
|
||||||
name,
|
name,
|
||||||
target: target.as_os_str().as_bytes().to_owned().into(),
|
target: target.to_owned().into(),
|
||||||
}),
|
}),
|
||||||
IngestionEntry::Regular {
|
IngestionEntry::Regular {
|
||||||
size,
|
size,
|
||||||
|
@ -209,7 +209,7 @@ pub enum IngestionEntry {
|
||||||
},
|
},
|
||||||
Symlink {
|
Symlink {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
target: PathBuf,
|
target: Vec<u8>,
|
||||||
},
|
},
|
||||||
Dir {
|
Dir {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
Loading…
Reference in a new issue