Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0085C1147A for ; Fri, 11 Jul 2014 20:37:05 +0000 (UTC) Received: (qmail 62955 invoked by uid 500); 11 Jul 2014 20:37:04 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 62846 invoked by uid 500); 11 Jul 2014 20:37:04 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 62832 invoked by uid 99); 11 Jul 2014 20:37:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2014 20:37:04 +0000 Date: Fri, 11 Jul 2014 20:37:04 +0000 (UTC) From: "Laplie Anderson (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (VFS-531) Cannot "copyFrom" without access to create parent folder even if folder exists MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/VFS-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059321#comment-14059321 ] Laplie Anderson commented on VFS-531: ------------------------------------- Still happens on 2.1-SNAPSHOT downloaded today. Here is the new stacktrace: {code:borderStyle=solid} Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder "file:///home/usera/subfolder". at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:439) at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1377) at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:479) at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:458) at org.apache.commons.vfs2.provider.DefaultFileContent.write(DefaultFileContent.java:772) at org.apache.commons.vfs2.provider.DefaultFileContent.write(DefaultFileContent.java:796) at org.apache.commons.vfs2.FileUtil.copyContent(FileUtil.java:90) at org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:341) ... 2 more Caused by: org.apache.commons.vfs2.FileSystemException: Could not create directory "/home/usera/subfolder". at org.apache.commons.vfs2.provider.local.LocalFile.doCreateFolder(LocalFile.java:153) at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:428) ... 9 more {code} I also found something else out, giving *execute* access, {{chmod 755 /home/usera}} fixes the issue. Write access to that folder is not needed. > Cannot "copyFrom" without access to create parent folder even if folder exists > ------------------------------------------------------------------------------ > > Key: VFS-531 > URL: https://issues.apache.org/jira/browse/VFS-531 > Project: Commons VFS > Issue Type: Bug > Affects Versions: 2.0 > Environment: Linux > Reporter: Laplie Anderson > Original Estimate: 24h > Remaining Estimate: 24h > > Using copyFrom when you don't have access to create the parent folder fails even when the parent folder exists. > I have the folder structure of: > /home/usera/subfolder > Userb has r/w access to the subfolder and read access to the parent folders. CopyFrom with a destination of "/home/usera/subfolder/file" fails > {code:borderStyle=solid} > Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder "file:///home/usera/subfolder". > at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:999) > at org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1424) > at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:461) > at org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:441) > at org.apache.commons.vfs2.FileUtil.copyContent(FileUtil.java:111) > at org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:1053) > ... 2 more > Caused by: org.apache.commons.vfs2.FileSystemException: Could not create directory "/home/usera/subfolder". > at org.apache.commons.vfs2.provider.local.LocalFile.doCreateFolder(LocalFile.java:153) > at org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:988) > ... 7 more > {code} > It looks like the issue is that the code doesn't check if the destination folder exists before calling create. Create throws an exception any time the folder is not created (even if it didn't have to create the folder.) -- This message was sent by Atlassian JIRA (v6.2#6252)