Page 1 of 1

Why are links as large as parent file?

Posted: 10 Feb 2014, 01:36
by jimwg
Greetings!

Don't know if this is a XFCE flaw, but when I use Thundar to create a link for a file, especially image files, the link is the same size as that parent file! At that rate you might as well not have a link but use the original file. Don't "pointer" link files only need a few bytes to do their job? Please enlighten me.

Jim in NYC
Portesus 3.0rc1 32bit XFCE 4.10

Re: Why are links as large as parent file?

Posted: 10 Feb 2014, 04:55
by mailmegx
Hi Jim

Not sure what you looking at, however there are 2 kinds of links, hard links and symbolic links, a hard link will appear as a diffrent file not a link and appear as the same size, if you delete the original file the link will still exist as a copy of the file, here is an example, this will actually report as a seprate file which means that it appears you are using more space than is physically on disk. when editing the link file in midnight command it warns you it is a hard link and asks if you want to break the link, using nano it saves changes in the original file.

$ echo test > test.txt
$ ln test.txt test.lnk
$ ls -l
total 8
-rw-r--r-- 2 gx gx 5 Feb 10 06:45 test.lnk
-rw-r--r-- 2 gx gx 5 Feb 10 06:45 test.txt
$ cat test.txt
test
$ cat test.lnk
test
$ rm test.txt
$ ls -l
total 4
-rw-r--r-- 1 gx gx 5 Feb 10 06:45 test.lnk
$ cat test.lnk
test



Regards

GX

Re: Why are links as large as parent file?

Posted: 10 Feb 2014, 06:32
by Ahau
Thunar is showing you the size attribute of the file to which it is linked, not the actual size of the symlink.

I put a .png file (transmission.png) in a folder, then hit right click -> send to -> Desktop (create link). The image is 2.7kB; when I view the link in Thunar it shows 2.7kB as well. When I view it via xfce4-terminal, however, the truth comes out:

Code: Select all

root@porteus:~/Desktop# ls -l
total 4
lrwxrwxrwx 1 root root   30 Feb  9 22:27 link\ to\ transmission.png -> /root/Desktop/transmission.png
-rw-r--r-- 1 root root 2683 Feb  9 22:27 transmission.png
The link is only 30 bytes, whereas the actual file is 2.7kB.

Re: Why are links as large as parent file?

Posted: 10 Feb 2014, 07:28
by mailmegx
thanks for the clarification Ahau, I didnt give much attention to the fact that jim mentioned he was using Thunar

GX

Re: Why are links as large as parent file?

Posted: 10 Feb 2014, 12:03
by jimwg
Ahau wrote:Thunar is showing you the size attribute of the file to which it is linked, not the actual size of the symlink.

I put a .png file (transmission.png) in a folder, then hit right click -> send to -> Desktop (create link). The image is 2.7kB; when I view the link in Thunar it shows 2.7kB as well. When I view it via xfce4-terminal, however, the truth comes out:

Code: Select all

root@porteus:~/Desktop# ls -l
total 4
lrwxrwxrwx 1 root root   30 Feb  9 22:27 link\ to\ transmission.png -> /root/Desktop/transmission.png
-rw-r--r-- 1 root root 2683 Feb  9 22:27 transmission.png
The link is only 30 bytes, whereas the actual file is 2.7kB.
Thanks for that clarification as well, Ahau. I wonder if the XFCE folks realize that misunderstanding could throw a lot of confused newbies. They should really mention this in their docs or just make the link reveal its true size like in Macs and XP!

Jim in NYC

Re: Why are links as large as parent file?

Posted: 10 Mar 2014, 16:39
by brokenman
or just make the link reveal its true size like in Macs and XP
I've always found that to be useless. Who wants to know the (real) size of a symlink? It never changes! It is usually the target file that one is interested in. For example I place my savefile.dat at:
/mnt/sda2/some/ridiculously/long/and/difficult/to/access/path/savefile.dat

I want easy access so I place a symlink on my desktop. In thunar I can simply look at the symlink file on the desktop. I believe the behaviour is superior as long as the symlink icon differentiates it from a real file.

Re: Why are links as large as parent file?

Posted: 11 Mar 2014, 00:15
by freestyler
I agree brokenman