Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap.sh creates absolute symlinks not relative symlinks which break relocation of source tree #3174

Closed
sjmudd opened this issue Sep 13, 2017 · 5 comments

Comments

@sjmudd
Copy link
Contributor

sjmudd commented Sep 13, 2017

bootstrap.sh pulls down some external code and does all the right things to prepare Vitess for building. However one thing it does which I think could be better is to make symlinks between some files and directories and these symlinks are absolute paths.

The problem with this is that if you ever relocate the $VTROOT path somewhere else all these symlinks will point into the ether and the code will stop working. I was bitten by this a few times and I guess others can too as usually it's fine to move a directory tree about but in the case of Vitess that may not be true.

A solution would be to replace the absolute links with relative symlinks.

This can be seen here:

[user@host ~/dev/src/github.com/youtube/vitess]$ grep ln bootstrap.sh
ln -snf $etcd_dist/etcd-${etcd_version}-linux-amd64/etcd $VTROOT/bin/etcd
ln -snf $consul_dist/consul $VTROOT/bin/consul
ln -snf $VTTOP/config $VTROOT/config
ln -snf $VTTOP/data $VTROOT/data
ln -snf $VTTOP/py $VTROOT/py-vtdb
ln -snf $VTTOP/go/zk/zkctl/zksrv.sh $VTROOT/bin/zksrv.sh
ln -snf $VTTOP/test/vthook-test.sh $VTROOT/vthook/test.sh
ln -snf $VTTOP/test/vthook-test_backup_error $VTROOT/vthook/test_backup_error
ln -snf $VTTOP/test/vthook-test_backup_transform $VTROOT/vthook/test_backup_transform
ln -sf $VTTOP/misc/git/pre-commit $VTTOP/.git/hooks/pre-commit
ln -sf $VTTOP/misc/git/prepare-commit-msg.bugnumber $VTTOP/.git/hooks/prepare-commit-msg
ln -sf $VTTOP/misc/git/commit-msg.bugnumber $VTTOP/.git/hooks/commit-msg

So creating this issue so there's a reference to it.

@sougou
Copy link
Contributor

sougou commented Nov 13, 2017

I looked at making this change. It turns out that we allow VTTOP and VTROOT to be set independently: you can run dev.env with VTROOT already set. If so, the scripts will honor that value.

Changing the script to use relative paths will break that flexibility. However, there is an easy workaround: you should be able to re-run bootstrap on the new tree, and it should fix up all links correctly.

I'll wait for better ideas. If not, I'll close this.

@sjmudd
Copy link
Contributor Author

sjmudd commented Nov 13, 2017

ok, well maybe if things aren't set then set relative vs absolute paths. If they are set then respect what's configured. My goal was to only make it link relatively if the other settings are not configured. If you're not convinced by this then I guess I now can recognise the issue.

@sougou
Copy link
Contributor

sougou commented Nov 13, 2017

Setting the links conditionally may work.

@morgo
Copy link
Contributor

morgo commented Dec 7, 2019

This is cleaned up a lot in #5527

I suggest that as an alternative fix, we change the bootstrap to be link-less. We can look at further cleanup after 5527 merges and the python tests are all converted to go.

@GuptaManan100
Copy link
Member

Closing this for now. Reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants