Fossil SCM

Additional corrections to Windows symlink permissions logic

andygoth 2017-10-14 22:03 UTC andygoth-enhanced-symlink
Commit f29c8a44be4095114ac1566f0b090156a9c5d54b6338d9ac1c2d847ffd3e5aad
1 file changed +7 -4
+7 -4
--- src/vfile.c
+++ src/vfile.c
@@ -178,10 +178,11 @@
178178
179179
/* On Windows, get symlink permission status from the "manifest.symlinks" file
180180
** if it exists and if the "manifest" setting contains the "l" flag. */
181181
#ifdef _WIN32
182182
int manifestSymlinks = get_checkout_symlink_table();
183
+ int nRoot = strlen(g.zLocalRoot);
183184
#endif
184185
185186
db_begin_transaction();
186187
db_prepare(&q, "SELECT id, %Q || pathname,"
187188
" vfile.mrid, deleted, chnged, uuid, size, mtime,"
@@ -209,19 +210,21 @@
209210
oldMtime = db_column_int64(&q, 7);
210211
origSize = db_column_int64(&q, 6);
211212
currentSize = file_wd_size(zName);
212213
currentMtime = file_wd_mtime(0);
213214
origPerm = db_column_int(&q, 8);
214
-#ifdef _WIN32
215
+#ifndef _WIN32
215216
/* For Windows, if the "manifest" setting contains the "l" flag and the
216217
** "manifest.symlinks" file exists, use its contents to determine which
217218
** files do and do not have the symlink permission. */
218
- if( manifestSymlinks
219
- && db_exists("SELECT 1 FROM symlink_perm WHERE filename=%Q", zName) ){
219
+ if( !manifestSymlinks ){
220
+ currentPerm = origPerm;
221
+ }else if( db_exists("SELECT 1 FROM symlink_perm "
222
+ "WHERE filename=%Q", zName+nRoot) ){
220223
currentPerm = PERM_LNK;
221224
}else{
222
- currentPerm = origPerm;
225
+ currentPerm = 0;
223226
}
224227
#else
225228
currentPerm = file_wd_perm(zName);
226229
#endif
227230
if( chnged==0 && (isDeleted || rid==0) ){
228231
--- src/vfile.c
+++ src/vfile.c
@@ -178,10 +178,11 @@
178
179 /* On Windows, get symlink permission status from the "manifest.symlinks" file
180 ** if it exists and if the "manifest" setting contains the "l" flag. */
181 #ifdef _WIN32
182 int manifestSymlinks = get_checkout_symlink_table();
 
183 #endif
184
185 db_begin_transaction();
186 db_prepare(&q, "SELECT id, %Q || pathname,"
187 " vfile.mrid, deleted, chnged, uuid, size, mtime,"
@@ -209,19 +210,21 @@
209 oldMtime = db_column_int64(&q, 7);
210 origSize = db_column_int64(&q, 6);
211 currentSize = file_wd_size(zName);
212 currentMtime = file_wd_mtime(0);
213 origPerm = db_column_int(&q, 8);
214 #ifdef _WIN32
215 /* For Windows, if the "manifest" setting contains the "l" flag and the
216 ** "manifest.symlinks" file exists, use its contents to determine which
217 ** files do and do not have the symlink permission. */
218 if( manifestSymlinks
219 && db_exists("SELECT 1 FROM symlink_perm WHERE filename=%Q", zName) ){
 
 
220 currentPerm = PERM_LNK;
221 }else{
222 currentPerm = origPerm;
223 }
224 #else
225 currentPerm = file_wd_perm(zName);
226 #endif
227 if( chnged==0 && (isDeleted || rid==0) ){
228
--- src/vfile.c
+++ src/vfile.c
@@ -178,10 +178,11 @@
178
179 /* On Windows, get symlink permission status from the "manifest.symlinks" file
180 ** if it exists and if the "manifest" setting contains the "l" flag. */
181 #ifdef _WIN32
182 int manifestSymlinks = get_checkout_symlink_table();
183 int nRoot = strlen(g.zLocalRoot);
184 #endif
185
186 db_begin_transaction();
187 db_prepare(&q, "SELECT id, %Q || pathname,"
188 " vfile.mrid, deleted, chnged, uuid, size, mtime,"
@@ -209,19 +210,21 @@
210 oldMtime = db_column_int64(&q, 7);
211 origSize = db_column_int64(&q, 6);
212 currentSize = file_wd_size(zName);
213 currentMtime = file_wd_mtime(0);
214 origPerm = db_column_int(&q, 8);
215 #ifndef _WIN32
216 /* For Windows, if the "manifest" setting contains the "l" flag and the
217 ** "manifest.symlinks" file exists, use its contents to determine which
218 ** files do and do not have the symlink permission. */
219 if( !manifestSymlinks ){
220 currentPerm = origPerm;
221 }else if( db_exists("SELECT 1 FROM symlink_perm "
222 "WHERE filename=%Q", zName+nRoot) ){
223 currentPerm = PERM_LNK;
224 }else{
225 currentPerm = 0;
226 }
227 #else
228 currentPerm = file_wd_perm(zName);
229 #endif
230 if( chnged==0 && (isDeleted || rid==0) ){
231

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button