Fossil

Check-in [4fff3661]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:branch, start committing hacking that will hopefully yield fix to this problem: one is allowed to checkout "artifacts" that should not be checkout-able (ie: changes to tickets); trying to check this out is permitted, but results in a segfault
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fix artifact checkout
Files: files | file ages | folders
SHA1:4fff36610997f7f3b222d981b30d9ae99f177e5d
User & Date: bch 2009-04-19 05:48:45
Context
2009-04-19
06:14
fix for ticket [8832434e32], wrong args for checkoutable() check-in: ab6a2931 user: bch tags: fix artifact checkout
05:48
branch, start committing hacking that will hopefully yield fix to this problem: one is allowed to checkout "artifacts" that should not be checkout-able (ie: changes to tickets); trying to check this out is permitted, but results in a segfault check-in: 4fff3661 user: bch tags: fix artifact checkout
2009-04-13
09:50
Update to version SQLite 3.6.13 check-in: 879e8c5f user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/checkout.c.

41
42
43
44
45
46
47






























48
49
50
51
52
53
54
...
155
156
157
158
159
160
161



162
163
164
165
166
167
168
  db_must_be_within_tree();
  vid = db_lget_int("checkout",0);
  if( vid==0 ) return 2;
  vfile_check_signature(vid);
  return db_exists("SELECT 1 FROM vfile WHERE chnged"
                   " OR coalesce(origname!=pathname,0)");
}































/*
** Undo the current check-out.  Unlink all files from the disk.
** Clear the VFILE table.
*/
void uncheckout(int vid){
  if( vid==0 ) return;
................................................................................
  db_begin_transaction();
  forceFlag = find_option("force","f",0)!=0;
  noWrite = find_option("dontwrite",0,0)!=0;
  if( g.argc!=3 ) usage("?--force? VERSION");
  if( !forceFlag && unsaved_changes()==1 ){
    fossil_fatal("there are unsaved changes in the current checkout");
  }



  if( forceFlag ){
    db_multi_exec("DELETE FROM vfile");
    prior = 0;
  }else{
    prior = db_lget_int("checkout",0);
  }
  vid = load_vfile(g.argv[2]);







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
  db_must_be_within_tree();
  vid = db_lget_int("checkout",0);
  if( vid==0 ) return 2;
  vfile_check_signature(vid);
  return db_exists("SELECT 1 FROM vfile WHERE chnged"
                   " OR coalesce(origname!=pathname,0)");
}

/*
** Check to see if the requested co is in fact "checkout-able"
** Return values:
**   0: Not checkout-able (does not exist, or is not an on-disk artifact)
**   1: Is checkout-able.
*/
int checkoutable(const char *zName){
  int rc=1; /* assuming is checkout-able */
  Blob uuid;
  const char *rid=(char *)NULL;
  Stmt q; // db query
  char *zSQL; //build-up sql

  //  zSQL = mprintf();

  // [create sql statement]
  // db_prepare(&q,sqlstmt);

  blob_init(&uuid, zName, -1);
  if( name_to_uuid(&uuid, 1) ){
    fossil_panic(g.zErrMsg);
  }

  /*  nParent=db_text(0,"select rid from blob where uuid=%s",uuid.nameofobj); */

  /*  int nParent = db_column_int(q, somenum); */
  return rc;
}


/*
** Undo the current check-out.  Unlink all files from the disk.
** Clear the VFILE table.
*/
void uncheckout(int vid){
  if( vid==0 ) return;
................................................................................
  db_begin_transaction();
  forceFlag = find_option("force","f",0)!=0;
  noWrite = find_option("dontwrite",0,0)!=0;
  if( g.argc!=3 ) usage("?--force? VERSION");
  if( !forceFlag && unsaved_changes()==1 ){
    fossil_fatal("there are unsaved changes in the current checkout");
  }
  if(!checkoutable()){
    fossil_fatal("the VERSION you requested is not a checkout-able artifact");
  }
  if( forceFlag ){
    db_multi_exec("DELETE FROM vfile");
    prior = 0;
  }else{
    prior = db_lget_int("checkout",0);
  }
  vid = load_vfile(g.argv[2]);