OXYGENHUB
# 83e0677b07fe oxygen / crates / oxy-core / src / repo / mod.rs
20.4 KiB · Rust · last changed Trust policy: policy objects, init/grant/revoke, enforcement on push and fetch, propagation with downgrade protection (spec 0.6) 1 month ago source blame history raw
98286406 Andy McCall ↶ 1
//! A repository on disk: the `.oxy` directory, one workspace, the operation
2
//! log, and the working-copy change (spec §12, §13.1).
3
//!
83e0677b Andy McCall ↶ 4
//! Not yet implemented from the spec: packs, checkpoints, multiple
5
//! workspaces, multi-signer policy updates, and the `objects`/`checkpoint`
6
//! endpoints. A repository without a policy is unverified and accepts
7
//! unsigned pushes; with one, everything received is checked (spec §14.5). Changes are signed individually when `core.sign` is
98286406 Andy McCall ↶ 8
//! `change`; the default `seal` leaves them unsigned until push exists.
9
10
use crate::attest::{Attest, AttestBody};
11
use crate::diff::{ranges, split_lines, text_edits};
83e0677b Andy McCall ↶ 12
use crate::protocol::{open_remote, Bundle, RefResult, RefUpdate, RefsResponse, RemoteOptions, RemoteRef, SignedAttest, SignedPolicy};
98286406 Andy McCall ↶ 13
use crate::hash::{hash_object, ChangeHash, KeyId, ObjectRef, ObjectType};
14
use crate::identity::{verify as verify_signature, Domain, Identity, SecretKey, Signature};
15
use crate::ids::{ChangeId, NodeId, WorkspaceId};
16
use crate::objects::{Blob, Change, ChangeKind, Edit, Hlc, Mode, NodeKind, OpRef, StateObject, TreeOp};
17
use crate::oplog::{Format1Op, Op, View, SNAPSHOT_SUFFIX};
18
use crate::state::{FileContent, Snapshot, State};
19
use crate::store::{Store, StoreError};
20
use crate::tree::OpKey;
21
use rand::RngCore;
22
use std::collections::{BTreeMap, BTreeSet, HashMap};
23
use std::fs;
24
use std::io::Write;
25
use std::path::{Path, PathBuf};
26
27
pub const OXY_DIR: &str = ".oxy";
28
pub const FORMAT_LINE: &str = "oxy repository format 2\n";
29
const FORMAT1_LINE: &str = "oxy repository format 1\n";
30
const BINARY_SNIFF: usize = 8 * 1024;
31
32
#[derive(Debug, thiserror::Error)]
33
pub enum RepoError {
34
    #[error("io: {0}")]
35
    Io(#[from] std::io::Error),
36
    #[error(transparent)]
37
    Store(#[from] StoreError),
38
    #[error(transparent)]
39
    Object(#[from] crate::objects::ObjectError),
40
    #[error(transparent)]
41
    State(#[from] crate::state::StateError),
42
    #[error("{0}")]
43
    Msg(String),
44
}
45
46
pub type Result<T> = std::result::Result<T, RepoError>;
47
48
fn fail<T>(s: impl Into<String>) -> Result<T> {
49
    Err(RepoError::Msg(s.into()))
50
}
51
52
mod checkout;
53
mod config;
54
mod identity;
83e0677b Andy McCall ↶ 55
mod policy;
98286406 Andy McCall ↶ 56
mod snapshot;
57
mod sync;
58
#[cfg(test)]
59
mod tests;
60
61
pub use checkout::CheckoutReport;
62
pub use config::{read_config_file, Config};
63
pub use identity::SignatureStatus;
64
pub use snapshot::{added_node_paths, has_conflict_markers, is_binary, referenced_changes, render_change, ChangeStatus, PathStatus, SnapshotResult};
83e0677b Andy McCall ↶ 65
pub use sync::{FetchReport, PullReport};
98286406 Andy McCall ↶ 66
67
fn write_atomic(path: &Path, data: &[u8]) -> Result<()> {
68
    let tmp = path.with_extension("tmp");
69
    {
70
        let mut f = fs::File::create(&tmp)?;
71
        f.write_all(data)?;
72
        f.sync_all()?;
73
    }
74
    fs::rename(&tmp, path)?;
75
    Ok(())
76
}
77
78
pub struct LogEntry {
79
    pub hash: ChangeHash,
80
    pub change: Change,
81
    pub is_working_copy: bool,
82
    pub is_head: bool,
83
}
84
85
struct FsEntry {
86
    kind: NodeKind,
87
    exec: bool,
88
    content: Vec<u8>,
89
}
90
91
pub struct Repo {
92
    root: PathBuf,
93
    oxy: PathBuf,
94
    store: Store,
95
    workspace: WorkspaceId,
96
    keys_dir: PathBuf,
97
    user_config: PathBuf,
98
    pub config: Config,
99
}
100
101
/// The user's oxy directory: `$OXY_HOME`, else `$XDG_CONFIG_HOME/oxy`, else
102
/// `~/.config/oxy`. It holds `config.toml` (spec §19) and `keys/`.
103
pub fn default_home() -> PathBuf {
104
    if let Ok(h) = std::env::var("OXY_HOME") {
105
        return PathBuf::from(h);
106
    }
107
    if let Ok(x) = std::env::var("XDG_CONFIG_HOME") {
108
        return PathBuf::from(x).join("oxy");
109
    }
110
    let home = std::env::var("HOME").unwrap_or_else(|_| ".".into());
111
    PathBuf::from(home).join(".config").join("oxy")
112
}
113
114
pub fn default_keys_dir() -> PathBuf {
115
    default_home().join("keys")
116
}
117
118
pub fn default_user_config() -> PathBuf {
119
    default_home().join("config.toml")
120
}
121
122
/// Where `create_identity` records the author.
123
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
124
pub enum IdentityScope {
125
    /// The user file: every repository of this user signs with it.
126
    User,
127
    /// This repository only.
128
    Repo,
129
}
130
131
impl Repo {
132
    // ------------------------------------------------------------ lifecycle
133
134
    pub fn init(root: &Path) -> Result<Repo> {
135
        let mut id = [0u8; 16];
136
        rand::rngs::OsRng.fill_bytes(&mut id);
137
        Self::init_with_id(root, id)
138
    }
139
140
    /// Initialize a repository with a given repository ID (clones share the
141
    /// ID of their origin, spec §14.4).
142
    pub fn init_with_id(root: &Path, id: [u8; 16]) -> Result<Repo> {
143
        fs::create_dir_all(root)?;
144
        let root = root.canonicalize().unwrap_or_else(|_| root.to_path_buf());
145
        let oxy = root.join(OXY_DIR);
146
        if oxy.exists() {
147
            return fail(format!("{} is already an oxy repository", root.display()));
148
        }
149
        fs::create_dir_all(oxy.join("ops"))?;
150
        write_atomic(&oxy.join("format"), FORMAT_LINE.as_bytes())?;
151
        write_atomic(&oxy.join("id"), hex::encode(id).as_bytes())?;
152
        let config = Config::load(Some(&default_user_config()), &oxy.join("config"))?;
153
        config.save(&oxy.join("config"))?;
154
        let workspace = WorkspaceId::random();
155
        write_atomic(&oxy.join("workspace"), workspace.to_hex().as_bytes())?;
156
        let store = Store::open(oxy.join("objects"))?;
157
        let repo = Repo { root, oxy, store, workspace, keys_dir: default_keys_dir(), user_config: default_user_config(), config };
158
159
        let wc = repo.new_working_copy(vec![], "");
160
        let wc_hash = repo.store.put_change(&wc)?;
161
        let mut view = View::default();
162
        view.bookmarks.insert(repo.config.bookmark.clone(), repo.store.put_state(&StateObject::new(vec![]))?);
163
        view.workspaces.insert(workspace, wc_hash);
164
        repo.record_op(&[], "oxy init", view)?;
165
        Ok(repo)
166
    }
167
168
    /// Open the repository containing `start` (searching upwards).
169
    pub fn open(start: &Path) -> Result<Repo> {
170
        let start = start.canonicalize()?;
171
        let mut dir: Option<&Path> = Some(&start);
172
        while let Some(d) = dir {
173
            let oxy = d.join(OXY_DIR);
174
            if oxy.is_dir() {
175
                let format = fs::read_to_string(oxy.join("format"))?;
176
                let config = Config::load(Some(&default_user_config()), &oxy.join("config"))?;
177
                let workspace = WorkspaceId::from_hex(fs::read_to_string(oxy.join("workspace"))?.trim())
178
                    .ok_or_else(|| RepoError::Msg("corrupt .oxy/workspace".into()))?;
179
                let store = Store::open(oxy.join("objects"))?;
180
                let repo = Repo { root: d.to_path_buf(), oxy, store, workspace, keys_dir: default_keys_dir(), user_config: default_user_config(), config };
181
                if format == FORMAT1_LINE {
182
                    repo.migrate_format1()?;
183
                } else if format != FORMAT_LINE {
184
                    return fail(format!("unsupported repository format: {}", format.trim()));
185
                }
186
                return Ok(repo);
187
            }
188
            dir = d.parent();
189
        }
190
        fail(format!("no oxy repository found at or above {}", start.display()))
191
    }
192
193
    /// Rewrite a format-1 operation log, whose bookmarks were head lists,
194
    /// into format 2, where each bookmark names a `state` object.
195
    fn migrate_format1(&self) -> Result<()> {
196
        let hex = fs::read_to_string(self.oxy.join("ops").join("head"))?;
197
        let head = ObjectRef::from_hex(hex.trim()).ok_or_else(|| RepoError::Msg("corrupt .oxy/ops/head".into()))?;
198
        // Collect the chain root-first.
199
        let mut chain: Vec<Format1Op> = Vec::new();
200
        let mut cur = Some(head);
201
        while let Some(r) = cur {
202
            let op = Op::decode_format1(&self.store.get_typed(&r, ObjectType::Op)?)?;
203
            cur = op.parents.first().copied();
204
            chain.push(op);
205
        }
206
        chain.reverse();
207
        let mut new_parent: Option<ObjectRef> = None;
208
        for old in chain {
209
            let mut view = View::default();
210
            for (name, heads) in &old.view.bookmarks {
211
                view.bookmarks.insert(name.clone(), self.store.put_state(&StateObject::new(heads.clone()))?);
212
            }
213
            view.workspaces = old.view.workspaces.clone();
214
            let op = Op { parents: new_parent.into_iter().collect(), hlc: old.hlc, command: old.command, view };
215
            new_parent = Some(self.store.put(ObjectType::Op, &op.encode())?);
216
        }
217
        write_atomic(&self.oxy.join("ops").join("head"), new_parent.unwrap().to_hex().as_bytes())?;
218
        write_atomic(&self.oxy.join("format"), FORMAT_LINE.as_bytes())?;
219
        Ok(())
220
    }
221
222
    /// The repository ID (spec §14.4). Repositories made before IDs existed get one on first use.
223
    pub fn id(&self) -> Result<[u8; 16]> {
224
        let path = self.oxy.join("id");
225
        match fs::read_to_string(&path) {
226
            Ok(h) => hex::decode(h.trim()).ok().and_then(|v| v.try_into().ok()).ok_or_else(|| RepoError::Msg("corrupt .oxy/id".into())),
227
            Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
228
                let mut id = [0u8; 16];
229
                rand::rngs::OsRng.fill_bytes(&mut id);
230
                write_atomic(&path, hex::encode(id).as_bytes())?;
231
                Ok(id)
232
            }
233
            Err(e) => Err(e.into()),
234
        }
235
    }
236
237
    pub fn root(&self) -> &Path {
238
        &self.root
239
    }
240
    pub fn store(&self) -> &Store {
241
        &self.store
242
    }
243
    pub fn workspace(&self) -> WorkspaceId {
244
        self.workspace
245
    }
246
247
    /// Use a different user directory for keys and the user config file
248
    /// (tests, or `$OXY_HOME`). Reloads the effective configuration.
249
    pub fn with_home(mut self, dir: impl Into<PathBuf>) -> Repo {
250
        let dir = dir.into();
251
        self.keys_dir = dir.join("keys");
252
        self.user_config = dir.join("config.toml");
253
        if let Ok(c) = Config::load(Some(&self.user_config), &self.oxy.join("config")) {
254
            self.config = c;
255
        }
256
        self
257
    }
258
259
    pub fn user_config_path(&self) -> &Path {
260
        &self.user_config
261
    }
262
263
    /// Set a key in the user file and refresh the effective configuration.
264
    pub fn set_user_config(&mut self, key: &str, value: &str) -> Result<()> {
265
        Config::set_user(&self.user_config, key, value)?;
266
        self.config = Config::load(Some(&self.user_config), &self.oxy.join("config"))?;
267
        Ok(())
268
    }
269
270
    pub fn save_config(&self) -> Result<()> {
271
        self.config.save(&self.oxy.join("config"))
272
    }
273
274
    fn author(&self) -> KeyId {
275
        self.config.author_key.unwrap_or(ObjectRef::ZERO)
276
    }
277
}
278
279
impl Repo {
280
    fn new_working_copy(&self, deps: Vec<ChangeHash>, message: &str) -> Change {
281
        let mut c = Change {
282
            change_id: ChangeId::random(),
283
            deps,
284
            author: self.author(),
285
            hlc: Hlc::now(),
286
            message: message.into(),
287
            tree_ops: vec![],
288
            edits: vec![],
289
            kind: ChangeKind::WorkingCopy,
290
        };
291
        c.normalize();
292
        c
293
    }
294
295
    // ------------------------------------------------------------ operation log
296
297
    pub fn head_op(&self) -> Result<(ObjectRef, Op)> {
298
        let hex = fs::read_to_string(self.oxy.join("ops").join("head"))?;
299
        let r = ObjectRef::from_hex(hex.trim()).ok_or_else(|| RepoError::Msg("corrupt .oxy/ops/head".into()))?;
300
        let op = Op::decode(&self.store.get_typed(&r, ObjectType::Op)?)?;
301
        Ok((r, op))
302
    }
303
304
    pub fn view(&self) -> Result<View> {
305
        Ok(self.head_op()?.1.view)
306
    }
307
308
    fn record_op(&self, parents: &[ObjectRef], command: &str, view: View) -> Result<ObjectRef> {
309
        let op = Op { parents: parents.to_vec(), hlc: Hlc::now(), command: command.into(), view };
310
        let r = self.store.put(ObjectType::Op, &op.encode())?;
311
        write_atomic(&self.oxy.join("ops").join("head"), r.to_hex().as_bytes())?;
312
        Ok(r)
313
    }
314
315
    pub fn op_log(&self) -> Result<Vec<(ObjectRef, Op)>> {
316
        let mut out = Vec::new();
317
        let (mut r, mut op) = self.head_op()?;
318
        loop {
319
            let next = op.parents.first().copied();
320
            out.push((r, op));
321
            match next {
322
                Some(p) => {
323
                    r = p;
324
                    op = Op::decode(&self.store.get_typed(&r, ObjectType::Op)?)?;
325
                }
326
                None => break,
327
            }
328
        }
329
        Ok(out)
330
    }
331
332
    /// Undo the last user command (spec §12.1). Operations that only recorded
333
    /// a working-copy snapshot are skipped, since the files are still on disk
334
    /// and the next snapshot recreates them.
335
    pub fn undo(&self) -> Result<Op> {
336
        let (_, mut op) = self.head_op()?;
337
        while op.is_snapshot() {
338
            let Some(parent) = op.parents.first() else { break };
339
            op = Op::decode(&self.store.get_typed(parent, ObjectType::Op)?)?;
340
        }
341
        let Some(parent) = op.parents.first() else {
342
            return fail("nothing to undo");
343
        };
344
        let parent_op = Op::decode(&self.store.get_typed(parent, ObjectType::Op)?)?;
345
        write_atomic(&self.oxy.join("ops").join("head"), parent.to_hex().as_bytes())?;
346
        Ok(parent_op)
347
    }
348
349
    /// The last operation that was not a snapshot.
350
    pub fn last_command(&self) -> Result<Op> {
351
        let (_, mut op) = self.head_op()?;
352
        while op.is_snapshot() {
353
            let Some(parent) = op.parents.first() else { break };
354
            op = Op::decode(&self.store.get_typed(parent, ObjectType::Op)?)?;
355
        }
356
        Ok(op)
357
    }
358
359
    // ------------------------------------------------------------ states
360
361
    /// Load the dependency closure of `heads` from the store.
362
    pub fn load_state(&self, heads: &[ChangeHash]) -> Result<State> {
363
        let mut state = State::new();
364
        let mut stack: Vec<ChangeHash> = heads.to_vec();
365
        let mut seen: BTreeSet<ChangeHash> = BTreeSet::new();
366
        while let Some(h) = stack.pop() {
367
            if !seen.insert(h) {
368
                continue;
369
            }
370
            let c = self.store.get_change(&h)?;
371
            stack.extend(c.deps.iter().copied());
372
            state.add_unchecked(c);
373
        }
374
        state.validate()?;
375
        Ok(state)
376
    }
377
378
    pub fn working_copy(&self) -> Result<(ChangeHash, Change)> {
379
        let view = self.view()?;
380
        let h = *view
381
            .workspaces
382
            .get(&self.workspace)
383
            .ok_or_else(|| RepoError::Msg("this workspace is not in the current view".into()))?;
384
        Ok((h, self.store.get_change(&h)?))
385
    }
386
387
    /// Heads of a bookmark's state (spec §10.1).
388
    pub fn heads_of(&self, view: &View, bookmark: &str) -> Result<Vec<ChangeHash>> {
389
        match view.bookmarks.get(bookmark) {
390
            Some(st) => Ok(self.store.get_state(st)?.heads),
391
            None => Ok(vec![]),
392
        }
393
    }
394
395
    pub fn bookmark_heads(&self) -> Result<Vec<ChangeHash>> {
396
        self.heads_of(&self.view()?, &self.config.bookmark)
397
    }
398
399
    // ------------------------------------------------------------ blobs
400
401
    fn blob_for(content: &[u8]) -> Blob {
402
        Blob {
403
            length: content.len() as u64,
404
            chunks: crate::chunk::chunks(content).into_iter().map(|c| hash_object(ObjectType::Chunk, c)).collect(),
405
        }
406
    }
407
408
    pub fn blob_ref(content: &[u8]) -> ObjectRef {
409
        Self::blob_for(content).hash()
410
    }
411
412
    pub fn store_blob(&self, content: &[u8]) -> Result<ObjectRef> {
413
        for c in crate::chunk::chunks(content) {
414
            self.store.put_chunk(c)?;
415
        }
416
        Ok(self.store.put(ObjectType::Blob, &Self::blob_for(content).encode())?)
417
    }
418
419
    pub fn read_blob(&self, r: &ObjectRef) -> Result<Vec<u8>> {
420
        let blob = Blob::decode(&self.store.get_typed(r, ObjectType::Blob)?)?;
421
        let mut out = Vec::with_capacity(blob.length as usize);
422
        for c in &blob.chunks {
423
            out.extend(self.store.get_typed(c, ObjectType::Chunk)?);
424
        }
425
        Ok(out)
426
    }
427
428
    // ------------------------------------------------------------ working copy
429
430
    fn walk_working_copy(&self) -> Result<BTreeMap<String, FsEntry>> {
431
        let mut wb = ignore::WalkBuilder::new(&self.root);
432
        wb.hidden(false)
433
            .git_ignore(false)
434
            .git_global(false)
435
            .git_exclude(false)
436
            .require_git(false)
437
            .follow_links(false)
438
            .add_custom_ignore_filename(".oxyignore");
439
        wb.filter_entry(|e| e.file_name() != OXY_DIR);
440
        let mut out = BTreeMap::new();
441
        for entry in wb.build() {
442
            let entry = entry.map_err(|e| RepoError::Msg(e.to_string()))?;
443
            let path = entry.path();
444
            if path == self.root {
445
                continue;
446
            }
447
            let rel = path.strip_prefix(&self.root).unwrap();
448
            let rel: String = rel.components().map(|c| c.as_os_str().to_string_lossy().to_string()).collect::<Vec<_>>().join("/");
449
            let Some(ft) = entry.file_type() else { continue };
450
            if ft.is_dir() {
451
                continue;
452
            }
453
            if ft.is_symlink() {
454
                let target = fs::read_link(path)?;
455
                out.insert(rel, FsEntry { kind: NodeKind::Symlink, exec: false, content: target.to_string_lossy().as_bytes().to_vec() });
456
            } else if ft.is_file() {
457
                let exec = is_executable(&entry.metadata().map_err(|e| RepoError::Msg(e.to_string()))?);
458
                out.insert(rel, FsEntry { kind: NodeKind::File, exec, content: fs::read(path)? });
459
            }
460
        }
461
        Ok(out)
462
    }
463
}
464
465
impl Repo {
466
    /// Changes reachable from the bookmark and the working copy, newest first.
467
    pub fn log(&self) -> Result<Vec<LogEntry>> {
468
        let (wc_hash, _) = self.working_copy()?;
469
        let mut heads = self.bookmark_heads()?;
470
        heads.push(wc_hash);
471
        let state = self.load_state(&heads)?;
472
        let head_set: BTreeSet<ChangeHash> = self.bookmark_heads()?.into_iter().collect();
473
        let mut entries: Vec<LogEntry> = state
474
            .changes()
475
            .map(|(h, c)| LogEntry { hash: *h, change: c.clone(), is_working_copy: *h == wc_hash, is_head: head_set.contains(h) })
476
            .collect();
477
        entries.sort_by(|a, b| b.is_working_copy.cmp(&a.is_working_copy).then(b.change.hlc.cmp(&a.change.hlc)).then(b.hash.cmp(&a.hash)));
478
        Ok(entries)
479
    }
480
481
    /// Resolve a change by ChangeId prefix, `#hash` prefix, `@` (working copy), or bookmark.
482
    pub fn resolve_change(&self, spec: &str) -> Result<ChangeHash> {
483
        if spec == "@" {
484
            return Ok(self.working_copy()?.0);
485
        }
486
        if spec.is_empty() || spec == "#" {
487
            return fail("empty change specifier");
488
        }
489
        let entries = self.log()?;
490
        let matches: Vec<&LogEntry> = if let Some(hp) = spec.strip_prefix('#') {
491
            entries.iter().filter(|e| e.hash.starts_with_hex(hp)).collect()
492
        } else {
493
            entries.iter().filter(|e| e.change.change_id.starts_with_hex(spec)).collect()
494
        };
495
        match matches.len() {
496
            1 => Ok(matches[0].hash),
497
            0 => fail(format!("no change matches {spec:?}")),
498
            _ => {
499
                let ids: BTreeSet<ChangeId> = matches.iter().map(|e| e.change.change_id).collect();
500
                if ids.len() == 1 {
501
                    fail(format!("change {spec} is divergent: {} variants", matches.len()))
502
                } else {
503
                    fail(format!("{spec:?} is ambiguous"))
504
                }
505
            }
506
        }
507
    }
508
509
    /// Human-readable description of what a change does, with line content.
510
    pub fn describe_change(&self, hash: &ChangeHash) -> Result<String> {
511
        let change = self.store.get_change(hash)?;
512
        let base = self.load_state(&change.deps)?;
513
        let base_snapshot = base.materialize();
514
        Ok(render_change(&change, &base, &base_snapshot))
515
    }
516
}
517
518
fn remove_any(path: &Path) -> std::io::Result<()> {
519
    let m = fs::symlink_metadata(path)?;
520
    if m.is_dir() { fs::remove_dir_all(path) } else { fs::remove_file(path) }
521
}
522
523
#[cfg(unix)]
524
fn set_executable(path: &Path, exec: bool) -> std::io::Result<()> {
525
    use std::os::unix::fs::PermissionsExt;
526
    let mut perms = fs::metadata(path)?.permissions();
527
    let mode = perms.mode();
528
    let want = if exec { mode | 0o111 } else { mode & !0o111 };
529
    if want != mode {
530
        perms.set_mode(want);
531
        fs::set_permissions(path, perms)?;
532
    }
533
    Ok(())
534
}
535
#[cfg(not(unix))]
536
fn set_executable(_path: &Path, _exec: bool) -> std::io::Result<()> {
537
    Ok(())
538
}
539
540
#[cfg(unix)]
541
fn is_executable(m: &fs::Metadata) -> bool {
542
    use std::os::unix::fs::PermissionsExt;
543
    m.permissions().mode() & 0o111 != 0
544
}
545
#[cfg(not(unix))]
546
fn is_executable(_m: &fs::Metadata) -> bool {
547
    false
548
}
549
550
fn op_ref(k: OpKey) -> OpRef {
551
    OpRef { change: k.0, index: k.1 }
552
}
553
554
fn split_path(path: &str) -> (&str, &str) {
555
    match path.rfind('/') {
556
        Some(i) => (&path[..i], &path[i + 1..]),
557
        None => ("", path),
558
    }
559
}