flinux icon indicating copy to clipboard operation
flinux copied to clipboard

Unable to recognize NTFS Symlinks

Open HyperHCl opened this issue 9 years ago • 2 comments

In Cygwin, after doing mklink stuffs, ls -la is able to tell NTFS symlinks from regular files, even though the Cygwin ln -s creates emulated symlinks.

Cygwin:

$ ls -la /cygdrive/d/flinux-0.1/archlinux/busybin/vi
lrwxrwxrwx 1 xx None 7 三月 13 12:13 /cygdrive/d/flinux-0.1/archlinux/busybin/vi -> busybox

flinux:

[root@ForeignLinux busybin]# ls -l /busybin/vi
-rwxr-xr-x 1 root root 1547956 Sep 20  2012 /busybin/vi

Made a script to convert those symlinks to NTFS symlinks using ln on my Ubuntu so I could play with chroot.

#!/bin/bash
# emusyml2.sh: converts emulated symlink to real symlink.
#21 3c 53 59 4d 4c 49 4e  4b 3e 1f 39 1f 38  |!<SYMLINK>.9.8|

# Well, no conversion from absolute to relative paths. Too lazy.
[ -f "$1" ] && grep -q $'^!<SYMLINK>\x1f9\x1f8' "$1" ||
  ! echo "Invalid symlink \`$1'" >&2 || exit 1
target="$(sed -e 's/!<SYMLINK>\x1f9\x1f8//1' "$1")"
mv "$1" .symback/"$1"
ln -sf "$target" "$1"

HyperHCl avatar Mar 13 '15 04:03 HyperHCl