Date: Tue, 26 Aug 2003 15:57:47 +0200 (CEST) From: Ulrich Spoerlein <q@uni.de> To: FreeBSD-gnats-submit@FreeBSD.org Subject: kern/55993: getcwd() breaks on unionfs mounted directories Message-ID: <200308261357.h7QDvlG5004823@roadrunner.local> Resent-Message-ID: <200308261400.h7QE0Riq008547@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 55993 >Category: kern >Synopsis: getcwd() breaks on unionfs mounted directories >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Aug 26 07:00:26 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Ulrich Spoerlein >Release: FreeBSD 5.1-RELEASE i386 >Organization: >Environment: System: FreeBSD roadrunner 5.1-RELEASE FreeBSD 5.1-RELEASE #1: Mon Aug 11 15:27:16 CEST 2003 q@roadrunner:/usr/obj/usr/src/sys/ROADRUNNER i386 >Description: Inside a chroot, a simple 'pwd' will fail, if it is run on a unionfs mounted directory. truss shows the following: readlink("/etc/malloc.conf","aj",63) = 2 (0x2) issetugid() = 0 (0x0) getuid() = 0 (0x0) mmap(0x0,4096,0x3,0x1002,-1,0x0) = 671449088 (0x28058000) break(0x805c000) = 0 (0x0) break(0x805d000) = 0 (0x0) __getcwd(0x805c000,0x3fc) ERR#20 'Not a directory' stat("/",0xbfbff4e0) = 0 (0x0) lstat(".",0xbfbff4e0) = 0 (0x0) stat("..",0xbfbff400) = 0 (0x0) open("..",0x4,00) = 3 (0x3) fstat(3,0xbfbff400) = 0 (0x0) fcntl(0x3,0x2,0x1) = 0 (0x0) break(0x805e000) = 0 (0x0) __sysctl(0xbfbff2b0,0x2,0x8059084,0xbfbff2ac,0x0,0x0) = 0 (0x0) fstatfs(0x3,0xbfbff300) = 0 (0x0) break(0x805f000) = 0 (0x0) getdirentries(0x3,0x805e000,0x1000,0x805d014) = 512 (0x200) getdirentries(0x3,0x805e200,0xe00,0x805d014) = 512 (0x200) getdirentries(0x3,0x805e400,0xc00,0x805d014) = 0 (0x0) fstat(3,0xbfbff4e0) = 0 (0x0) lseek(3,0x200,0) = 512 (0x200) close(3) = 0 (0x0) lstat("../",0xbfbff4e0) = 0 (0x0) stat("../..",0xbfbff400) = 0 (0x0) open("../..",0x4,04) = 3 (0x3) fstat(3,0xbfbff400) = 0 (0x0) fcntl(0x3,0x2,0x1) = 0 (0x0) fstatfs(0x3,0xbfbff300) = 0 (0x0) fstat(3,0xbfbff4e0) = 0 (0x0) getdirentries(0x3,0x805e000,0x1000,0x805d014) = 512 (0x200) getdirentries(0x3,0x805e000,0x1000,0x805d014) = 0 (0x0) lseek(3,0x0,0) = 0 (0x0) close(3) = 0 (0x0) pwd: write(2,0xbfbfedd0,5) = 5 (0x5) .write(2,0xbfbfedf0,1) = 1 (0x1) : write(2,0x80568cc,2) = 2 (0x2) No such file or directory write(2,0xbfbfedd0,26) = 26 (0x1a) exit(0x1) process exit, rval = 256 This also renders 'make' in any port of choice unuseable. >How-To-Repeat: cd /usr/src && make world DESTDIR=/livefs mkdir -p /livefs/usr/ports && mount -t unionfs /usr/ports /livefs/usr/ports Doing a pwd in /livefs/usr/ports/editors/vim works just fine, however doing a 'make' fails. Running truss on both processes shows that both processes should fail to get getcwd(). I don't know why a simple pwd prints the correct directory, a 'truss pwd' does not. Now chroot to /livefs # chroot /livefs /bin/tcsh # cd /usr/ports/editors/vim && pwd pwd: .: No such file or directory So here pwd "correctly fails" to call getcwd() (It always returns ERR#20), make is broken too. >Fix: Please don't tell me that unionfs is buggy, I know that and I read the manpages. However I think that (when working) unionfs is a real cool tool and can obviously do more than an union-mount. I will try to get into debugging this, but my skills are severly limited with respect to that area :( >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200308261357.h7QDvlG5004823>