Fossil SCM
Additional corrections to Windows symlink permissions logic
Commit
f29c8a44be4095114ac1566f0b090156a9c5d54b6338d9ac1c2d847ffd3e5aad
Parent
364d04315b162ec…
1 file changed
+7
-4
+7
-4
| --- src/vfile.c | ||
| +++ src/vfile.c | ||
| @@ -178,10 +178,11 @@ | ||
| 178 | 178 | |
| 179 | 179 | /* On Windows, get symlink permission status from the "manifest.symlinks" file |
| 180 | 180 | ** if it exists and if the "manifest" setting contains the "l" flag. */ |
| 181 | 181 | #ifdef _WIN32 |
| 182 | 182 | int manifestSymlinks = get_checkout_symlink_table(); |
| 183 | + int nRoot = strlen(g.zLocalRoot); | |
| 183 | 184 | #endif |
| 184 | 185 | |
| 185 | 186 | db_begin_transaction(); |
| 186 | 187 | db_prepare(&q, "SELECT id, %Q || pathname," |
| 187 | 188 | " vfile.mrid, deleted, chnged, uuid, size, mtime," |
| @@ -209,19 +210,21 @@ | ||
| 209 | 210 | oldMtime = db_column_int64(&q, 7); |
| 210 | 211 | origSize = db_column_int64(&q, 6); |
| 211 | 212 | currentSize = file_wd_size(zName); |
| 212 | 213 | currentMtime = file_wd_mtime(0); |
| 213 | 214 | origPerm = db_column_int(&q, 8); |
| 214 | -#ifdef _WIN32 | |
| 215 | +#ifndef _WIN32 | |
| 215 | 216 | /* For Windows, if the "manifest" setting contains the "l" flag and the |
| 216 | 217 | ** "manifest.symlinks" file exists, use its contents to determine which |
| 217 | 218 | ** 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) ){ | |
| 220 | 223 | currentPerm = PERM_LNK; |
| 221 | 224 | }else{ |
| 222 | - currentPerm = origPerm; | |
| 225 | + currentPerm = 0; | |
| 223 | 226 | } |
| 224 | 227 | #else |
| 225 | 228 | currentPerm = file_wd_perm(zName); |
| 226 | 229 | #endif |
| 227 | 230 | if( chnged==0 && (isDeleted || rid==0) ){ |
| 228 | 231 |
| --- 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 |