Check-in [525cc35bf3]
Not logged in
Overview

SHA1 Hash:525cc35bf3896727c9c6165e183da5f4c0e2d48d
Date: 2008-05-17 08:53:34
User: drh
Comment:Allow the check-in of files show names begin with ".". Add the "private" table to repository schema but do not yet do anything with it.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/file.c from [2d8ec6b3a1] to [33dcca33b9].

@@ -73,10 +73,11 @@
 int file_isexe(const char *zFilename){
   struct stat buf;
   if( stat(zFilename, &buf)!=0 ){
     return 0;
   }
+  if( !S_ISREG(buf.st_mode) ) return 0;
 #ifdef __MINGW32__
   return ((S_IXUSR)&buf.st_mode)!=0;
 #else
   return ((S_IXUSR|S_IXGRP|S_IXOTH)&buf.st_mode)!=0;
 #endif
@@ -88,11 +89,11 @@
 void file_setexe(const char *zFilename, int onoff){
 #ifndef __MINGW32__
   struct stat buf;
   if( stat(zFilename, &buf)!=0 ) return;
   if( onoff ){
-    if( (buf.st_mode & 0111)==0 ){
+    if( (buf.st_mode & 0111)!=0111 ){
       chmod(zFilename, buf.st_mode | 0111);
     }
   }else{
     if( (buf.st_mode & 0111)!=0 ){
       chmod(zFilename, buf.st_mode & ~0111);
@@ -141,26 +142,32 @@
 ** Return true if the filename given is a valid filename for
 ** a file in a repository.  Valid filenames follow all of the
 ** following rules:
 **
 **     *  Does not begin with "/"
-**     *  Does not contain any path element that begins with "."
+**     *  Does not contain any path element named "." or ".."
 **     *  Does not contain any of these characters in the path: "\*[]?"
 **     *  Does not end with "/".
 **     *  Does not contain two or more "/" characters in a row.
 **     *  Contains at least one character
 */
 int file_is_simple_pathname(const char *z){
   int i;
-  if( *z=='.' || *z=='/' || *z==0 ) return 0;
+  if( *z=='/' || *z==0 ) return 0;
+  if( *z=='.' ){
+    if( z[1]=='/' || z[1]==0 ) return 0;
+    if( z[1]=='.' && (z[2]=='/' || z[2]==0) ) return 0;
+  }
   for(i=0; z[i]; i++){
     if( z[i]=='\\' || z[i]=='*' || z[i]=='[' || z[i]==']' || z[i]=='?' ){
       return 0;
     }
     if( z[i]=='/' ){
-      if( z[i+1]=='/' || z[i+1]=='.' ){
-        return 0;
+      if( z[i+1]=='/' ) return 0;
+      if( z[i+1]=='.' ){
+        if( z[i+2]=='/' || z[i+2]==0 ) return 0;
+        if( z[i+2]=='.' && (z[i+3]=='/' || z[i+3]==0) ) return 0;
       }
     }
   }
   if( z[i-1]=='/' ) return 0;
   return 1;

Modified src/rebuild.c from [468a623847] to [c03e63f03e].

@@ -35,14 +35,24 @@
 @ --
 @ CREATE INDEX IF NOT EXISTS delta_i1 ON delta(srcid);
 @
 @ -- Artifacts that should not be processed are identified in the
 @ -- "shun" table.  Artifacts that are control-file forgeries or
-@ -- spam can be shunned in order to prevent them from contaminating
+@ -- spam or artifacts whose contents violate administrative policy
+@ -- can be shunned in order to prevent them from contaminating
 @ -- the repository.
 @ --
+@ -- Shunned artifacts do not exist in the blob table.  Hence they
+@ -- have not artifact ID (rid) and we thus must store their full
+@ -- UUID.
+@ --
 @ CREATE TABLE IF NOT EXISTS shun(uuid UNIQUE);
+@
+@ -- Artifacts that should not be pushed are stored in the "private"
+@ -- table.
+@ --
+@ CREATE TABLE IF NOT EXISTS private(rid INTEGER PRIMARY KEY);
 @
 @ -- An entry in this table describes a database query that generates a
 @ -- table of tickets.
 @ --
 @ CREATE TABLE IF NOT EXISTS reportfmt(
@@ -49,20 +59,10 @@
 @    rn integer primary key,  -- Report number
 @    owner text,              -- Owner of this report format (not used)
 @    title text,              -- Title of this report
 @    cols text,               -- A color-key specification
 @    sqlcode text             -- An SQL SELECT statement for this report
-@ );
-@
-@ -- A cache for mapping baseline artifact ID + filename into file
-@ -- artifact ID.  Used by the /doc method.
-@ --
-@ CREATE TABLE IF NOT EXISTS vcache(
-@    vid integer,             -- Baseline artifact ID
-@    fname text,              -- Filename
-@    rid integer,             -- File artifact ID
-@    UNIQUE(vid,fname,rid)
 @ );
 ;
 
 /*
 ** Variables used for progress information
@@ -170,19 +170,24 @@
   db_multi_exec(zSchemaUpdates);
   for(;;){
     zTable = db_text(0,
        "SELECT name FROM sqlite_master"
        " WHERE type='table'"
-       " AND name NOT IN ('blob','delta','rcvfrom','user','config','shun')");
+       " AND name NOT IN ('blob','delta','rcvfrom','user',"
+                         "'config','shun','private')"
+    );
     if( zTable==0 ) break;
     db_multi_exec("DROP TABLE %Q", zTable);
     free(zTable);
   }
   db_multi_exec(zRepositorySchema2);
   ticket_create_table(0);
 
-  db_multi_exec("INSERT INTO unclustered SELECT rid FROM blob");
+  db_multi_exec(
+     "INSERT INTO unclustered"
+     " SELECT rid FROM blob EXCEPT SELECT rid FROM private"
+  );
   db_multi_exec(
      "DELETE FROM unclustered"
      " WHERE rid IN (SELECT rid FROM shun JOIN blob USING(uuid))"
   );
   db_multi_exec(

Modified src/schema.c from [f141028e53] to [f7d41345c4].

@@ -118,14 +118,25 @@
 @   CHECK( typeof(name)='text' AND length(name)>=1 )
 @ );
 @
 @ -- Artifacts that should not be processed are identified in the
 @ -- "shun" table.  Artifacts that are control-file forgeries or
-@ -- spam can be shunned in order to prevent them from contaminating
+@ -- spam or artifacts whose contents violate administrative policy
+@ -- can be shunned in order to prevent them from contaminating
 @ -- the repository.
 @ --
+@ -- Shunned artifacts do not exist in the blob table.  Hence they
+@ -- have not artifact ID (rid) and we thus must store their full
+@ -- UUID.
+@ --
 @ CREATE TABLE shun(uuid UNIQUE);
+@
+@ -- Artifacts that should not be pushed are stored in the "private"
+@ -- table.  Private artifacts are omitted from the "unclustered" and
+@ -- "unsent" tables.
+@ --
+@ CREATE TABLE private(rid INTEGER PRIMARY KEY);
 @
 @ -- An entry in this table describes a database query that generates a
 @ -- table of tickets.
 @ --
 @ CREATE TABLE reportfmt(