Fossil

Check-in [f29c8a44]
Login

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

Overview
Comment:Additional corrections to Windows symlink permissions logic
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | enhanced-symlink
Files: files | file ages | folders
SHA3-256:f29c8a44be4095114ac1566f0b090156a9c5d54b6338d9ac1c2d847ffd3e5aad
User & Date: andygoth 2017-10-14 22:03:05
Context
2017-10-14
22:03
Use transactions while creating symlink_perm table check-in: f42ee09a user: andygoth tags: enhanced-symlink
22:03
Additional corrections to Windows symlink permissions logic check-in: f29c8a44 user: andygoth tags: enhanced-symlink
21:48
Tweak comment style for consistency within functions check-in: 364d0431 user: andygoth tags: enhanced-symlink
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vfile.c.

176
177
178
179
180
181
182

183
184
185
186
187
188
189
...
207
208
209
210
211
212
213
214
215
216
217
218

219

220
221
222
223
224
225
226
227
228
229
  int useMtime = (cksigFlags & CKSIG_HASH)==0
                    && db_get_boolean("mtime-changes", 1);

  /* On Windows, get symlink permission status from the "manifest.symlinks" file
  ** if it exists and if the "manifest" setting contains the "l" flag. */
#ifdef _WIN32
  int manifestSymlinks = get_checkout_symlink_table();

#endif

  db_begin_transaction();
  db_prepare(&q, "SELECT id, %Q || pathname,"
                 "       vfile.mrid, deleted, chnged, uuid, size, mtime,"
                 "      CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END"
                 "  FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
................................................................................
    isDeleted = db_column_int(&q, 3);
    oldChnged = chnged = db_column_int(&q, 4);
    oldMtime = db_column_int64(&q, 7);
    origSize = db_column_int64(&q, 6);
    currentSize = file_wd_size(zName);
    currentMtime = file_wd_mtime(0);
    origPerm = db_column_int(&q, 8);
#ifdef _WIN32
    /* For Windows, if the "manifest" setting contains the "l" flag and the
    ** "manifest.symlinks" file exists, use its contents to determine which
    ** files do and do not have the symlink permission. */
    if( manifestSymlinks

     && db_exists("SELECT 1 FROM symlink_perm WHERE filename=%Q", zName) ){

      currentPerm = PERM_LNK;
    }else{
      currentPerm = origPerm;
    }
#else
    currentPerm = file_wd_perm(zName);
#endif
    if( chnged==0 && (isDeleted || rid==0) ){
      /* "fossil rm" or "fossil add" always change the file */
      chnged = 1;







>







 







|



|
>
|
>


|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
...
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
  int useMtime = (cksigFlags & CKSIG_HASH)==0
                    && db_get_boolean("mtime-changes", 1);

  /* On Windows, get symlink permission status from the "manifest.symlinks" file
  ** if it exists and if the "manifest" setting contains the "l" flag. */
#ifdef _WIN32
  int manifestSymlinks = get_checkout_symlink_table();
  int nRoot = strlen(g.zLocalRoot);
#endif

  db_begin_transaction();
  db_prepare(&q, "SELECT id, %Q || pathname,"
                 "       vfile.mrid, deleted, chnged, uuid, size, mtime,"
                 "      CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END"
                 "  FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid"
................................................................................
    isDeleted = db_column_int(&q, 3);
    oldChnged = chnged = db_column_int(&q, 4);
    oldMtime = db_column_int64(&q, 7);
    origSize = db_column_int64(&q, 6);
    currentSize = file_wd_size(zName);
    currentMtime = file_wd_mtime(0);
    origPerm = db_column_int(&q, 8);
#ifndef _WIN32
    /* For Windows, if the "manifest" setting contains the "l" flag and the
    ** "manifest.symlinks" file exists, use its contents to determine which
    ** files do and do not have the symlink permission. */
    if( !manifestSymlinks ){
      currentPerm = origPerm;
    }else if( db_exists("SELECT 1 FROM symlink_perm "
                        "WHERE filename=%Q", zName+nRoot) ){
      currentPerm = PERM_LNK;
    }else{
      currentPerm = 0;
    }
#else
    currentPerm = file_wd_perm(zName);
#endif
    if( chnged==0 && (isDeleted || rid==0) ){
      /* "fossil rm" or "fossil add" always change the file */
      chnged = 1;