Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Remove commands "test-nondir-path" and "test-is-reserved-name" and add the equivalent functionality to "test-file-environment". |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | sec2020 |
| Files: | files | file ages | folders |
| SHA3-256: |
0cec61e451c6c818108a3f80b8701e5b |
| User & Date: | drh 2020-08-19 15:46:36.150 |
Context
|
2020-08-19
| ||
| 16:13 | Silently ignore reserved filenames that occur inside of manifests, rather than throwing an error. No need for a setting to allow reserved filenames in manifests. check-in: 2e19c5fe2d user: drh tags: sec2020 | |
| 15:46 | Remove commands "test-nondir-path" and "test-is-reserved-name" and add the equivalent functionality to "test-file-environment". check-in: 0cec61e451 user: drh tags: sec2020 | |
| 15:26 | Remove the --symlinks option from the "fossil open" command. It is not needed. Users who want to enable symlinks can use the "fossil settings" command first. check-in: ff811934e0 user: drh tags: sec2020 | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
369 370 371 372 373 374 375 |
z[j] = '/';
i = j;
}
fossil_free(z);
return 0;
}
| < < < < < < < < < < < < < < < < < < < < < < | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
z[j] = '/';
i = j;
}
fossil_free(z);
return 0;
}
/*
** The file named zFile is suppose to be an in-tree file. Check to
** ensure that it will be safe to write to this file by verifying that
** there are no symlinks or other non-directory objects in between the
** root of the checkout and zFile.
**
** If a problem is found, print a warning message (using fossil_warning())
|
| ︙ | ︙ | |||
1331 1332 1333 1334 1335 1336 1337 | Blob x; int rc; sqlite3_int64 iMtime; struct fossilStat testFileStat; memset(zBuf, 0, sizeof(zBuf)); blob_zero(&x); file_canonical_name(zPath, &x, slash); | > | < | 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 |
Blob x;
int rc;
sqlite3_int64 iMtime;
struct fossilStat testFileStat;
memset(zBuf, 0, sizeof(zBuf));
blob_zero(&x);
file_canonical_name(zPath, &x, slash);
char *zFull = blob_str(&x);
fossil_print("[%s] -> [%s]\n", zPath, zFull);
memset(&testFileStat, 0, sizeof(struct fossilStat));
rc = fossil_stat(zPath, &testFileStat, 0);
fossil_print(" stat_rc = %d\n", rc);
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
fossil_print(" stat_size = %s\n", zBuf);
if( g.db==0 ) sqlite3_open(":memory:", &g.db);
z = db_text(0, "SELECT datetime(%lld, 'unixepoch')", testFileStat.st_mtime);
|
| ︙ | ︙ | |||
1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 |
fossil_print(" file_mode(RepoFILE) = 0%o\n", file_mode(zPath,RepoFILE));
fossil_print(" file_isfile(RepoFILE) = %d\n", file_isfile(zPath,RepoFILE));
fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zPath));
fossil_print(" file_islink = %d\n", file_islink(zPath));
fossil_print(" file_isexe(RepoFILE) = %d\n", file_isexe(zPath,RepoFILE));
fossil_print(" file_isdir(RepoFILE) = %d\n", file_isdir(zPath,RepoFILE));
fossil_print(" file_is_repository = %d\n", file_is_repository(zPath));
if( reset ) resetStat();
}
/*
** COMMAND: test-file-environment
**
** Usage: %fossil test-file-environment FILENAME...
**
** Display the effective file handling subsystem "settings" and then
** display file system information about the files specified, if any.
**
** Options:
**
** --allow-symlinks BOOLEAN Temporarily turn allow-symlinks on/off
** --open-config Open the configuration database first.
| > > > < > > > > > > > > > > > > > > > > | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 |
fossil_print(" file_mode(RepoFILE) = 0%o\n", file_mode(zPath,RepoFILE));
fossil_print(" file_isfile(RepoFILE) = %d\n", file_isfile(zPath,RepoFILE));
fossil_print(" file_isfile_or_link = %d\n", file_isfile_or_link(zPath));
fossil_print(" file_islink = %d\n", file_islink(zPath));
fossil_print(" file_isexe(RepoFILE) = %d\n", file_isexe(zPath,RepoFILE));
fossil_print(" file_isdir(RepoFILE) = %d\n", file_isdir(zPath,RepoFILE));
fossil_print(" file_is_repository = %d\n", file_is_repository(zPath));
fossil_print(" file_is_reserved_name = %d\n",
file_is_reserved_name(zFull,-1));
blob_reset(&x);
if( reset ) resetStat();
}
/*
** COMMAND: test-file-environment
**
** Usage: %fossil test-file-environment FILENAME...
**
** Display the effective file handling subsystem "settings" and then
** display file system information about the files specified, if any.
**
** Options:
**
** --allow-symlinks BOOLEAN Temporarily turn allow-symlinks on/off
** --open-config Open the configuration database first.
** --reset Reset cached stat() info for each file.
** --root ROOT Use ROOT as the root of the checkout
** --slash Trailing slashes, if any, are retained.
*/
void cmd_test_file_environment(void){
int i;
int slashFlag = find_option("slash",0,0)!=0;
int resetFlag = find_option("reset",0,0)!=0;
const char *zRoot = find_option("root",0,1);
const char *zAllow = find_option("allow-symlinks",0,1);
if( find_option("open-config", 0, 0)!=0 ){
Th_OpenConfig(1);
}
db_find_and_open_repository(OPEN_ANY_SCHEMA|OPEN_OK_NOT_FOUND, 0);
fossil_print("filenames_are_case_sensitive() = %d\n",
filenames_are_case_sensitive());
if( zAllow ){
g.allowSymlinks = !is_false(zAllow);
}
if( zRoot==0 ) zRoot = g.zLocalRoot;
fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
fossil_print("local-root = [%s]\n", zRoot);
for(i=2; i<g.argc; i++){
char *z;
emitFileStat(g.argv[i], slashFlag, resetFlag);
z = file_canonical_name_dup(g.argv[i]);
fossil_print(" file_canonical_name = %s\n", z);
fossil_print(" file_nondir_path = ");
if( fossil_strnicmp(zRoot,z,(int)strlen(zRoot))!=0 ){
fossil_print("(--root is not a prefix of this file)\n");
}else{
int n = file_nondir_objects_on_path(zRoot, z);
fossil_print("%.*s\n", n, z);
}
fossil_free(z);
}
}
/*
** COMMAND: test-canonical-name
**
** Usage: %fossil test-canonical-name FILENAME...
|
| ︙ | ︙ | |||
2563 2564 2565 2566 2567 2568 2569 |
return zEnd[-10]=='/' ? 2 : gotSuffix;
}
default:{
return 0;
}
}
}
| < < < < < < < < < < < < < < < < < < < < < | 2559 2560 2561 2562 2563 2564 2565 |
return zEnd[-10]=='/' ? 2 : gotSuffix;
}
default:{
return 0;
}
}
}
|