Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
listdir should take directories into account #27
NB this discussion is probably unrelated, but kind of cool to have discovered
Just did a quick experiment, comparing the size of links with the length of the path (in characters/bytes) the link points to.
System under test:
Compare to the following, which swaps the arrow character with a hyphen character
What this shows us is:
The size of the symbolic link is close to the length of the name of the path the link points to. Specifically, the number of bytes required to store the link target in memory. This is why link targets with plain ascii characters demonstrate the property where the number of characters in the destination is equivalent to the number of bytes required to store that path string in memory. This is also why links with UTF characters in the target measure larger than the number of characters in the link name. UTF characters require more space to store in memory.
I believe the size of 'foo→bar' and 'foo-bar' being exactly 2 bytes different has to do with the space required to store a UTF-8 character. I cannot find exact literature to support this assertion at this time. But it's what I recall previously reading.
Using http://mothereff.in/byte-counter I entered the two following values:
The byte-counter says that the former is 1 byte, and the latter is 3 bytes.