This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Symlink file size
- From: Ken Brown <kbrown at cornell dot edu>
- To: cygwin at cygwin dot com
- Date: Tue, 7 Mar 2017 23:05:10 -0500
- Subject: Re: Symlink file size
- Authentication-results: sourceware.org; auth=none
- References: <58bf7c71.d5c5ca0a.98eda.56bd@mx.google.com>
On 3/7/2017 10:37 PM, Steven Penny wrote:
Cygwin seems to have no way to print an accurate size of a symlink.
Consider
this command:
$ touch alfa.txt
$ CYGWIN= ln -s alfa.txt bravo.txt
Now cmd.exe can print the correct size just fine:
> dir /AS
2017-03-07 09:26 PM 30 bravo.txt
However Cygwin prints incorrect 8 bytes with ls:
$ ls -l
total 2
-rw-r--r-- 1 Steven None 0 Mar 7 21:26 alfa.txt
lrwxrwxrwx 1 Steven None 8 Mar 7 21:26 bravo.txt -> alfa.txt
8 is the length of the file name "alfa.txt". From
https://linux.die.net/man/2/stat: "The size of a symbolic link is the
length of the pathname it contains, without a terminating null byte."
Ken
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple