Fixing path crashes related to the new non-null roots

pmeunier
Nov 27, 2021, 2:03 PM
KNB3RZMS4VRNBXGLSA6P6IDSCIKYRNLNCQ5RDMREUO4NVECKWURAC

Dependencies

  • [2] IIV3EL2X Cleanup, formatting, and fixing the Git feature
  • [3] JZEI2QJV Comparing file names
  • [4] YN63NUZO Sanakirja 1.0
  • [5] I52XSRUH Massive cleanup, and simplification
  • [6] GHO6DWPI Refactoring iterators
  • [7] LV34DUJY Formatting
  • [8] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [9] CCLLB7OI Upgrading to Sanakirja 0.15 + version bump
  • [10] 3AMEP2Y5 More convenient interface for channels
  • [11] VO5OQW4W Removing anyhow in libpijul
  • [12] VYHHOEYH Versions and formatting
  • [13] LCERQSWM Cleanup
  • [14] FTR3UCBE Fixing yet another instance of `&name[2..]` (replaced with the encoding detector)

Change contents

  • edit in libpijul/src/fs.rs at line 718
    [2.18754]
    [4.755231]
    if dest.start == dest.end {
    // non-null root.
    return None
    }
  • replacement in libpijul/src/fs.rs at line 778
    [4.756693][4.756693:756764]()
    EdgeFlags::FOLDER | EdgeFlags::PARENT | EdgeFlags::PSEUDO,
    [4.756693]
    [4.111963]
    EdgeFlags::FOLDER | EdgeFlags::PARENT | EdgeFlags::BLOCK | EdgeFlags::PSEUDO,
  • replacement in libpijul/src/fs.rs at line 852
    [4.759605][4.1223:1394](),[4.1394][4.113391:113421](),[4.5912][4.113391:113421](),[4.62720][4.113391:113421](),[4.113391][4.113391:113421](),[4.113421][4.132710:132796](),[4.5997][4.759767:759848](),[4.62804][4.759767:759848](),[4.64035][4.759767:759848](),[4.113502][4.759767:759848](),[4.132796][4.759767:759848](),[4.759767][4.759767:759848](),[4.759848][4.32111:32131](),[4.32131][2.19089:19278](),[2.19278][4.113593:113643](),[4.132907][4.113593:113643](),[4.113593][4.113593:113643](),[4.113643][4.0:79](),[4.79][3.0:405]()
    for name in iter_adjacent(
    txn,
    txn.graph(channel),
    current.inode_vertex(),
    flag0,
    flag1,
    )? {
    let name = name?;
    let name_dest = txn.find_block(txn.graph(channel), name.dest()).unwrap();
    name_buf.clear();
    debug!("getting contents {:?}", name);
    changes
    .get_contents(
    |h| txn.get_external(&h).unwrap().map(|x| x.into()),
    *name_dest,
    &mut name_buf,
    )
    .map_err(FsErrorC::Changestore)?;
    let FileMetadata { basename, .. } = FileMetadata::read(&name_buf);
    if basename == c {
    let age = txn
    .get_changeset(txn.changes(&channel), &name.dest().change)
    .unwrap();
    if let Some((ref mut next, ref mut next_age)) = next {
    ambiguous = true;
    if age < *next_age {
    *next = name_dest;
    *next_age = age;
    [4.759605]
    [3.405]
    'outer: loop {
    for name in iter_adjacent(
    txn,
    txn.graph(channel),
    current.inode_vertex(),
    flag0,
    flag1,
    )? {
    let name = name?;
    let name_dest = txn.find_block(txn.graph(channel), name.dest()).unwrap();
    if name_dest.start == name_dest.end {
    // non-null root, just continue.
    current = iter_adjacent(txn, txn.graph(channel), *name_dest, flag0, flag1)?
    .next()
    .unwrap()?
    .dest();
    break 'outer
    }
    name_buf.clear();
    debug!("getting contents {:?}", name);
    changes
    .get_contents(
    |h| txn.get_external(&h).unwrap().map(|x| x.into()),
    *name_dest,
    &mut name_buf,
    )
    .map_err(FsErrorC::Changestore)?;
    let FileMetadata { basename, .. } = FileMetadata::read(&name_buf);
    if basename == c {
    let age = txn
    .get_changeset(txn.changes(&channel), &name.dest().change)
    .unwrap();
    if let Some((ref mut next, ref mut next_age)) = next {
    ambiguous = true;
    if age < *next_age {
    *next = name_dest;
    *next_age = age;
    }
    } else {
    next = Some((name_dest, age));
  • edit in libpijul/src/fs.rs at line 893
    [3.427][3.427:503]()
    } else {
    next = Some((name_dest, age));
  • edit in libpijul/src/fs.rs at line 895
    [4.760499]
    [4.760499]
    if let Some((next, _)) = next {
    current = iter_adjacent(txn, txn.graph(channel), *next, flag0, flag1)?
    .next()
    .unwrap()?
    .dest()
    } else {
    return Err(FsErrorC::NotFound(FsNotFound(path.to_string())));
    }
  • edit in libpijul/src/fs.rs at line 904
    [4.760509][4.760509:760549](),[4.760549][4.132988:133071](),[4.6157][4.760636:760660](),[4.62962][4.760636:760660](),[4.64107][4.760636:760660](),[4.113722][4.760636:760660](),[4.133071][4.760636:760660](),[4.760636][4.760636:760660](),[4.760660][4.113723:113750](),[4.113750][4.133072:133096](),[4.133096][4.760708:760725](),[4.760708][4.760708:760725](),[4.760725][4.113751:113825](),[4.32315][4.760849:760859](),[4.113825][4.760849:760859](),[4.760849][4.760849:760859]()
    if let Some((next, _)) = next {
    current = iter_adjacent(txn, txn.graph(channel), *next, flag0, flag1)?
    .next()
    .unwrap()?
    .dest()
    } else {
    return Err(FsErrorC::NotFound(FsNotFound(path.to_string())));
    }