Community
Participate
Working Groups
Build Identifier: 20100617-1415 Linux distro: Fedora 12 x64 JDK 1.6.0_18 x64 I'm running eclipse as a standard user When resources are copied from source directory to target directory, the access rights are changed as described in the subject. When I run an application server with a different user which points to this target directory, I have an expected MissingResourcesException. It's only resources, classes are generated with the correct access rights -rw-rw-r-- With previous version of Eclipse (Galileo 20090920-1017) on the same workspace, resources are copied with -rw-rw-r-- rights like classes. Laurent Reproducible: Always Steps to Reproduce: 1. Run Eclipse as a standard user 2. Simply build a Java project with resources in it.
The builder is using: org.eclipse.core.resources.IResource.copy(IPath, int, IProgressMonitor) to copy resources. So the problem might come from the underlying resource layer. Moving to Platform/Resources for comment. Note that I could not reproduce myself as I don't have access to a Linux box right now.
(In reply to comment #0) When a build is performed, Java files from the source directory are built and appropriate class files are created in the target directory. For newly created files Umask is used to set the attributes. I guess that Umask on your machine is -rw-rw-r--. What do you mean by 'resources are copied from source directory to target directory'? Do you copy them manually? And how do you create files in your source directory. Can you explain that?
(In reply to comment #2) > What do you mean by 'resources are copied from source directory to target > directory'? Do you copy them manually? The Java builder copies all non ".java" resources directly from the source to the target directory. As Olivier says they just use the IResource API to perform that copying.
(In reply to comment #3) > The Java builder copies all non ".java" resources directly from the source to > the target directory. As Olivier says they just use the IResource API to > perform that copying. Thanks John. It was not clear for me from the Olivier's comment. Laurent, could you explain how you create files in your source directory? Do you change their access rights before the build is performed?
Hi, I did the test again: Fresh install of eclipse helios (unpacked from eclipse.org jar as root in /opt/eclipse/helios, and ran with standard user "laurent") Fresh workspace in /home/laurent/workspace New -> Java project TestProject In src, new -> file test.properties It's copied automatically in bin which is the default target directory. ls -al /home/laurent/workspace/TestProject/bin/test.properties -rw------- 1 laurent laurent 0 2010-09-06 10:48 /home/laurent/workspace/TestProject/bin/test.properties Exact same test with Galileo (installed the same way as helios: unpacked from eclipse.org jar as root in /opt/eclipse/galileo, and ran with same standard user "laurent") in a new fresh workspace workspace2 ls -al /home/laurent/workspace2/TestProject/bin/test.properties -rw-rw-r-- 1 laurent laurent 0 2010-09-06 10:56 /home/laurent/workspace2/TestProject/bin/test.properties Regards, Laurent (In reply to comment #4) > (In reply to comment #3) > > The Java builder copies all non ".java" resources directly from the source to > > the target directory. As Olivier says they just use the IResource API to > > perform that copying. > > Thanks John. It was not clear for me from the Olivier's comment. > > Laurent, could you explain how you create files in your source directory? Do > you change their access rights before the build is performed?
I reproduced this on: - Linux 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:04:26 UTC 2009 i686 GNU/Linux Distributor ID: Ubuntu Description: Ubuntu 9.10 Release: 9.10 Codename: karmic - Helios Service Release 1, according to About box, Build id=20100917-0705, according to Configuration Details->Configuration, eclipse.buildId=M20100909-0800 - java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Oracle JRockit(R) (build R28.0.1-21-133393-1.6.0_20-20100512-2126-linux-ia32, compiled mode) - libgtk 2.18.3-1ubuntu2.2 - umask 0022 It seems that this issue applies only to files (resources, not source files) that are automatically copied to the output directory as part of the build process. If i manually copy a file through the Navigator, using Copy & Paste, the destination's permissions are right (i.e. same as the source).
Created attachment 188520 [details] Proposed fix for this bug I traced the problem into JDT's AbstractImageBuilder and specifically into this method: protected void copyResource(IResource source, IResource destination) throws CoreException { IPath destPath = destination.getFullPath(); try { source.copy(destPath, IResource.FORCE | IResource.DERIVED, null); } catch (CoreException e) { // handle the case when the source resource is deleted source.refreshLocal(0, null); if (!source.exists()) return; // source resource was deleted so skip it throw e; } Util.setReadOnly(destination, false); // just in case the original was read only } What happens is that after copying the file (including its filesystem attributes), for some unknown reason ("just in case the original was read only") we overwrite them by using Util.setReadOnly(..) I attached a patch/fix, i believe it's appropriate.
. *** This bug has been marked as a duplicate of bug 323681 ***