MetPX / sarracenia

https://MetPX.github.io/sarracenia
GNU General Public License v2.0
46 stars 22 forks source link

mirrorring relative symlinks with ../.. in them which are wrong... #1270

Closed petersilva closed 1 month ago

petersilva commented 1 month ago

so.. when mirroring with libsr3shim:

shim posting:

realpathFilter on
realpathPost on
realpathAdjust -1

subscriber:

baseDir /source
directory /dest

now there are paths which are /home/user/excellent (where excellent is a link into /source/excellent) so the path of operations would be:

cd /home/user/excellent
mv a b
mkdir oneDirDeep
mkdir oneDirDeep/twoDirDeep
echo "hoho" >>oneDirDeep/twoDirDeep/2dd_file1
ln -s 2dd_file1 oneDirDeep/twoDirDeep/link_to_2dd_file1
mv  oneDirDeep/twoDirDeep/link_to_2dd_file1  oneDirDeep/twoDirDeep/renamed_link_to_2dd_file1

you end up with links with (wrong) extra ../../ in them. also rename... maybe same issue maybe different.

petersilva commented 1 month ago

user found this...

petersilva commented 1 month ago

OK, what I think is going on:

petersilva commented 1 month ago

I added some test cases to sr_insects to cover this case, and they are fixed by the proposed patch.

petersilva commented 1 month ago

Question... would it not be simpler to just chdir into the directory, and do relative ops from there... then no adjustment would be needed. hmm.

I look at the logic in do_download... and looks like it is doing a chdir... before the fileOp... so I don't understand why the relative path adjustment is needed at all. but if I remove if for renames, my test cases break.

petersilva commented 1 month ago

After the problem with sarrac was corrected, now tests pass when all weird processing of relative rename and link passes all tests.