Ben Donohue <[email protected]> writes:
> I'm embarassed to say that I don't know whether the files/folders are hard
> or soft linked! How to tell?
OK. I am going to start from the very basics here, so please don't be annoyed
if I am telling you what you already know — I figure better cover those
quickly in case you don't than make you ask again. ;)
In Unix there are three parts to a file: one is the raw data itself, which is
uninteresting.
The second is the inode, which contains things like the permissions, and a
list of where the data is found, and all. The inode does *NOT* have a name.
The third is a directory entry, which is a record in a directory somewhere
that points to the inode, and which has a name.
A file actually has "zero or more" directory entries pointed to the inode,
which are used to keep track of it. When there are zero it can still hang
around while the file is open, though, because the file handle references the
*inode*, not the directory entry.
Anyway, a hard-link is when you have more than one name pointing to the same
inode. You can see this in the "link count" field, which is the second field
in 'ls -l', or in 'stat filename', or whatever.
A soft-link, or symlink, is more like a pointer: it is an inode that
contains a path string. When you try to open it the kernel will read that
path string, then refer to that object instead.
So, the easy way to tell if your image is hard-linked or soft-linked is to
look at it with ls:
] ls -l example[12].jpg
-rw-rw-r-- 1 daniel daniel 0 Dec 7 2007 example1.jpg
-rw-rw-r-- 2 daniel daniel 0 Dec 7 2007 example2.jpg
In this case example1 has only one link, but example2 has two. :)
If you look at a normal file (eg: added by the software, not manually deleted
or changed) you should find out quickly if it has another hard-link or not. :)
[...]
> I'm trying to simplify what I'm doing to try to find out why this is
> happening. But it seems that Joomla is picking up the cached copy when an
> image is uploaded rather than the changed file.
FWIW, my guess about hard-links would be that you had something that looked
like this:
/foo/bar/baz.jpg => inode 12
/host/whatever/baz.jpg => inode 12
If you then replace the /foo/bar/baz.jpg *name* with another file, by deleting
it and renaming something to the same name then /host/whatever/baz.jpg is not
at all changed by this.
Which it doesn't really sound like is happening.
> If I start in a different area with a new file it works correctly. It's only
> when an existing image is overwritten with the same name that the old image
> shows up in Joomla but ALSO in Konqueror. Which makes me think it's not
> Joomla but something in Linux underneath somewhere. Really bizarre!
*nod* That is very odd. If you were actually overwriting it you *should* see
that content change, at least in the current directory. :/
Does it reflect changed content if you open it in some image display tool
/other/ than Konqueror there? How about if you get the md5sum of the image
before and after?
Daniel
--
✣ Daniel Pittman ✉ [email protected] ☎ +61 401 155 707
♽ made with 100 percent post-consumer electrons
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html