hpc / hpc/mpifileutils

dreln: handle target string that is exactly old path

Open
#207 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
200
Forks
85
Avg merge
3d 21h
Merged PRs (30d)
2

Description

If there is a link target that exactly matches the oldpath, then this link is not currently updated. For example:

mylink1 --> /old/path
mylink2 --> /old/path/foo

Then after running the command:

dreln /old/path /new/path ...

One would like for:

mylink1 --> /new/path
mylink2 --> /new/path/foo

But one instead gets:

mylink1 --> /old/path
mylink2 --> /new/path/foo

One could detect that with MFU_PATH_EQUAL. However, the mfu_path_slice() call will then attempt to slice all components, which ends up wrapping back to the front and slicing nothing, so that the new path is prepended to the old path in the target.

As a fix, we should also update mfu_path_slice to avoid wrapping back. We could redefine the functionality here to slice all components if the offset is beyond the length of the path. In that case, we should also update other functions like mfu_path_cut to behave similarly.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing dreln's target update logic and the mfu_path_slice() call for a target exactly matching oldpath. Reproduce the example with /old/path and /new/path, then verify that the exact target is updated without path wrapping; also inspect mfu_path_cut() for the requested consistent behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.