permissions not work correctly deleting a file

Bug #172362 reported by Italo Canepa
4
Affects Status Importance Assigned to Milestone
sun-java5 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

A simple java program:
public class ReadString {
   public static void main (String[] args) {
   System.out.print("Enter the path name to delete: ");
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   String pathName = null;
    try {
         pathName = br.readLine();
      } catch (IOException ioe) {
         System.out.println("IO error trying to read path name!");
         System.exit(1);
      }
      System.out.println("Thanks, deleting the file, " + pathName);
      File fileDaCancellare = new File(pathName);
      if(fileDaCancellare.exists()) {
       if(!fileDaCancellare.delete()) {
  System.out.println("Error trying to delete path name!");
         System.exit(1);
  }
        } else {
         // noting
        }
 }
} // end of ReadString class

Works in a strange way:
icanepa@JtLaptop1:~/local$ ls -la delme
ls: delme: Nessun file o directory
icanepa@JtLaptop1:~/local$ sudo touch delme
icanepa@JtLaptop1:~/local$ sudo chmod -w delme
icanepa@JtLaptop1:~/local$ ls -la delme
-r--r--r-- 1 root root 0 2007-11-27 17:42 delme
icanepa@JtLaptop1:~/local$ java ReadString
Enter the path name to delete: delme
Thanks, deleting the file, delme
icanepa@JtLaptop1:~/local$ ls -la delme
ls: delme: Nessun file o directory
icanepa@JtLaptop1:~/local$

A program of a simple user delete a root read only file, are permission working good?
Italo Canepa

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately we can't fix it, because your description didn't include enough information. You may find it helpful to read "How to report bugs effectively" (http://www.chiark.greenend.org.uk/~sgtatham/bugs.html). We'd be grateful if you would then provide a more complete description of the problem.

We have instructions on debugging some types of problems (http://wiki.ubuntu.com/DebuggingProcedures).

At a minimum, we need:
1. the specific steps or actions you took that caused you to encounter the problem,
2. the behavior you expected, and
3. the behavior you actually encountered (in as much detail as possible).

Also please note that marking a bug as "security" should only be done if the bug shows evidence of allowing attackers to cross privilege boundaries or directly causes the loss of data/privacy.

Thanks, and please feel free to report any other bugs you may find.

Changed in sun-java5:
status: New → Invalid
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Oops! I sent the wrong response to this bug. You described the problem just fine, however this is not a bug because to delete a file you don't look at the file's permissions but rather it's parent directory.

Sorry for the confusion.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.