From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAgHN-000328-1Z for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:43:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAgHE-0002WO-LD for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:43:08 -0500 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:41399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAgHE-0002WI-Dm for qemu-devel@nongnu.org; Tue, 04 Feb 2014 08:43:00 -0500 Received: by mail-pa0-f44.google.com with SMTP id kq14so8471759pab.17 for ; Tue, 04 Feb 2014 05:42:59 -0800 (PST) Message-ID: <52F0EE65.60200@gmail.com> Date: Tue, 04 Feb 2014 21:43:01 +0800 From: Chen Gang MIME-Version: 1.0 References: <52EF68CA.9060604@gmail.com> <20140203103429.GB10408@redhat.com> <52EF71DC.3000309@gmail.com> <52F0C8BA.7020709@gmail.com> <87vbwvoyij.fsf@blackfin.pond.sub.org> <52F0E72A.7050200@redhat.com> In-Reply-To: <52F0E72A.7050200@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] hw/9pfs/virtio-9p-local.c: use snprintf() instead of sprintf() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: QEMU Developers , Markus Armbruster , aliguori@amazon.com, aneesh.kumar@linux.vnet.ibm.com On 02/04/2014 09:12 PM, Eric Blake wrote: > On 02/04/2014 05:25 AM, Markus Armbruster wrote: > >> Second guessing when a pathname is too long for a system call is not a >> good idea. If it's too long, the system call will tell you. As Dan >> noted, PATH_MAX is *not* a hard limit. >> >> {PATH_MAX} >> Maximum number of bytes the implementation will store as a >> pathname in a user-supplied buffer of unspecified size, >> including the terminating null character. Minimum number the >> implementation will accept as the maximum number of bytes in a >> pathname. > > Linux allows unbelievably long absolute names. Jim Meyering proved with > coreutils that you can create an absolute name well over a megabyte in > length. The trick is that you have to access it via relative names > where each relative name is PATH_MAX or less (that is, the Linux kernel > refuses to operate on more than a page at a time when doing file name > resolution), by using openat() and friends. mkdirat() can create a > directory with an absolute name longer than PATH_MAX, even if mkdir() can't. > OK, thank all of you, what you said sound reasonable to me. I don't know why the original author/maintainer did not support 'unlimited' path, so better to get original authors' opinion. And can we split current discussion into 2 pieces: - fix sprintf() bug, can use snprintf() to fix it just like other places have done -- apply this patch (comments need be improved). - improve 9pfs features -- support 'unlimited' path internally. before do it, better to get original authors' response firstly. I guess, we need change quite a few areas and have a full test. Thanks. -- Chen Gang Open, share and attitude like air, water and life which God blessed