Skip to content

Instantly share code, notes, and snippets.

@cofyc
Last active April 11, 2018 03:58
Show Gist options
  • Save cofyc/860b134c593c1d81e19ca34a5c26bb6f to your computer and use it in GitHub Desktop.
Save cofyc/860b134c593c1d81e19ca34a5c26bb6f to your computer and use it in GitHub Desktop.
EvalSymlinksAtRoot
#!/bin/bash
#
# Setup paths in host before testing:
rm -r /tmp/foo
mkdir -p /tmp/foo
touch /tmp/foo/baz
# one level link
ln -fs /tmp/foo/baz /tmp/foo/bar
# two level link
ln -fs /tmp/foo/bar /tmp/foo/twolevel
# symbolic link to invalid path
ln -fs /does-not-exist /tmp/foo/invalid
# symbolic link to invalid path but exist in caller filesystem
ln -fs /rootfs /tmp/foo/rootfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment