From owner-freebsd-fs@FreeBSD.ORG Fri May 22 17:13:39 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5737C106564A for ; Fri, 22 May 2009 17:13:39 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: from mail-fx0-f168.google.com (mail-fx0-f168.google.com [209.85.220.168]) by mx1.freebsd.org (Postfix) with ESMTP id EA4708FC26 for ; Fri, 22 May 2009 17:13:38 +0000 (UTC) (envelope-from dudu@dudu.ro) Received: by fxm12 with SMTP id 12so1860949fxm.43 for ; Fri, 22 May 2009 10:13:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.123.129 with SMTP id p1mr2412139far.29.1243010483400; Fri, 22 May 2009 09:41:23 -0700 (PDT) From: Vlad GALU Date: Fri, 22 May 2009 19:41:03 +0300 Message-ID: To: freebsd-fs@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: venatir Subject: *stat()-ing symlinks with trailing slashes X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2009 17:13:39 -0000 -- cut here -- root@goofy / # rm -f passwd root@goofy / # ln -s /etc/passwd passwd root@goofy / # stat passwd 74 3 lrwxr-xr-x 1 root wheel 1668572463 11 "May 22 19:34:17 2009" "May 22 19:34:17 2009" "May 22 19:34:17 2009" "May 22 19:34:17 2009" 4096 0 0 passwd root@goofy / # stat passwd/ 74 95688 -rw-r--r-- 1 root wheel 393192 2158 "May 21 09:27:10 2009" "May 21 09:27:10 2009" "May 22 17:25:49 2009" "Apr 7 13:05:32 2008" 4096 8 0 passwd/ root@goofy / # -- and here -- stat(1) is smart enough to figure out that my /passwd is a symlink then calls lstat() on it, thus returning the struct stat corresponding to /etc/passwd However, there's http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/21768 vfs_lookup.c has this piece of code: -- cut here -- /* * Check for bogus trailing slashes. */ if (trailing_slash && dp->v_type != VDIR) { error = ENOTDIR; goto bad2; } -- and here -- I've CC-ed my friend Mircea Danila, who noticed this behavior with lighttpd. As my friend Mircea Danila, who I've CC-ed found out, lighttpd mistakenly treats