
stat returns wrong symlink size
man 2 stat wrote:
The st_size field gives the size of the file (if it is a regular file
or a symbolic link) in bytes. The size of a symbolic link is the
length of the pathname it contains, without a terminating null byte.
Code:
ubuntu@ubuntu:~$ ntfs-3g --version
ntfs-3g 2015.3.14AR.1 integrated FUSE 28
ubuntu@ubuntu:~$ sudo mkfs.ntfs /dev/vdb1 -Q
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
ubuntu@ubuntu:~$ sudo mount /dev/vdb1 /mnt
ubuntu@ubuntu:~$ cd /mnt
ubuntu@ubuntu:/mnt$ ln -s foobar baz
ubuntu@ubuntu:/mnt$ stat baz
File: 'baz' -> 'foobar'
Size: 20 Blocks: 1 IO Block: 4096 symbolic link
Device: fd11h/64785d Inode: 64 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2016-09-05 18:36:15.066261800 +0200
Modify: 2016-09-05 18:36:15.066261800 +0200
Change: 2016-09-05 18:36:15.066261800 +0200
Birth: -
It reported "Size: 20". It should have reported "Size: 6", length of "foobar".
Confirmed on ntfs-3g 2015.3.14AR.1 and ntfs-3g 2016.2.22.