From dev-return-37486-apmail-harmony-dev-archive=harmony.apache.org@harmony.apache.org Thu Jun 18 19:39:12 2009 Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 88018 invoked from network); 18 Jun 2009 19:39:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Jun 2009 19:39:12 -0000 Received: (qmail 79174 invoked by uid 500); 18 Jun 2009 19:39:22 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 79115 invoked by uid 500); 18 Jun 2009 19:39:22 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 79104 invoked by uid 99); 18 Jun 2009 19:39:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 19:39:22 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of t.p.ellison@gmail.com designates 72.14.220.158 as permitted sender) Received: from [72.14.220.158] (HELO fg-out-1718.google.com) (72.14.220.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2009 19:39:11 +0000 Received: by fg-out-1718.google.com with SMTP id 16so1221870fgg.13 for ; Thu, 18 Jun 2009 12:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=kKBW9xTk+TO1yRGREi6YSFbSMzodbV8kygcJh2IFy1c=; b=cwR+hIUr3AxtV+j69DXHA7v+psBWV8vw/Q23KbB/sgZ5XJAt1guP0k8RLjxXoxFXgK Ic5rebvAyQAMFOiGdLhCbarqjVEQA6F3UlBZttpmdNL0VbHuRFhL9/2aVMHtBoz4QlIU qrY4j4Q2Iovq9FafA7KUuctY7yfhaUcEddW6k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=YqCgFI2Hh4nyw4oMt3NtlUIPt2DZ2TljnFGTWkAmxLAn6nQ+3fch2kkLJYIMss5MEN cAvZAd9HKXyEgxHS+c84FzJRtuQQ4e1IVXm3KNR7jgfx7y4fCV/tNH0f4ODWEmfO8YzQ 1kqwn32EO04yTpN0ls/AR4FK+rNw3ubfB9BXY= Received: by 10.86.59.18 with SMTP id h18mr2376380fga.44.1245353931098; Thu, 18 Jun 2009 12:38:51 -0700 (PDT) Received: from ?192.168.0.2? ([89.243.223.118]) by mx.google.com with ESMTPS id 4sm6032659fge.13.2009.06.18.12.38.31 (version=SSLv3 cipher=RC4-MD5); Thu, 18 Jun 2009 12:38:43 -0700 (PDT) Message-ID: <4A3A97A4.1000600@gmail.com> Date: Thu, 18 Jun 2009 20:38:12 +0100 From: Tim Ellison User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: dev@harmony.apache.org Subject: Re: [jira] Created: (HARMONY-6238) [classlib][luni] File path limit set to 1K chars for all file systems References: <1456060389.1245338888146.JavaMail.jira@brutus> <4A3A78EE.6060808@googlemail.com> In-Reply-To: <4A3A78EE.6060808@googlemail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Oliver Deakin wrote: > I've had a quick look around for the "right" way to do this, and it > seems there are 2 options: > 1) Determine the max path length from a system macro, probably PATH_MAX > in limits.h. > 2) Use the unix system call pathconf() to get the max path length. > > I think using a build time constant, as in 1, is preferable, however > this macro is not defined on all platforms. On zOS, for example, only > _POSIX_PATH_MAX is defined, and that is set to a paltry 256 (which is > not the real max path length - pathconf() tells me it is 1024). > > Perhaps to start with we can include /usr/include/linux/limits.h and use > PATH_MAX for linux platforms (I'm assuming that file exists for linux > distros in general here - perhaps someone can clarify this?) and on > non-linux platforms fall back to a default of 1024. We can add other > platforms in as we find the correct includes/macro definitions for them. >From the Harmony code I was looking at, the max path length is used to allocate char buffers so we can do path manipulations before passing through to OS calls. We fail early if the path is greater than the expected max path length. Would could, as you say try to set the max path length based on the OS we are using, but even that is going to be a guess since who knows where the file path points (e.g. network drives etc.)? I wonder if we can be a bit lazier and set the Harmony max path length to a large number for the path manipulations, then let the OS call fail if the path is too long? (caveat: I've not looked at all uses of the HyMaxPath const to see if that is a good idea or not) Regards, Tim