Concrete examples of the unlink problem in NestedVM and SQLite/NestedVM...

$ cat unlink_before_close.c
#include <stdio.h>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
int main() {
   int bytes, rc;
const char msg[] = "hello,\nworld.\n"; const char fname[] = "foo.tmp";
   int msg_len = sizeof(msg) / sizeof(msg[0]);
   int fd = open(fname, O_WRONLY|O_CREAT, 0600);
   if (fd < 0) {
       printf("open failed: %s\n", strerror(errno));
       return 1;
   }
   printf("open succeeded\n");
   rc = unlink(fname);
   if (rc < 0) {
      printf("unlink failed: %s\n", strerror(errno));
      return 2;
   }
   printf("unlink succeeded\n");
   bytes = write(fd, msg, strlen(msg));
   if (bytes < 0) {
      printf("write failed: %s\n", strerror(errno));
      return 3;
   }
   printf("wrote %d bytes\n", bytes);
   rc = close(fd);
   if (rc < 0) {
      printf("close failed: %s\n", strerror(errno));
      return 4;
   }
   printf("close succeeded\n");
   return 0;
}


# native UNIX filesystem (or cygwin) - succeeds
$ gcc unlink_before_close.c -o unlink_before_close
$ ls foo.tmp
ls: cannot access foo.tmp: No such file or directory
$ ./unlink_before_close
open succeeded
unlink succeeded
wrote 14 bytes
close succeeded
$ ls foo.tmp
ls: cannot access foo.tmp: No such file or directory


# NestedVM on WIN2K, java 1.4.2 - fails
WIN2K$ ls foo.tmp
ls: cannot access foo.tmp: No such file or directory
WIN2K$ upstream/install/bin/mips-unknown-elf-gcc -mmemcpy -ffunction-sections 
-fdata-sections
-falign-functions=256 -fno-rename-registers -fno-schedule-insns 
-fno-delayed-branch
-freduce-all-givs -march=mips1 unlink_before_close.c -o unlink_before_close.mips
WIN2K$ java -cp build org.ibex.nestedvm.Interpreter unlink_before_close.mips
open succeeded
unlink failed: Not owner
Exit status: 2
WIN2K$ ls foo.tmp
foo.tmp


# sqlite3.mips on WIN2K under NestedVM, java 1.4.2 - fails
WIN2K$ rm -f etilqs_*
WIN2K$ ls etilqs_*
ls: cannot access etilqs_*: No such file or directory
WIN2K$ java -cp build org.ibex.nestedvm.Interpreter sqlite3.mips foo.db
SQLite version 3.3.10
Enter ".help" for instructions
sqlite> PRAGMA temp_store_directory = '.';
sqlite> create table xyz(x,y,z);
sqlite> insert into xyz values(4,5,6);
sqlite> insert into xyz values(1,2,3);
sqlite> vacuum;
sqlite> select * from xyz order by 3,2,1;
1|2|3
4|5|6
sqlite> .q
Exit status: 0
WIN2K$ ls etilqs_*
etilqs_g6W0rvm2YBEl8gh

Notice the undeleted sqlite temp file above.




____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLiteJDBC" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups-beta.google.com/group/sqlitejdbc?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to