Why are links as large as parent file?

Get help with XFCE specific problems
Post Reply
jimwg
Shogun
Shogun
Posts: 322
Joined: 09 Oct 2013, 18:15
Distribution: porteus
Location: NYC

Why are links as large as parent file?

Post#1 by jimwg » 10 Feb 2014, 01:36

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

mailmegx
White ninja
White ninja
Posts: 29
Joined: 23 Mar 2012, 18:44
Distribution: Porteus 1.2 XFCE 64bit
Location: Cyprus

Re: Why are links as large as parent file?

Post#2 by mailmegx » 10 Feb 2014, 04:55

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

User avatar
Ahau
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

Re: Why are links as large as parent file?

Post#3 by Ahau » 10 Feb 2014, 06:32

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.
Please take a look at our online documentation, here. Suggestions are welcome!

mailmegx
White ninja
White ninja
Posts: 29
Joined: 23 Mar 2012, 18:44
Distribution: Porteus 1.2 XFCE 64bit
Location: Cyprus

Re: Why are links as large as parent file?

Post#4 by mailmegx » 10 Feb 2014, 07:28

thanks for the clarification Ahau, I didnt give much attention to the fact that jim mentioned he was using Thunar

GX

jimwg
Shogun
Shogun
Posts: 322
Joined: 09 Oct 2013, 18:15
Distribution: porteus
Location: NYC

Re: Why are links as large as parent file?

Post#5 by jimwg » 10 Feb 2014, 12:03

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

User avatar
brokenman
Site Admin
Site Admin
Posts: 5439
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v3.2rcX all desktops
Location: Brazil
Contact:

Re: Why are links as large as parent file?

Post#6 by brokenman » 10 Mar 2014, 16:39

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
freestyler
Contributor
Contributor
Posts: 382
Joined: 17 Oct 2013, 14:21
Distribution: Porteus KDE4
Location: Traveller
Contact:

Re: Why are links as large as parent file?

Post#7 by freestyler » 11 Mar 2014, 00:15

I agree brokenman
https://www.porteus-apps.org

Post Reply