X-Spam-Check-By: sourceware.org Date: Thu, 2 Mar 2006 17:52:45 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: chroot bug? Message-ID: <20060302165245.GA24343@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <030220060456 DOT 13296 DOT 44067B00000BC6DF000033F022070208530A050E040D0C079D0A AT comcast DOT net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <030220060456.13296.44067B00000BC6DF000033F022070208530A050E040D0C079D0A@comcast.net> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Mar 2 04:56, Eric Blake wrote: > I noticed the following strange behavior in chroot: > > $ chroot /bin /sleep 60 & > [1] 16220539 > $ readlink /proc/${!}/root # simple test of whether chroot worked > /bin > $ chroot //EBLAKE/share /cygwin/bin/sleep 60 & > [2] 566487 > $ readlink /proc/${!}/root # Good - chrooted to a share > //EBLAKE/share > $ chroot // //EBLAKE/share/cygwin/bin/sleep 60 & > [3] 529435 > $ readlink /proc/${!}/root # Oops - should be //, not / > / > $ chroot //EBLAKE/share/cygwin/bin/sleep 60 & # Oops, failed to chroot > [4] 566487 > $ chroot: cannot chdir to root directory: No such file or directory > > Why is chroot failing to find //EBLAKE, when it worked with // (at > least, it slept correctly, although root linked to the wrong place), > and did just fine with //EBLAKE/share? I debugged this and I found the problem. However, there's no easy workaround. The basic problem is that you try to chmod to a path which either doesn't exist, or is not a valid Win32 path, for instance //server/share is a valid path, but //server or // are not. Same goes for paths like /proc or the cygdrive directory. The best solution, at least for now, is to refuse to chroot to such a path. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/