From owner-freebsd-questions@FreeBSD.ORG Mon Mar 16 15:39:30 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43835106567E for ; Mon, 16 Mar 2009 15:39:30 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id C6BD68FC1E for ; Mon, 16 Mar 2009 15:39:29 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-255-48-78.bredband.comhem.se ([83.255.48.78]:63675 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with smtp (Exim 4.68) (envelope-from ) id 1LjEuS-0003b0-3y for freebsd-questions@freebsd.org; Mon, 16 Mar 2009 16:39:24 +0100 Received: (qmail 17642 invoked from network); 16 Mar 2009 16:39:23 +0100 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with SMTP; 16 Mar 2009 16:39:23 +0100 Received: (qmail 13055 invoked by uid 1001); 16 Mar 2009 16:39:23 +0100 Date: Mon, 16 Mar 2009 16:39:23 +0100 From: Erik Trulsson To: John Almberg Message-ID: <20090316153923.GA13043@owl.midgard.homeip.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Originating-IP: 83.255.48.78 X-Scan-Result: No virus found in message 1LjEuS-0003b0-3y. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1LjEuS-0003b0-3y 55638efa9cc32bbd8f4e1f60a1d8620d Cc: freebsd-questions@freebsd.org Subject: Re: links vs real directories X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 15:39:31 -0000 On Mon, Mar 16, 2009 at 11:22:13AM -0400, John Almberg wrote: > I always thought that links to real directories were pretty much the > same as real directories, but I've just discovered a situation where > they are not and I'm wondering if I'm doing something wrong... A *soft* link to a directory entry (be it a directory or a file or something else) is not quite equivalent to the original entry since they are easily distinguished and some programs do treat softlinks differently from other targets. A hardlink to a file is exactly equivalent to the original (since the original directory entry is itself a hardlink). The system does not however allow you to create hardlinks to directories since it is far too easy to make Very Bad Things happen that way. > > I have a Ruby on Rails application running on a FreeBSD server. All > Rails apps use the same directory structure, that consists of an > application directory, plus a number of subdirectories. One of these > sub directories is called 'config'. > > I would like to move this config directory out of the main Rails app > directory, and then add a link from the app directory to the moved > config directory. > > so: > > app --> config > > will become > > app --> config(link) --> config > > Basically, what I'm doing is: > > cd ~/app # now in directory with real 'config' dir > mv config ~/shared/config > ln -s ~/shared/config config > > That moves the directory and creates a functional link to it (I > tested it), but Rails doesn't like it and refuses to run the app. The > permissions are correct, I believe: > > [master@on:current]> ls -l > total 34 > ... snip ... > drwxrwxr-x 3 master master 512 Mar 16 11:06 bin > drwxrwxr-x 3 master master 512 Mar 16 11:06 components > lrwxr-xr-x 1 master master 26 Mar 16 11:07 config -> /home/ > master/shared/config > drwxr-xr-x 4 master master 512 Mar 16 11:06 db > etc... > > > So, I guess a link is NOT exactly equivalent to a directory. At least > not the way I am doing it. > > I'm guessing I'm making a real newbie mistake, so if anyone can set > me straight, I'd appreciate it. > > Thank: John > -- Erik Trulsson ertr1013@student.uu.se