yadm icon indicating copy to clipboard operation
yadm copied to clipboard

Symlink to symlink dosnt work with "yadm alt" command

Open elyashivhazan opened this issue 2 years ago • 3 comments

ENV

> uname -a
Linux ehlemurpro 5.15.50-1-MANJARO #1 SMP PREEMPT Sun Jun 26 07:06:30 UTC 2022 x86_64 GNU/Linux

> yadm version
bash version 5.1.16(1)-release
git version 2.37.0
yadm version 3.2.1

Bug

When im creating a simlink to a file named {{ name }}.bin##a.x86_64 yadm dosnt create an alt file to it. e.g:

PWD=~/.bin
ln -s ../bins/brave_vx.x.x_amd64.bin brave##a.x86_64
cd
yadm add .bin/brave##a.x86_64
# yadm should create a file named brave in ~/.bin but it dose nothing

But with folders that are symlinked its working fine.

PWD=~/
# NOTE: ~/bins/games is a dir
ln -s ../bins/games games##a.x86_64
cd
yadm add .bin/brave##a.x86_64
# yadm creates a symlink in ~/.bin/games linked to ~/.bim/games##a.x86_64

elyashivhazan avatar Jul 08 '22 12:07 elyashivhazan

@elyashivhazan : I am not able to recreate the problem. Please take a look at my steps to recreate:

❯ make testhost
Using local yadm (3.2.1-17-g36fda72)
Starting testhost
root@testhost:~# yadm init
Initialized empty shared Git repository in /root/.local/share/yadm/repo.git/
root@testhost:~# mkdir .bin
root@testhost:~# mkdir bins
root@testhost:~# echo thebinary > bins/brave_vx.x.x_amd64.bin
root@testhost:~# cd .bin
root@testhost:~/.bin# ln -s ../bins/brave_vx.x.x_amd64.bin brave##a.x86_64
root@testhost:~/.bin# cd
root@testhost:~# yadm add .bin/brave##a.x86_64
root@testhost:~# ls -l .bin
total 0
lrwxrwxrwx 1 root root 15 Sep  4 01:03 brave -> brave##a.x86_64
lrwxrwxrwx 1 root root 30 Sep  4 01:03 brave##a.x86_64 -> ../bins/brave_vx.x.x_amd64.bin

Can you try again, and help me understand what might be different between what you and I have done?

TheLocehiliosan avatar Sep 04 '22 01:09 TheLocehiliosan

Hi, thanks for the replay. I'm sorry I forgot to add that bins/brave_vx.x.x_amd64.bin (in your example) is a symbolic link its self (that is all the point of the bug/problem I'm having)

elyashivhazan avatar Sep 10 '22 06:09 elyashivhazan

@elyashivhazan - I just tried again, making bins/brave_vx.x.x_amd64.bin a symlink itself.

❯ make testhost
Using local yadm (3.2.1-17-g36fda72)
Starting testhost
root@testhost:~# yadm init
Initialized empty shared Git repository in /root/.local/share/yadm/repo.git/
root@testhost:~# mkdir .bin
root@testhost:~# mkdir bins
root@testhost:~# echo thebinary > bins/an_actual_file_which_will_be_symlinked
root@testhost:~# cd bins
root@testhost:~/bins# ln -s an_actual_file_which_will_be_symlinked brave_vx.x.x_amd64.bin
root@testhost:~/bins# cd
root@testhost:~# cd .bin
root@testhost:~/.bin# ln -s ../bins/brave_vx.x.x_amd64.bin brave##a.x86_64
root@testhost:~/.bin# cd ..
root@testhost:~# find .bin bins -ls
   534170      4 drwxr-xr-x   2 root     root         4096 Sep 13 16:47 .bin
   534174      0 lrwxrwxrwx   1 root     root           30 Sep 13 16:47 .bin/brave##a.x86_64 -> ../bins/brave_vx.x.x_amd64.bin
   534171      4 drwxr-xr-x   2 root     root         4096 Sep 13 16:47 bins
   534173      0 lrwxrwxrwx   1 root     root           38 Sep 13 16:47 bins/brave_vx.x.x_amd64.bin -> an_actual_file_which_will_be_symlinked
   534172      4 -rw-r--r--   1 root     root           10 Sep 13 16:46 bins/an_actual_file_which_will_be_symlinked
root@testhost:~# yadm add .bin/brave##a.x86_64
root@testhost:~# ls -l .bin
total 0
lrwxrwxrwx 1 root root 15 Sep 13 16:48 brave -> brave##a.x86_64
lrwxrwxrwx 1 root root 30 Sep 13 16:47 brave##a.x86_64 -> ../bins/brave_vx.x.x_amd64.bin
root@testhost:~# cat .bin/brave
thebinary
root@testhost:~#

I still don't see the problem.

TheLocehiliosan avatar Sep 13 '22 16:09 TheLocehiliosan

Hi, I just had time to check it out and the problem isn't with the script but with busybox (Alpine Linux). Do you have any idea how to fix it to work with busybox? or point me to the function that creates the alt files?

elyashivhazan avatar Sep 23 '22 15:09 elyashivhazan

Can you elaborate on what the issue with busybox is? Is it a particular invocation of busybox that is the issue?

For example, is ln -nfs supported?

Which version of busybox is being used?

TheLocehiliosan avatar Oct 18 '22 16:10 TheLocehiliosan

Hi, I checked again to give the info you asked and it just worked. I checked the busybox repo and no commit that I saw was made to ln, but something must have changed in Alpine (at least I hope).

I will close this issue. Sorry for wasting you are time and thanks a lot for the script.

elyashivhazan avatar Oct 18 '22 17:10 elyashivhazan