tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Bainbridge <jbainbri...@gmail.com>
Subject Re: Can't rename a file using renameTo()
Date Tue, 21 Jun 2005 21:19:28 GMT
On 6/21/05, Kam Lung Leung <kleung@advoicetech.com> wrote:
> Hi,
> 
> I have a servlet, Servlet-A, that rename a file from /tmp/oldFile to /someDirectory/newFile.
The Servlet-A runs fine when it runs by itself in a Red Hat Linux 7.2 server that has jakarta-tomcat-4.1.30
running. However, it false to rename the /tmp/oldFile to /someDirectory/newFile when the Servlet-A
run (within the jakarta-tomcat-4.1.30) in a Red Hat Linux 7.2 server box that also has jboss-3.2.1_tomcat-4.1.24
running. I thought it may be privilege issue so I set the /someDirectory directory with "chmod
–R 777" and run Tomcat as a root user. But, it is still false to rename the /tmp/oldFile
file to the /someDirectory/newFile.
> 
> The strange thing is that the Servlet-A was able to write the oldFile to the /tmp directory
but can not rename the oldFile to the /someDirectory directory that was allowed for writing
for ALL user levels. Can this be Jboss prevented the rename operation. I used the canRead
and canWrite to check allowable action by the File. It turns out that the Servlet-A can read
and write the /tmp/ oldFile. But the Servlet-A can't read or write the /someDirectory/newFile.
> 
> The strangest thing is that when the Servlet-A runs in a Red Hat Linux 7.2 server that
has ONLY jakarta-tomcat-4.1.30 running, the condition of canRead and canwrite are the same.
Meaning that the Servlet-A was able to read, and write the oldFile. But can't read, and write
the newFile. However, the renameTo() method returned true and the Servlet-A was able to rename
the /tmp/oldFile into /someDirectory/newFile.

It took me a few reads to even come close to following all that but is
it possibly that you are trying to copy a subdirectory within /tmp to
a subdirectory of /someDirectory that doesn't exist?


-- 
Jason Bainbridge
http://kde.org - webmaster@kde.org
Personal Site - http://jasonbainbridge.com
Mime
View raw message