You can hard link a directory (historically done as root using /etc/link or 
/sbin/link rather than /usr/bin/ln or /bin/ln). Doing so traditionally requires 
(1) root; and (2) a direct call to the "link" system call (which is what the 
old /etc/link and /sbin/link did).

However if this is indeed what has been done, then I can speculate as to what 
might have happened. I seem to recall that the Linux kernel caches the file 
system hierarchy, in which case there is might be a chance that the kernel 
cached hierarchy does not reflect what is on disk. Hard linking directories is 
a sufficiently unusual thing to do that it is possible such a cache was never 
tested against it.


Regards, 
Troy Rollo 
Solicitor 
Parry Carroll 
Commercial Lawyers 
Direct:   (02) 8257 3177 
Fax:      (02) 9221 1375 
Switch:  (02) 9221 3899 
E-mail:   [email protected] 
Web:      www.parrycarroll.com.au <http://www.parrycarroll.com.au>  

Liability limited by a scheme approved under Professional Standards Legislation 

This message and any attachments are confidential to Parry Carroll. If you have 
received it my mistake, please let us know by reply and then delete it from 
your system. You must not copy the message, alter it or disclose its contents 
to anyone. Thank you.


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Daniel Pittman
Sent: Thursday, 1 July 2010 4:05 PM
To: [email protected]
Subject: Re: [SLUG] linked folders show different files

Ben Donohue <[email protected]> writes:

> I really don't understand what is going on here...
>
> I have a folder structure that is replicated several times by linking 
> the base folder

A hard-link, or a soft-link?  I am guessing the later, since you can't 
hard-link a directory, but it isn't entirely clear.

If you mean "cloned by hard-linking all the files" then the answer is rather 
different to what I am about to give you.[1]

> Some folders down within the master folder I have two files called 
> 1.jpg (a picture of a computer mouse), and 2.jpg (a picture of a 
> computer)
>
> When I look at the linked folders via konqueror and with thumbnails 
> on, I see the files correctly.
>
> When I delete 1.jpg and then rename 2.jpg to 1.jpg, some folders show 
> a picture of the mouse, others show the picture of the computer.
>
> What's going on here?

It could be that you are seeing a cache effect, where the system has a copy of 
the file in either an HTTP cache (if you are accessing this via the web) or a 
local icon cache.

> Everything should be a picture of a computer.  Why are the linked 
> folders/files not updating with the changes of the file name?

Assuming they are soft-linked directories, so the change actually happens to 
the one single "real" directory, cache effects.

> (browsing to the linux box via a windows computer show the correct 
> computer image in all the linked structure)  I've turned off caching in 
> konqueror.

Maybe it needs more of a kick to do the right thing?

> The reason I'm asking is that I'm importing the images into a joomla 
> site and the images are now incorrect. I've traced it so far to the 
> linking I think...

Given your description, it sounds suspiciously like HTTP caching, but it is 
hard to be sure.  Does the access log for Joomla show that the image in being 
downloaded by the client, not just a "not modified" response?

Does Joomla maintain an internal cache of, say, rescaled images that might need 
to be flushed?

        Daniel

Footnotes: 
[1]  Specifically, when you "delete" a file with hard links, you only remove
     that one name associated with it.  The other links are unaffected.

-- 
✣ 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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to