[
https://issues.apache.org/jira/browse/VFS-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14519764#comment-14519764
]
Pascal Pochet commented on VFS-531:
-----------------------------------
Execute access is not enough due to the walking up algorithm, if you have a
hierarchy like this:
../noread/canwrite/
where noread is drwx--x--x 3 root root
and canwrite is drwxr-xr-x 2 someuser someuser
you will never be able to write anything into "canwrite" folder as user
"someuser" because the absurd logic of walking from parent to parent folder to
see if each path segment exists, while of course using any other FTP client
works.
Of course doing the copy step directly with the full path to the target, works.
> 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.3.4#6332)