Fossil SCM

Restore the --no-dir-symlinks option.

mistachkin 2017-09-11 16:44 UTC trunk
Commit aff4363d1cbd01d461661b4a443584ce67c8fa7830bee71784bb26de3642c89e
+4
--- src/add.c
+++ src/add.c
@@ -276,10 +276,11 @@
276276
** -f|--force Add files without prompting
277277
** --ignore <CSG> Ignore unmanaged files matching patterns from
278278
** the comma separated list of glob patterns.
279279
** --clean <CSG> Also ignore files matching patterns from
280280
** the comma separated list of glob patterns.
281
+** --no-dir-symlinks Disables support for directory symlinks.
281282
**
282283
** See also: addremove, rm
283284
*/
284285
void add_cmd(void){
285286
int i; /* Loop counter */
@@ -441,10 +442,11 @@
441442
** --soft Skip removing files from the checkout.
442443
** This supersedes the --hard option.
443444
** --hard Remove files from the checkout.
444445
** --case-sensitive <BOOL> Override the case-sensitive setting.
445446
** -n|--dry-run If given, display instead of run actions.
447
+** --no-dir-symlinks Disables support for directory symlinks.
446448
**
447449
** See also: addremove, add
448450
*/
449451
void delete_cmd(void){
450452
int i;
@@ -622,10 +624,11 @@
622624
** --ignore <CSG> Ignore unmanaged files matching patterns from
623625
** the comma separated list of glob patterns.
624626
** --clean <CSG> Also ignore files matching patterns from
625627
** the comma separated list of glob patterns.
626628
** -n|--dry-run If given, display instead of run actions.
629
+** --no-dir-symlinks Disables support for directory symlinks.
627630
**
628631
** See also: add, rm
629632
*/
630633
void addremove_cmd(void){
631634
Blob path;
@@ -849,10 +852,11 @@
849852
** --soft Skip moving files within the checkout.
850853
** This supersedes the --hard option.
851854
** --hard Move files within the checkout.
852855
** --case-sensitive <BOOL> Override the case-sensitive setting.
853856
** -n|--dry-run If given, display instead of run actions.
857
+** --no-dir-symlinks Disables support for directory symlinks.
854858
**
855859
** See also: changes, status
856860
*/
857861
void mv_cmd(void){
858862
int i;
859863
--- src/add.c
+++ src/add.c
@@ -276,10 +276,11 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
 
281 **
282 ** See also: addremove, rm
283 */
284 void add_cmd(void){
285 int i; /* Loop counter */
@@ -441,10 +442,11 @@
441 ** --soft Skip removing files from the checkout.
442 ** This supersedes the --hard option.
443 ** --hard Remove files from the checkout.
444 ** --case-sensitive <BOOL> Override the case-sensitive setting.
445 ** -n|--dry-run If given, display instead of run actions.
 
446 **
447 ** See also: addremove, add
448 */
449 void delete_cmd(void){
450 int i;
@@ -622,10 +624,11 @@
622 ** --ignore <CSG> Ignore unmanaged files matching patterns from
623 ** the comma separated list of glob patterns.
624 ** --clean <CSG> Also ignore files matching patterns from
625 ** the comma separated list of glob patterns.
626 ** -n|--dry-run If given, display instead of run actions.
 
627 **
628 ** See also: add, rm
629 */
630 void addremove_cmd(void){
631 Blob path;
@@ -849,10 +852,11 @@
849 ** --soft Skip moving files within the checkout.
850 ** This supersedes the --hard option.
851 ** --hard Move files within the checkout.
852 ** --case-sensitive <BOOL> Override the case-sensitive setting.
853 ** -n|--dry-run If given, display instead of run actions.
 
854 **
855 ** See also: changes, status
856 */
857 void mv_cmd(void){
858 int i;
859
--- src/add.c
+++ src/add.c
@@ -276,10 +276,11 @@
276 ** -f|--force Add files without prompting
277 ** --ignore <CSG> Ignore unmanaged files matching patterns from
278 ** the comma separated list of glob patterns.
279 ** --clean <CSG> Also ignore files matching patterns from
280 ** the comma separated list of glob patterns.
281 ** --no-dir-symlinks Disables support for directory symlinks.
282 **
283 ** See also: addremove, rm
284 */
285 void add_cmd(void){
286 int i; /* Loop counter */
@@ -441,10 +442,11 @@
442 ** --soft Skip removing files from the checkout.
443 ** This supersedes the --hard option.
444 ** --hard Remove files from the checkout.
445 ** --case-sensitive <BOOL> Override the case-sensitive setting.
446 ** -n|--dry-run If given, display instead of run actions.
447 ** --no-dir-symlinks Disables support for directory symlinks.
448 **
449 ** See also: addremove, add
450 */
451 void delete_cmd(void){
452 int i;
@@ -622,10 +624,11 @@
624 ** --ignore <CSG> Ignore unmanaged files matching patterns from
625 ** the comma separated list of glob patterns.
626 ** --clean <CSG> Also ignore files matching patterns from
627 ** the comma separated list of glob patterns.
628 ** -n|--dry-run If given, display instead of run actions.
629 ** --no-dir-symlinks Disables support for directory symlinks.
630 **
631 ** See also: add, rm
632 */
633 void addremove_cmd(void){
634 Blob path;
@@ -849,10 +852,11 @@
852 ** --soft Skip moving files within the checkout.
853 ** This supersedes the --hard option.
854 ** --hard Move files within the checkout.
855 ** --case-sensitive <BOOL> Override the case-sensitive setting.
856 ** -n|--dry-run If given, display instead of run actions.
857 ** --no-dir-symlinks Disables support for directory symlinks.
858 **
859 ** See also: changes, status
860 */
861 void mv_cmd(void){
862 int i;
863
+10 -8
--- src/checkin.c
+++ src/checkin.c
@@ -417,10 +417,11 @@
417417
** --hash Verify file status using hashing rather than
418418
** relying on file mtimes.
419419
** --case-sensitive <BOOL> Override case-sensitive setting.
420420
** --dotfiles Include unmanaged files beginning with a dot.
421421
** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns.
422
+** --no-dir-symlinks Disables support for directory symlinks.
422423
**
423424
** Options specific to the changes command:
424425
** --header Identify the repository if report is non-empty.
425426
** -v|--verbose Say "(none)" if the change report is empty.
426427
** --classify Start each line with the file's change type.
@@ -825,10 +826,11 @@
825826
** --abs-paths Display absolute pathnames.
826827
** --case-sensitive <BOOL> override case-sensitive setting
827828
** --dotfiles include files beginning with a dot (".")
828829
** --header Identify the repository if there are extras
829830
** --ignore <CSG> ignore files matching patterns from the argument
831
+** --no-dir-symlinks Disables support for directory symlinks.
830832
** --rel-paths Display pathnames relative to the current working
831833
** directory.
832834
**
833835
** See also: changes, clean, status
834836
*/
@@ -854,12 +856,10 @@
854856
855857
if( zIgnoreFlag==0 ){
856858
zIgnoreFlag = db_get("ignore-glob", 0);
857859
}
858860
pIgnore = glob_create(zIgnoreFlag);
859
- /* Always consider symlinks. */
860
- g.allowSymlinks = db_allow_symlinks_by_default();
861861
locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
862862
glob_free(pIgnore);
863863
864864
blob_zero(&report);
865865
status_report(&report, flags);
@@ -901,13 +901,14 @@
901901
**
902902
** The default values for --clean, --ignore, and --keep are determined by
903903
** the (versionable) clean-glob, ignore-glob, and keep-glob settings.
904904
**
905905
** The --verily option ignores the keep-glob and ignore-glob settings and
906
-** turns on --force, --emptydirs, --dotfiles, and --disable-undo. Use the
907
-** --verily option when you really want to clean up everything. Extreme
908
-** care should be exercised when using the --verily option.
906
+** turns on the options --force, --emptydirs, --dotfiles, --disable-undo,
907
+** and --no-dir-symlinks. Use the --verily option when you really want
908
+** to clean up everything. Extreme care should be exercised when using
909
+** the --verily option.
909910
**
910911
** Options:
911912
** --allckouts Check for empty directories within any checkouts
912913
** that may be nested within the current one. This
913914
** option should be used with great care because the
@@ -933,11 +934,11 @@
933934
** -i|--prompt Prompt before removing each file. This option
934935
** implies the --disable-undo option.
935936
** -x|--verily WARNING: Removes everything that is not a managed
936937
** file or the repository itself. This option
937938
** implies the --force, --emptydirs, --dotfiles, and
938
-** --disable-undo options.
939
+** --disable-undo, and --no-dir-symlinks options.
939940
** Furthermore, it completely disregards the keep-glob
940941
** and ignore-glob settings. However, it does honor
941942
** the --ignore and --keep options.
942943
** --clean <CSG> WARNING: Never prompt to delete any files matching
943944
** this comma separated list of glob patterns. Also,
@@ -949,10 +950,11 @@
949950
** list of glob patterns.
950951
** -n|--dry-run Delete nothing, but display what would have been
951952
** deleted.
952953
** --no-prompt This option disables prompting the user for input
953954
** and assumes an answer of 'No' for every question.
955
+** --no-dir-symlinks Disables support for directory symlinks.
954956
** --temp Remove only Fossil-generated temporary files.
955957
** -v|--verbose Show all files as they are removed.
956958
**
957959
** See also: addremove, extras, status
958960
*/
@@ -997,10 +999,12 @@
997999
verilyFlag = allFileFlag = allDirFlag = 1;
9981000
emptyDirsFlag = 1;
9991001
disableUndo = 1;
10001002
scanFlags |= SCAN_ALL;
10011003
zCleanFlag = 0;
1004
+ g.fNoDirSymlinks = 1; /* Forbid symlink directory traversal. */
1005
+ g.allowSymlinks = 1; /* Treat symlink files as content. */
10021006
}
10031007
if( zIgnoreFlag==0 && !verilyFlag ){
10041008
zIgnoreFlag = db_get("ignore-glob", 0);
10051009
}
10061010
if( zKeepFlag==0 && !verilyFlag ){
@@ -1013,12 +1017,10 @@
10131017
verify_all_options();
10141018
pIgnore = glob_create(zIgnoreFlag);
10151019
pKeep = glob_create(zKeepFlag);
10161020
pClean = glob_create(zCleanFlag);
10171021
nRoot = (int)strlen(g.zLocalRoot);
1018
- /* Always consider symlinks. */
1019
- g.allowSymlinks = db_allow_symlinks_by_default();
10201022
if( !dirsOnlyFlag ){
10211023
Stmt q;
10221024
Blob repo;
10231025
if( !dryRunFlag && !disableUndo ) undo_begin();
10241026
locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
10251027
--- src/checkin.c
+++ src/checkin.c
@@ -417,10 +417,11 @@
417 ** --hash Verify file status using hashing rather than
418 ** relying on file mtimes.
419 ** --case-sensitive <BOOL> Override case-sensitive setting.
420 ** --dotfiles Include unmanaged files beginning with a dot.
421 ** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns.
 
422 **
423 ** Options specific to the changes command:
424 ** --header Identify the repository if report is non-empty.
425 ** -v|--verbose Say "(none)" if the change report is empty.
426 ** --classify Start each line with the file's change type.
@@ -825,10 +826,11 @@
825 ** --abs-paths Display absolute pathnames.
826 ** --case-sensitive <BOOL> override case-sensitive setting
827 ** --dotfiles include files beginning with a dot (".")
828 ** --header Identify the repository if there are extras
829 ** --ignore <CSG> ignore files matching patterns from the argument
 
830 ** --rel-paths Display pathnames relative to the current working
831 ** directory.
832 **
833 ** See also: changes, clean, status
834 */
@@ -854,12 +856,10 @@
854
855 if( zIgnoreFlag==0 ){
856 zIgnoreFlag = db_get("ignore-glob", 0);
857 }
858 pIgnore = glob_create(zIgnoreFlag);
859 /* Always consider symlinks. */
860 g.allowSymlinks = db_allow_symlinks_by_default();
861 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
862 glob_free(pIgnore);
863
864 blob_zero(&report);
865 status_report(&report, flags);
@@ -901,13 +901,14 @@
901 **
902 ** The default values for --clean, --ignore, and --keep are determined by
903 ** the (versionable) clean-glob, ignore-glob, and keep-glob settings.
904 **
905 ** The --verily option ignores the keep-glob and ignore-glob settings and
906 ** turns on --force, --emptydirs, --dotfiles, and --disable-undo. Use the
907 ** --verily option when you really want to clean up everything. Extreme
908 ** care should be exercised when using the --verily option.
 
909 **
910 ** Options:
911 ** --allckouts Check for empty directories within any checkouts
912 ** that may be nested within the current one. This
913 ** option should be used with great care because the
@@ -933,11 +934,11 @@
933 ** -i|--prompt Prompt before removing each file. This option
934 ** implies the --disable-undo option.
935 ** -x|--verily WARNING: Removes everything that is not a managed
936 ** file or the repository itself. This option
937 ** implies the --force, --emptydirs, --dotfiles, and
938 ** --disable-undo options.
939 ** Furthermore, it completely disregards the keep-glob
940 ** and ignore-glob settings. However, it does honor
941 ** the --ignore and --keep options.
942 ** --clean <CSG> WARNING: Never prompt to delete any files matching
943 ** this comma separated list of glob patterns. Also,
@@ -949,10 +950,11 @@
949 ** list of glob patterns.
950 ** -n|--dry-run Delete nothing, but display what would have been
951 ** deleted.
952 ** --no-prompt This option disables prompting the user for input
953 ** and assumes an answer of 'No' for every question.
 
954 ** --temp Remove only Fossil-generated temporary files.
955 ** -v|--verbose Show all files as they are removed.
956 **
957 ** See also: addremove, extras, status
958 */
@@ -997,10 +999,12 @@
997 verilyFlag = allFileFlag = allDirFlag = 1;
998 emptyDirsFlag = 1;
999 disableUndo = 1;
1000 scanFlags |= SCAN_ALL;
1001 zCleanFlag = 0;
 
 
1002 }
1003 if( zIgnoreFlag==0 && !verilyFlag ){
1004 zIgnoreFlag = db_get("ignore-glob", 0);
1005 }
1006 if( zKeepFlag==0 && !verilyFlag ){
@@ -1013,12 +1017,10 @@
1013 verify_all_options();
1014 pIgnore = glob_create(zIgnoreFlag);
1015 pKeep = glob_create(zKeepFlag);
1016 pClean = glob_create(zCleanFlag);
1017 nRoot = (int)strlen(g.zLocalRoot);
1018 /* Always consider symlinks. */
1019 g.allowSymlinks = db_allow_symlinks_by_default();
1020 if( !dirsOnlyFlag ){
1021 Stmt q;
1022 Blob repo;
1023 if( !dryRunFlag && !disableUndo ) undo_begin();
1024 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
1025
--- src/checkin.c
+++ src/checkin.c
@@ -417,10 +417,11 @@
417 ** --hash Verify file status using hashing rather than
418 ** relying on file mtimes.
419 ** --case-sensitive <BOOL> Override case-sensitive setting.
420 ** --dotfiles Include unmanaged files beginning with a dot.
421 ** --ignore <CSG> Ignore unmanaged files matching CSG glob patterns.
422 ** --no-dir-symlinks Disables support for directory symlinks.
423 **
424 ** Options specific to the changes command:
425 ** --header Identify the repository if report is non-empty.
426 ** -v|--verbose Say "(none)" if the change report is empty.
427 ** --classify Start each line with the file's change type.
@@ -825,10 +826,11 @@
826 ** --abs-paths Display absolute pathnames.
827 ** --case-sensitive <BOOL> override case-sensitive setting
828 ** --dotfiles include files beginning with a dot (".")
829 ** --header Identify the repository if there are extras
830 ** --ignore <CSG> ignore files matching patterns from the argument
831 ** --no-dir-symlinks Disables support for directory symlinks.
832 ** --rel-paths Display pathnames relative to the current working
833 ** directory.
834 **
835 ** See also: changes, clean, status
836 */
@@ -854,12 +856,10 @@
856
857 if( zIgnoreFlag==0 ){
858 zIgnoreFlag = db_get("ignore-glob", 0);
859 }
860 pIgnore = glob_create(zIgnoreFlag);
 
 
861 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
862 glob_free(pIgnore);
863
864 blob_zero(&report);
865 status_report(&report, flags);
@@ -901,13 +901,14 @@
901 **
902 ** The default values for --clean, --ignore, and --keep are determined by
903 ** the (versionable) clean-glob, ignore-glob, and keep-glob settings.
904 **
905 ** The --verily option ignores the keep-glob and ignore-glob settings and
906 ** turns on the options --force, --emptydirs, --dotfiles, --disable-undo,
907 ** and --no-dir-symlinks. Use the --verily option when you really want
908 ** to clean up everything. Extreme care should be exercised when using
909 ** the --verily option.
910 **
911 ** Options:
912 ** --allckouts Check for empty directories within any checkouts
913 ** that may be nested within the current one. This
914 ** option should be used with great care because the
@@ -933,11 +934,11 @@
934 ** -i|--prompt Prompt before removing each file. This option
935 ** implies the --disable-undo option.
936 ** -x|--verily WARNING: Removes everything that is not a managed
937 ** file or the repository itself. This option
938 ** implies the --force, --emptydirs, --dotfiles, and
939 ** --disable-undo, and --no-dir-symlinks options.
940 ** Furthermore, it completely disregards the keep-glob
941 ** and ignore-glob settings. However, it does honor
942 ** the --ignore and --keep options.
943 ** --clean <CSG> WARNING: Never prompt to delete any files matching
944 ** this comma separated list of glob patterns. Also,
@@ -949,10 +950,11 @@
950 ** list of glob patterns.
951 ** -n|--dry-run Delete nothing, but display what would have been
952 ** deleted.
953 ** --no-prompt This option disables prompting the user for input
954 ** and assumes an answer of 'No' for every question.
955 ** --no-dir-symlinks Disables support for directory symlinks.
956 ** --temp Remove only Fossil-generated temporary files.
957 ** -v|--verbose Show all files as they are removed.
958 **
959 ** See also: addremove, extras, status
960 */
@@ -997,10 +999,12 @@
999 verilyFlag = allFileFlag = allDirFlag = 1;
1000 emptyDirsFlag = 1;
1001 disableUndo = 1;
1002 scanFlags |= SCAN_ALL;
1003 zCleanFlag = 0;
1004 g.fNoDirSymlinks = 1; /* Forbid symlink directory traversal. */
1005 g.allowSymlinks = 1; /* Treat symlink files as content. */
1006 }
1007 if( zIgnoreFlag==0 && !verilyFlag ){
1008 zIgnoreFlag = db_get("ignore-glob", 0);
1009 }
1010 if( zKeepFlag==0 && !verilyFlag ){
@@ -1013,12 +1017,10 @@
1017 verify_all_options();
1018 pIgnore = glob_create(zIgnoreFlag);
1019 pKeep = glob_create(zKeepFlag);
1020 pClean = glob_create(zCleanFlag);
1021 nRoot = (int)strlen(g.zLocalRoot);
 
 
1022 if( !dirsOnlyFlag ){
1023 Stmt q;
1024 Blob repo;
1025 if( !dryRunFlag && !disableUndo ) undo_begin();
1026 locate_unmanaged_files(g.argc-2, g.argv+2, scanFlags, pIgnore);
1027
+7 -2
--- src/db.c
+++ src/db.c
@@ -1475,12 +1475,17 @@
14751475
}
14761476
14771477
/*
14781478
** Returns non-zero if support for symlinks is currently enabled.
14791479
*/
1480
-int db_allow_symlinks(void){
1481
- return g.allowSymlinks;
1480
+int db_allow_symlinks(int traversal){
1481
+ if( traversal ){
1482
+ if( g.allowSymlinks ) return 1;
1483
+ return g.fNoDirSymlinks;
1484
+ }else{
1485
+ return g.allowSymlinks;
1486
+ }
14821487
}
14831488
14841489
/*
14851490
** Open the repository database given by zDbName. If zDbName==NULL then
14861491
** get the name from the already open local database.
14871492
--- src/db.c
+++ src/db.c
@@ -1475,12 +1475,17 @@
1475 }
1476
1477 /*
1478 ** Returns non-zero if support for symlinks is currently enabled.
1479 */
1480 int db_allow_symlinks(void){
1481 return g.allowSymlinks;
 
 
 
 
 
1482 }
1483
1484 /*
1485 ** Open the repository database given by zDbName. If zDbName==NULL then
1486 ** get the name from the already open local database.
1487
--- src/db.c
+++ src/db.c
@@ -1475,12 +1475,17 @@
1475 }
1476
1477 /*
1478 ** Returns non-zero if support for symlinks is currently enabled.
1479 */
1480 int db_allow_symlinks(int traversal){
1481 if( traversal ){
1482 if( g.allowSymlinks ) return 1;
1483 return g.fNoDirSymlinks;
1484 }else{
1485 return g.allowSymlinks;
1486 }
1487 }
1488
1489 /*
1490 ** Open the repository database given by zDbName. If zDbName==NULL then
1491 ** get the name from the already open local database.
1492
+41 -28
--- src/file.c
+++ src/file.c
@@ -88,16 +88,17 @@
8888
**
8989
*/
9090
static int fossil_stat(
9191
const char *zFilename, /* name of file or directory to inspect. */
9292
struct fossilStat *buf, /* pointer to buffer where info should go. */
93
- int isWd /* non-zero to consider look at symlink itself. */
93
+ int isWd, /* non-zero to consider look at symlink itself. */
94
+ int forceWd /* non-zero to force look at symlink itself. */
9495
){
9596
int rc;
9697
void *zMbcs = fossil_utf8_to_path(zFilename, 0);
9798
#if !defined(_WIN32)
98
- if( isWd && db_allow_symlinks() ){
99
+ if( isWd && (forceWd || db_allow_symlinks(0)) ){
99100
rc = lstat(zMbcs, buf);
100101
}else{
101102
rc = stat(zMbcs, buf);
102103
}
103104
#else
@@ -127,11 +128,11 @@
127128
static int getStat(const char *zFilename, int isWd){
128129
int rc = 0;
129130
if( zFilename==0 ){
130131
if( fileStatValid==0 ) rc = 1;
131132
}else{
132
- if( fossil_stat(zFilename, &fileStat, isWd)!=0 ){
133
+ if( fossil_stat(zFilename, &fileStat, isWd, 0)!=0 ){
133134
fileStatValid = 0;
134135
rc = 1;
135136
}else{
136137
fileStatValid = 1;
137138
rc = 0;
@@ -219,11 +220,11 @@
219220
**
220221
** Arguments: target file (symlink will point to it), link file
221222
**/
222223
void symlink_create(const char *zTargetFile, const char *zLinkFile){
223224
#if !defined(_WIN32)
224
- if( db_allow_symlinks() ){
225
+ if( db_allow_symlinks(0) ){
225226
int i, nName;
226227
char *zName, zBuf[1000];
227228
228229
nName = strlen(zLinkFile);
229230
if( nName>=sizeof(zBuf) ){
@@ -276,11 +277,11 @@
276277
int file_wd_perm(const char *zFilename){
277278
#if !defined(_WIN32)
278279
if( !getStat(zFilename, 1) ){
279280
if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 )
280281
return PERM_EXE;
281
- else if( db_allow_symlinks() && S_ISLNK(fileStat.st_mode) )
282
+ else if( db_allow_symlinks(0) && S_ISLNK(fileStat.st_mode) )
282283
return PERM_LNK;
283284
}
284285
#endif
285286
return PERM_REG;
286287
}
@@ -329,19 +330,21 @@
329330
** but is something other than a directory.
330331
*/
331332
int file_wd_isdir(const char *zFilename){
332333
int rc;
333334
char *zFN;
335
+ struct fossilStat dirFileStat;
334336
335337
zFN = mprintf("%s", zFilename);
336338
file_simplify_name(zFN, -1, 0);
337
- rc = getStat(zFN, 1);
339
+ memset(&dirFileStat, 0, sizeof(struct fossilStat));
340
+ rc = fossil_stat(zFN, &dirFileStat, 1, 1);
338341
if( rc ){
339342
rc = 0; /* It does not exist at all. */
340
- }else if( S_ISDIR(fileStat.st_mode) ){
343
+ }else if( S_ISDIR(dirFileStat.st_mode) ){
341344
rc = 1; /* It exists and is a real directory. */
342
- }else if( S_ISLNK(fileStat.st_mode) ){
345
+ }else if( !db_allow_symlinks(1) && S_ISLNK(dirFileStat.st_mode) ){
343346
Blob content;
344347
blob_read_link(&content, zFN); /* It exists and is a link. */
345348
rc = file_wd_isdir(blob_str(&content)); /* Points to directory? */
346349
blob_reset(&content);
347350
}else{
@@ -508,11 +511,11 @@
508511
*/
509512
int file_wd_setexe(const char *zFilename, int onoff){
510513
int rc = 0;
511514
#if !defined(_WIN32)
512515
struct stat buf;
513
- if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0;
516
+ if( fossil_stat(zFilename, &buf, 1, 0)!=0 || S_ISLNK(buf.st_mode) ) return 0;
514517
if( onoff ){
515518
int targetMode = (buf.st_mode & 0444)>>2;
516519
if( (buf.st_mode & 0100)==0 ){
517520
chmod(zFilename, buf.st_mode | targetMode);
518521
rc = 1;
@@ -975,19 +978,19 @@
975978
blob_reset(&x);
976979
if( raw ){
977980
int rc;
978981
struct fossilStat testFileStat;
979982
memset(&testFileStat, 0, sizeof(struct fossilStat));
980
- rc = fossil_stat(zPath, &testFileStat, 0);
983
+ rc = fossil_stat(zPath, &testFileStat, 0, 0);
981984
fossil_print(" stat_rc = %d\n", rc);
982985
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
983986
fossil_print(" stat_size = %s\n", zBuf);
984987
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
985988
fossil_print(" stat_mtime = %s\n", zBuf);
986989
fossil_print(" stat_mode = %d\n", testFileStat.st_mode);
987990
memset(&testFileStat, 0, sizeof(struct fossilStat));
988
- rc = fossil_stat(zPath, &testFileStat, 1);
991
+ rc = fossil_stat(zPath, &testFileStat, 1, 1);
989992
fossil_print(" l_stat_rc = %d\n", rc);
990993
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
991994
fossil_print(" l_stat_size = %s\n", zBuf);
992995
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
993996
fossil_print(" l_stat_mtime = %s\n", zBuf);
@@ -1019,23 +1022,33 @@
10191022
** Options:
10201023
**
10211024
** --open-config Open the configuration database first.
10221025
** --slash Trailing slashes, if any, are retained.
10231026
** --reset Reset cached stat() info for each file.
1027
+** --symlinks BOOLEAN Force allow-symlinks on or off
10241028
*/
10251029
void cmd_test_file_environment(void){
10261030
int i;
10271031
int slashFlag = find_option("slash",0,0)!=0;
10281032
int resetFlag = find_option("reset",0,0)!=0;
1033
+ const char *forceSymlinks = find_option("symlinks",0,1);
10291034
if( find_option("open-config", 0, 0)!=0 ){
10301035
Th_OpenConfig(1);
10311036
}
1037
+ if( forceSymlinks ){
1038
+ if( is_truth(forceSymlinks) ) g.allowSymlinks = 1;
1039
+ if( is_false(forceSymlinks) ) g.allowSymlinks = 0;
1040
+ }
1041
+ fossil_print("Th_IsLocalOpen() = %d\n", Th_IsLocalOpen());
1042
+ fossil_print("Th_IsRepositoryOpen() = %d\n", Th_IsRepositoryOpen());
1043
+ fossil_print("Th_IsConfigOpen() = %d\n", Th_IsConfigOpen());
10321044
fossil_print("filenames_are_case_sensitive() = %d\n",
10331045
filenames_are_case_sensitive());
10341046
fossil_print("db_allow_symlinks_by_default() = %d\n",
10351047
db_allow_symlinks_by_default());
1036
- fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
1048
+ fossil_print("db_allow_symlinks(0) = %d\n", db_allow_symlinks(0));
1049
+ fossil_print("db_allow_symlinks(1) = %d\n", db_allow_symlinks(1));
10371050
for(i=2; i<g.argc; i++){
10381051
emitFileStat(g.argv[i], 1, slashFlag, resetFlag);
10391052
emitFileStat(g.argv[i], 0, slashFlag, resetFlag);
10401053
}
10411054
}
@@ -1045,31 +1058,26 @@
10451058
**
10461059
** Usage: %fossil test-canonical-name FILENAME...
10471060
**
10481061
** Test the operation of the canonical name generator.
10491062
** Also test Fossil's ability to measure attributes of a file.
1063
+**
1064
+** Options:
1065
+**
1066
+** --open-config Open the configuration database first.
1067
+** --slash Trailing slashes, if any, are retained.
1068
+** --reset Reset cached stat() info for each file.
10501069
*/
10511070
void cmd_test_canonical_name(void){
10521071
int i;
1053
- Blob x;
10541072
int slashFlag = find_option("slash",0,0)!=0;
1055
- blob_zero(&x);
1073
+ int resetFlag = find_option("reset",0,0)!=0;
1074
+ if( find_option("open-config", 0, 0)!=0 ){
1075
+ Th_OpenConfig(1);
1076
+ }
10561077
for(i=2; i<g.argc; i++){
1057
- char zBuf[100];
1058
- const char *zName = g.argv[i];
1059
- file_canonical_name(zName, &x, slashFlag);
1060
- fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x));
1061
- blob_reset(&x);
1062
- sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName));
1063
- fossil_print(" file_size = %s\n", zBuf);
1064
- sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName));
1065
- fossil_print(" file_mtime = %s\n", zBuf);
1066
- fossil_print(" file_isfile = %d\n", file_wd_isfile(zName));
1067
- fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zName));
1068
- fossil_print(" file_islink = %d\n", file_wd_islink(zName));
1069
- fossil_print(" file_isexe = %d\n", file_wd_isexe(zName));
1070
- fossil_print(" file_isdir = %d\n", file_wd_isdir(zName));
1078
+ emitFileStat(g.argv[i], 0, slashFlag, resetFlag);
10711079
}
10721080
}
10731081
10741082
/*
10751083
** Return TRUE if the given filename is canonical.
@@ -1180,10 +1188,14 @@
11801188
11811189
/*
11821190
** COMMAND: test-relative-name
11831191
**
11841192
** Test the operation of the relative name generator.
1193
+**
1194
+** Options:
1195
+**
1196
+** --slash Trailing slashes, if any, are retained.
11851197
*/
11861198
void cmd_test_relative_name(void){
11871199
int i;
11881200
Blob x;
11891201
int slashFlag = find_option("slash",0,0)!=0;
@@ -1299,10 +1311,11 @@
12991311
**
13001312
** Options:
13011313
** --absolute Return an absolute path instead of a relative one.
13021314
** --case-sensitive B Enable or disable case-sensitive filenames. B is
13031315
** a boolean: "yes", "no", "true", "false", etc.
1316
+** --no-dir-symlinks Disables support for directory symlinks.
13041317
*/
13051318
void cmd_test_tree_name(void){
13061319
int i;
13071320
Blob x;
13081321
int absoluteFlag = find_option("absolute",0,0)!=0;
13091322
--- src/file.c
+++ src/file.c
@@ -88,16 +88,17 @@
88 **
89 */
90 static int fossil_stat(
91 const char *zFilename, /* name of file or directory to inspect. */
92 struct fossilStat *buf, /* pointer to buffer where info should go. */
93 int isWd /* non-zero to consider look at symlink itself. */
 
94 ){
95 int rc;
96 void *zMbcs = fossil_utf8_to_path(zFilename, 0);
97 #if !defined(_WIN32)
98 if( isWd && db_allow_symlinks() ){
99 rc = lstat(zMbcs, buf);
100 }else{
101 rc = stat(zMbcs, buf);
102 }
103 #else
@@ -127,11 +128,11 @@
127 static int getStat(const char *zFilename, int isWd){
128 int rc = 0;
129 if( zFilename==0 ){
130 if( fileStatValid==0 ) rc = 1;
131 }else{
132 if( fossil_stat(zFilename, &fileStat, isWd)!=0 ){
133 fileStatValid = 0;
134 rc = 1;
135 }else{
136 fileStatValid = 1;
137 rc = 0;
@@ -219,11 +220,11 @@
219 **
220 ** Arguments: target file (symlink will point to it), link file
221 **/
222 void symlink_create(const char *zTargetFile, const char *zLinkFile){
223 #if !defined(_WIN32)
224 if( db_allow_symlinks() ){
225 int i, nName;
226 char *zName, zBuf[1000];
227
228 nName = strlen(zLinkFile);
229 if( nName>=sizeof(zBuf) ){
@@ -276,11 +277,11 @@
276 int file_wd_perm(const char *zFilename){
277 #if !defined(_WIN32)
278 if( !getStat(zFilename, 1) ){
279 if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 )
280 return PERM_EXE;
281 else if( db_allow_symlinks() && S_ISLNK(fileStat.st_mode) )
282 return PERM_LNK;
283 }
284 #endif
285 return PERM_REG;
286 }
@@ -329,19 +330,21 @@
329 ** but is something other than a directory.
330 */
331 int file_wd_isdir(const char *zFilename){
332 int rc;
333 char *zFN;
 
334
335 zFN = mprintf("%s", zFilename);
336 file_simplify_name(zFN, -1, 0);
337 rc = getStat(zFN, 1);
 
338 if( rc ){
339 rc = 0; /* It does not exist at all. */
340 }else if( S_ISDIR(fileStat.st_mode) ){
341 rc = 1; /* It exists and is a real directory. */
342 }else if( S_ISLNK(fileStat.st_mode) ){
343 Blob content;
344 blob_read_link(&content, zFN); /* It exists and is a link. */
345 rc = file_wd_isdir(blob_str(&content)); /* Points to directory? */
346 blob_reset(&content);
347 }else{
@@ -508,11 +511,11 @@
508 */
509 int file_wd_setexe(const char *zFilename, int onoff){
510 int rc = 0;
511 #if !defined(_WIN32)
512 struct stat buf;
513 if( fossil_stat(zFilename, &buf, 1)!=0 || S_ISLNK(buf.st_mode) ) return 0;
514 if( onoff ){
515 int targetMode = (buf.st_mode & 0444)>>2;
516 if( (buf.st_mode & 0100)==0 ){
517 chmod(zFilename, buf.st_mode | targetMode);
518 rc = 1;
@@ -975,19 +978,19 @@
975 blob_reset(&x);
976 if( raw ){
977 int rc;
978 struct fossilStat testFileStat;
979 memset(&testFileStat, 0, sizeof(struct fossilStat));
980 rc = fossil_stat(zPath, &testFileStat, 0);
981 fossil_print(" stat_rc = %d\n", rc);
982 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
983 fossil_print(" stat_size = %s\n", zBuf);
984 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
985 fossil_print(" stat_mtime = %s\n", zBuf);
986 fossil_print(" stat_mode = %d\n", testFileStat.st_mode);
987 memset(&testFileStat, 0, sizeof(struct fossilStat));
988 rc = fossil_stat(zPath, &testFileStat, 1);
989 fossil_print(" l_stat_rc = %d\n", rc);
990 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
991 fossil_print(" l_stat_size = %s\n", zBuf);
992 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
993 fossil_print(" l_stat_mtime = %s\n", zBuf);
@@ -1019,23 +1022,33 @@
1019 ** Options:
1020 **
1021 ** --open-config Open the configuration database first.
1022 ** --slash Trailing slashes, if any, are retained.
1023 ** --reset Reset cached stat() info for each file.
 
1024 */
1025 void cmd_test_file_environment(void){
1026 int i;
1027 int slashFlag = find_option("slash",0,0)!=0;
1028 int resetFlag = find_option("reset",0,0)!=0;
 
1029 if( find_option("open-config", 0, 0)!=0 ){
1030 Th_OpenConfig(1);
1031 }
 
 
 
 
 
 
 
1032 fossil_print("filenames_are_case_sensitive() = %d\n",
1033 filenames_are_case_sensitive());
1034 fossil_print("db_allow_symlinks_by_default() = %d\n",
1035 db_allow_symlinks_by_default());
1036 fossil_print("db_allow_symlinks() = %d\n", db_allow_symlinks());
 
1037 for(i=2; i<g.argc; i++){
1038 emitFileStat(g.argv[i], 1, slashFlag, resetFlag);
1039 emitFileStat(g.argv[i], 0, slashFlag, resetFlag);
1040 }
1041 }
@@ -1045,31 +1058,26 @@
1045 **
1046 ** Usage: %fossil test-canonical-name FILENAME...
1047 **
1048 ** Test the operation of the canonical name generator.
1049 ** Also test Fossil's ability to measure attributes of a file.
 
 
 
 
 
 
1050 */
1051 void cmd_test_canonical_name(void){
1052 int i;
1053 Blob x;
1054 int slashFlag = find_option("slash",0,0)!=0;
1055 blob_zero(&x);
 
 
 
1056 for(i=2; i<g.argc; i++){
1057 char zBuf[100];
1058 const char *zName = g.argv[i];
1059 file_canonical_name(zName, &x, slashFlag);
1060 fossil_print("[%s] -> [%s]\n", zName, blob_buffer(&x));
1061 blob_reset(&x);
1062 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_size(zName));
1063 fossil_print(" file_size = %s\n", zBuf);
1064 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_wd_mtime(zName));
1065 fossil_print(" file_mtime = %s\n", zBuf);
1066 fossil_print(" file_isfile = %d\n", file_wd_isfile(zName));
1067 fossil_print(" file_isfile_or_link = %d\n",file_wd_isfile_or_link(zName));
1068 fossil_print(" file_islink = %d\n", file_wd_islink(zName));
1069 fossil_print(" file_isexe = %d\n", file_wd_isexe(zName));
1070 fossil_print(" file_isdir = %d\n", file_wd_isdir(zName));
1071 }
1072 }
1073
1074 /*
1075 ** Return TRUE if the given filename is canonical.
@@ -1180,10 +1188,14 @@
1180
1181 /*
1182 ** COMMAND: test-relative-name
1183 **
1184 ** Test the operation of the relative name generator.
 
 
 
 
1185 */
1186 void cmd_test_relative_name(void){
1187 int i;
1188 Blob x;
1189 int slashFlag = find_option("slash",0,0)!=0;
@@ -1299,10 +1311,11 @@
1299 **
1300 ** Options:
1301 ** --absolute Return an absolute path instead of a relative one.
1302 ** --case-sensitive B Enable or disable case-sensitive filenames. B is
1303 ** a boolean: "yes", "no", "true", "false", etc.
 
1304 */
1305 void cmd_test_tree_name(void){
1306 int i;
1307 Blob x;
1308 int absoluteFlag = find_option("absolute",0,0)!=0;
1309
--- src/file.c
+++ src/file.c
@@ -88,16 +88,17 @@
88 **
89 */
90 static int fossil_stat(
91 const char *zFilename, /* name of file or directory to inspect. */
92 struct fossilStat *buf, /* pointer to buffer where info should go. */
93 int isWd, /* non-zero to consider look at symlink itself. */
94 int forceWd /* non-zero to force look at symlink itself. */
95 ){
96 int rc;
97 void *zMbcs = fossil_utf8_to_path(zFilename, 0);
98 #if !defined(_WIN32)
99 if( isWd && (forceWd || db_allow_symlinks(0)) ){
100 rc = lstat(zMbcs, buf);
101 }else{
102 rc = stat(zMbcs, buf);
103 }
104 #else
@@ -127,11 +128,11 @@
128 static int getStat(const char *zFilename, int isWd){
129 int rc = 0;
130 if( zFilename==0 ){
131 if( fileStatValid==0 ) rc = 1;
132 }else{
133 if( fossil_stat(zFilename, &fileStat, isWd, 0)!=0 ){
134 fileStatValid = 0;
135 rc = 1;
136 }else{
137 fileStatValid = 1;
138 rc = 0;
@@ -219,11 +220,11 @@
220 **
221 ** Arguments: target file (symlink will point to it), link file
222 **/
223 void symlink_create(const char *zTargetFile, const char *zLinkFile){
224 #if !defined(_WIN32)
225 if( db_allow_symlinks(0) ){
226 int i, nName;
227 char *zName, zBuf[1000];
228
229 nName = strlen(zLinkFile);
230 if( nName>=sizeof(zBuf) ){
@@ -276,11 +277,11 @@
277 int file_wd_perm(const char *zFilename){
278 #if !defined(_WIN32)
279 if( !getStat(zFilename, 1) ){
280 if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 )
281 return PERM_EXE;
282 else if( db_allow_symlinks(0) && S_ISLNK(fileStat.st_mode) )
283 return PERM_LNK;
284 }
285 #endif
286 return PERM_REG;
287 }
@@ -329,19 +330,21 @@
330 ** but is something other than a directory.
331 */
332 int file_wd_isdir(const char *zFilename){
333 int rc;
334 char *zFN;
335 struct fossilStat dirFileStat;
336
337 zFN = mprintf("%s", zFilename);
338 file_simplify_name(zFN, -1, 0);
339 memset(&dirFileStat, 0, sizeof(struct fossilStat));
340 rc = fossil_stat(zFN, &dirFileStat, 1, 1);
341 if( rc ){
342 rc = 0; /* It does not exist at all. */
343 }else if( S_ISDIR(dirFileStat.st_mode) ){
344 rc = 1; /* It exists and is a real directory. */
345 }else if( !db_allow_symlinks(1) && S_ISLNK(dirFileStat.st_mode) ){
346 Blob content;
347 blob_read_link(&content, zFN); /* It exists and is a link. */
348 rc = file_wd_isdir(blob_str(&content)); /* Points to directory? */
349 blob_reset(&content);
350 }else{
@@ -508,11 +511,11 @@
511 */
512 int file_wd_setexe(const char *zFilename, int onoff){
513 int rc = 0;
514 #if !defined(_WIN32)
515 struct stat buf;
516 if( fossil_stat(zFilename, &buf, 1, 0)!=0 || S_ISLNK(buf.st_mode) ) return 0;
517 if( onoff ){
518 int targetMode = (buf.st_mode & 0444)>>2;
519 if( (buf.st_mode & 0100)==0 ){
520 chmod(zFilename, buf.st_mode | targetMode);
521 rc = 1;
@@ -975,19 +978,19 @@
978 blob_reset(&x);
979 if( raw ){
980 int rc;
981 struct fossilStat testFileStat;
982 memset(&testFileStat, 0, sizeof(struct fossilStat));
983 rc = fossil_stat(zPath, &testFileStat, 0, 0);
984 fossil_print(" stat_rc = %d\n", rc);
985 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
986 fossil_print(" stat_size = %s\n", zBuf);
987 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
988 fossil_print(" stat_mtime = %s\n", zBuf);
989 fossil_print(" stat_mode = %d\n", testFileStat.st_mode);
990 memset(&testFileStat, 0, sizeof(struct fossilStat));
991 rc = fossil_stat(zPath, &testFileStat, 1, 1);
992 fossil_print(" l_stat_rc = %d\n", rc);
993 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_size);
994 fossil_print(" l_stat_size = %s\n", zBuf);
995 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", testFileStat.st_mtime);
996 fossil_print(" l_stat_mtime = %s\n", zBuf);
@@ -1019,23 +1022,33 @@
1022 ** Options:
1023 **
1024 ** --open-config Open the configuration database first.
1025 ** --slash Trailing slashes, if any, are retained.
1026 ** --reset Reset cached stat() info for each file.
1027 ** --symlinks BOOLEAN Force allow-symlinks on or off
1028 */
1029 void cmd_test_file_environment(void){
1030 int i;
1031 int slashFlag = find_option("slash",0,0)!=0;
1032 int resetFlag = find_option("reset",0,0)!=0;
1033 const char *forceSymlinks = find_option("symlinks",0,1);
1034 if( find_option("open-config", 0, 0)!=0 ){
1035 Th_OpenConfig(1);
1036 }
1037 if( forceSymlinks ){
1038 if( is_truth(forceSymlinks) ) g.allowSymlinks = 1;
1039 if( is_false(forceSymlinks) ) g.allowSymlinks = 0;
1040 }
1041 fossil_print("Th_IsLocalOpen() = %d\n", Th_IsLocalOpen());
1042 fossil_print("Th_IsRepositoryOpen() = %d\n", Th_IsRepositoryOpen());
1043 fossil_print("Th_IsConfigOpen() = %d\n", Th_IsConfigOpen());
1044 fossil_print("filenames_are_case_sensitive() = %d\n",
1045 filenames_are_case_sensitive());
1046 fossil_print("db_allow_symlinks_by_default() = %d\n",
1047 db_allow_symlinks_by_default());
1048 fossil_print("db_allow_symlinks(0) = %d\n", db_allow_symlinks(0));
1049 fossil_print("db_allow_symlinks(1) = %d\n", db_allow_symlinks(1));
1050 for(i=2; i<g.argc; i++){
1051 emitFileStat(g.argv[i], 1, slashFlag, resetFlag);
1052 emitFileStat(g.argv[i], 0, slashFlag, resetFlag);
1053 }
1054 }
@@ -1045,31 +1058,26 @@
1058 **
1059 ** Usage: %fossil test-canonical-name FILENAME...
1060 **
1061 ** Test the operation of the canonical name generator.
1062 ** Also test Fossil's ability to measure attributes of a file.
1063 **
1064 ** Options:
1065 **
1066 ** --open-config Open the configuration database first.
1067 ** --slash Trailing slashes, if any, are retained.
1068 ** --reset Reset cached stat() info for each file.
1069 */
1070 void cmd_test_canonical_name(void){
1071 int i;
 
1072 int slashFlag = find_option("slash",0,0)!=0;
1073 int resetFlag = find_option("reset",0,0)!=0;
1074 if( find_option("open-config", 0, 0)!=0 ){
1075 Th_OpenConfig(1);
1076 }
1077 for(i=2; i<g.argc; i++){
1078 emitFileStat(g.argv[i], 0, slashFlag, resetFlag);
 
 
 
 
 
 
 
 
 
 
 
 
 
1079 }
1080 }
1081
1082 /*
1083 ** Return TRUE if the given filename is canonical.
@@ -1180,10 +1188,14 @@
1188
1189 /*
1190 ** COMMAND: test-relative-name
1191 **
1192 ** Test the operation of the relative name generator.
1193 **
1194 ** Options:
1195 **
1196 ** --slash Trailing slashes, if any, are retained.
1197 */
1198 void cmd_test_relative_name(void){
1199 int i;
1200 Blob x;
1201 int slashFlag = find_option("slash",0,0)!=0;
@@ -1299,10 +1311,11 @@
1311 **
1312 ** Options:
1313 ** --absolute Return an absolute path instead of a relative one.
1314 ** --case-sensitive B Enable or disable case-sensitive filenames. B is
1315 ** a boolean: "yes", "no", "true", "false", etc.
1316 ** --no-dir-symlinks Disables support for directory symlinks.
1317 */
1318 void cmd_test_tree_name(void){
1319 int i;
1320 Blob x;
1321 int absoluteFlag = find_option("absolute",0,0)!=0;
1322
--- src/finfo.c
+++ src/finfo.c
@@ -45,10 +45,11 @@
4545
** --case-sensitive B Enable or disable case-sensitive filenames. B is a
4646
** boolean: "yes", "no", "true", "false", etc.
4747
** -l|--log select log mode (the default)
4848
** -n|--limit N Display the first N changes (default unlimited).
4949
** N<=0 means no limit.
50
+** --no-dir-symlinks Disables support for directory symlinks.
5051
** --offset P skip P changes
5152
** -p|--print select print mode
5253
** -r|--revision R print the given revision (or ckout, if none is given)
5354
** to stdout (only in print mode)
5455
** -s|--status select status mode (print a status indicator for FILE)
5556
--- src/finfo.c
+++ src/finfo.c
@@ -45,10 +45,11 @@
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N Display the first N changes (default unlimited).
49 ** N<=0 means no limit.
 
50 ** --offset P skip P changes
51 ** -p|--print select print mode
52 ** -r|--revision R print the given revision (or ckout, if none is given)
53 ** to stdout (only in print mode)
54 ** -s|--status select status mode (print a status indicator for FILE)
55
--- src/finfo.c
+++ src/finfo.c
@@ -45,10 +45,11 @@
45 ** --case-sensitive B Enable or disable case-sensitive filenames. B is a
46 ** boolean: "yes", "no", "true", "false", etc.
47 ** -l|--log select log mode (the default)
48 ** -n|--limit N Display the first N changes (default unlimited).
49 ** N<=0 means no limit.
50 ** --no-dir-symlinks Disables support for directory symlinks.
51 ** --offset P skip P changes
52 ** -p|--print select print mode
53 ** -r|--revision R print the given revision (or ckout, if none is given)
54 ** to stdout (only in print mode)
55 ** -s|--status select status mode (print a status indicator for FILE)
56
+1
--- src/json.c
+++ src/json.c
@@ -1263,10 +1263,11 @@
12631263
INT(g, isConst);
12641264
CSTR(g, zConfigDbName);
12651265
INT(g, repositoryOpen);
12661266
INT(g, localOpen);
12671267
INT(g, minPrefix);
1268
+ INT(g, fNoDirSymlinks);
12681269
INT(g, fSqlTrace);
12691270
INT(g, fSqlStats);
12701271
INT(g, fSqlPrint);
12711272
INT(g, fQuiet);
12721273
INT(g, fHttpTrace);
12731274
--- src/json.c
+++ src/json.c
@@ -1263,10 +1263,11 @@
1263 INT(g, isConst);
1264 CSTR(g, zConfigDbName);
1265 INT(g, repositoryOpen);
1266 INT(g, localOpen);
1267 INT(g, minPrefix);
 
1268 INT(g, fSqlTrace);
1269 INT(g, fSqlStats);
1270 INT(g, fSqlPrint);
1271 INT(g, fQuiet);
1272 INT(g, fHttpTrace);
1273
--- src/json.c
+++ src/json.c
@@ -1263,10 +1263,11 @@
1263 INT(g, isConst);
1264 CSTR(g, zConfigDbName);
1265 INT(g, repositoryOpen);
1266 INT(g, localOpen);
1267 INT(g, minPrefix);
1268 INT(g, fNoDirSymlinks);
1269 INT(g, fSqlTrace);
1270 INT(g, fSqlStats);
1271 INT(g, fSqlPrint);
1272 INT(g, fQuiet);
1273 INT(g, fHttpTrace);
1274
+2
--- src/main.c
+++ src/main.c
@@ -141,10 +141,11 @@
141141
char *zOpenRevision; /* Check-in version to use during database open */
142142
int localOpen; /* True if the local database is open */
143143
char *zLocalRoot; /* The directory holding the local database */
144144
int minPrefix; /* Number of digits needed for a distinct UUID */
145145
int eHashPolicy; /* Current hash policy. One of HPOLICY_* */
146
+ int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */
146147
int fSqlTrace; /* True if --sqltrace flag is present */
147148
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
148149
int fSqlPrint; /* True if -sqlprint flag is present */
149150
int fQuiet; /* True if -quiet flag is present */
150151
int fJail; /* True if running with a chroot jail */
@@ -621,10 +622,11 @@
621622
fossil_exit(1);
622623
}else{
623624
const char *zChdir = find_option("chdir",0,1);
624625
g.isHTTP = 0;
625626
g.rcvid = 0;
627
+ g.fNoDirSymlinks = find_option("no-dir-symlinks", 0, 0)!=0;
626628
g.fQuiet = find_option("quiet", 0, 0)!=0;
627629
g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
628630
g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
629631
g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
630632
g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
631633
--- src/main.c
+++ src/main.c
@@ -141,10 +141,11 @@
141 char *zOpenRevision; /* Check-in version to use during database open */
142 int localOpen; /* True if the local database is open */
143 char *zLocalRoot; /* The directory holding the local database */
144 int minPrefix; /* Number of digits needed for a distinct UUID */
145 int eHashPolicy; /* Current hash policy. One of HPOLICY_* */
 
146 int fSqlTrace; /* True if --sqltrace flag is present */
147 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
148 int fSqlPrint; /* True if -sqlprint flag is present */
149 int fQuiet; /* True if -quiet flag is present */
150 int fJail; /* True if running with a chroot jail */
@@ -621,10 +622,11 @@
621 fossil_exit(1);
622 }else{
623 const char *zChdir = find_option("chdir",0,1);
624 g.isHTTP = 0;
625 g.rcvid = 0;
 
626 g.fQuiet = find_option("quiet", 0, 0)!=0;
627 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
628 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
629 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
630 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
631
--- src/main.c
+++ src/main.c
@@ -141,10 +141,11 @@
141 char *zOpenRevision; /* Check-in version to use during database open */
142 int localOpen; /* True if the local database is open */
143 char *zLocalRoot; /* The directory holding the local database */
144 int minPrefix; /* Number of digits needed for a distinct UUID */
145 int eHashPolicy; /* Current hash policy. One of HPOLICY_* */
146 int fNoDirSymlinks; /* True if --no-dir-symlinks flag is present */
147 int fSqlTrace; /* True if --sqltrace flag is present */
148 int fSqlStats; /* True if --sqltrace or --sqlstats are present */
149 int fSqlPrint; /* True if -sqlprint flag is present */
150 int fQuiet; /* True if -quiet flag is present */
151 int fJail; /* True if running with a chroot jail */
@@ -621,10 +622,11 @@
622 fossil_exit(1);
623 }else{
624 const char *zChdir = find_option("chdir",0,1);
625 g.isHTTP = 0;
626 g.rcvid = 0;
627 g.fNoDirSymlinks = find_option("no-dir-symlinks", 0, 0)!=0;
628 g.fQuiet = find_option("quiet", 0, 0)!=0;
629 g.fSqlTrace = find_option("sqltrace", 0, 0)!=0;
630 g.fSqlStats = find_option("sqlstats", 0, 0)!=0;
631 g.fSystemTrace = find_option("systemtrace", 0, 0)!=0;
632 g.fSshTrace = find_option("sshtrace", 0, 0)!=0;
633
--- src/merge.c
+++ src/merge.c
@@ -205,10 +205,12 @@
205205
** -f|--force Force the merge even if it would be a no-op.
206206
**
207207
** --force-missing Force the merge even if there is missing content.
208208
**
209209
** --integrate Merged branch will be closed when committing.
210
+**
211
+** --no-dir-symlinks Disables support for directory symlinks.
210212
**
211213
** -n|--dry-run If given, display instead of run actions
212214
**
213215
** -v|--verbose Show additional details of the merge
214216
*/
215217
--- src/merge.c
+++ src/merge.c
@@ -205,10 +205,12 @@
205 ** -f|--force Force the merge even if it would be a no-op.
206 **
207 ** --force-missing Force the merge even if there is missing content.
208 **
209 ** --integrate Merged branch will be closed when committing.
 
 
210 **
211 ** -n|--dry-run If given, display instead of run actions
212 **
213 ** -v|--verbose Show additional details of the merge
214 */
215
--- src/merge.c
+++ src/merge.c
@@ -205,10 +205,12 @@
205 ** -f|--force Force the merge even if it would be a no-op.
206 **
207 ** --force-missing Force the merge even if there is missing content.
208 **
209 ** --integrate Merged branch will be closed when committing.
210 **
211 ** --no-dir-symlinks Disables support for directory symlinks.
212 **
213 ** -n|--dry-run If given, display instead of run actions
214 **
215 ** -v|--verbose Show additional details of the merge
216 */
217
+8 -7
--- src/th_main.c
+++ src/th_main.c
@@ -21,10 +21,18 @@
2121
#include "config.h"
2222
#include "th_main.h"
2323
#include "sqlite3.h"
2424
2525
#if INTERFACE
26
+/*
27
+** These macros are used within this file to detect if the repository and
28
+** configuration ("user") database are currently open.
29
+*/
30
+#define Th_IsLocalOpen() (g.localOpen)
31
+#define Th_IsRepositoryOpen() (g.repositoryOpen)
32
+#define Th_IsConfigOpen() (g.zConfigDbName!=0)
33
+
2634
/*
2735
** Flag parameters to the Th_FossilInit() routine used to control the
2836
** interpreter creation and initialization process.
2937
*/
3038
#define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
@@ -59,17 +67,10 @@
5967
*/
6068
#define NO_COMMAND_HOOK_ERROR "no such command: command_hook"
6169
#define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook"
6270
#endif
6371
64
-/*
65
-** These macros are used within this file to detect if the repository and
66
-** configuration ("user") database are currently open.
67
-*/
68
-#define Th_IsRepositoryOpen() (g.repositoryOpen)
69
-#define Th_IsConfigOpen() (g.zConfigDbName!=0)
70
-
7172
/*
7273
** Global variable counting the number of outstanding calls to malloc()
7374
** made by the th1 implementation. This is used to catch memory leaks
7475
** in the interpreter. Obviously, it also means th1 is not threadsafe.
7576
*/
7677
--- src/th_main.c
+++ src/th_main.c
@@ -21,10 +21,18 @@
21 #include "config.h"
22 #include "th_main.h"
23 #include "sqlite3.h"
24
25 #if INTERFACE
 
 
 
 
 
 
 
 
26 /*
27 ** Flag parameters to the Th_FossilInit() routine used to control the
28 ** interpreter creation and initialization process.
29 */
30 #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
@@ -59,17 +67,10 @@
59 */
60 #define NO_COMMAND_HOOK_ERROR "no such command: command_hook"
61 #define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook"
62 #endif
63
64 /*
65 ** These macros are used within this file to detect if the repository and
66 ** configuration ("user") database are currently open.
67 */
68 #define Th_IsRepositoryOpen() (g.repositoryOpen)
69 #define Th_IsConfigOpen() (g.zConfigDbName!=0)
70
71 /*
72 ** Global variable counting the number of outstanding calls to malloc()
73 ** made by the th1 implementation. This is used to catch memory leaks
74 ** in the interpreter. Obviously, it also means th1 is not threadsafe.
75 */
76
--- src/th_main.c
+++ src/th_main.c
@@ -21,10 +21,18 @@
21 #include "config.h"
22 #include "th_main.h"
23 #include "sqlite3.h"
24
25 #if INTERFACE
26 /*
27 ** These macros are used within this file to detect if the repository and
28 ** configuration ("user") database are currently open.
29 */
30 #define Th_IsLocalOpen() (g.localOpen)
31 #define Th_IsRepositoryOpen() (g.repositoryOpen)
32 #define Th_IsConfigOpen() (g.zConfigDbName!=0)
33
34 /*
35 ** Flag parameters to the Th_FossilInit() routine used to control the
36 ** interpreter creation and initialization process.
37 */
38 #define TH_INIT_NONE ((u32)0x00000000) /* No flags. */
@@ -59,17 +67,10 @@
67 */
68 #define NO_COMMAND_HOOK_ERROR "no such command: command_hook"
69 #define NO_WEBPAGE_HOOK_ERROR "no such command: webpage_hook"
70 #endif
71
 
 
 
 
 
 
 
72 /*
73 ** Global variable counting the number of outstanding calls to malloc()
74 ** made by the th1 implementation. This is used to catch memory leaks
75 ** in the interpreter. Obviously, it also means th1 is not threadsafe.
76 */
77
--- src/update.c
+++ src/update.c
@@ -95,10 +95,11 @@
9595
** Options:
9696
** --case-sensitive <BOOL> override case-sensitive setting
9797
** --debug print debug information on stdout
9898
** --latest acceptable in place of VERSION, update to latest version
9999
** --force-missing force update if missing content after sync
100
+** --no-dir-symlinks Disables support for directory symlinks.
100101
** -n|--dry-run If given, display instead of run actions
101102
** -v|--verbose print status information about all files
102103
** -W|--width <num> Width of lines (default is to auto-detect). Must be >20
103104
** or 0 (= no limit, resulting in a single line per entry).
104105
**
105106
--- src/update.c
+++ src/update.c
@@ -95,10 +95,11 @@
95 ** Options:
96 ** --case-sensitive <BOOL> override case-sensitive setting
97 ** --debug print debug information on stdout
98 ** --latest acceptable in place of VERSION, update to latest version
99 ** --force-missing force update if missing content after sync
 
100 ** -n|--dry-run If given, display instead of run actions
101 ** -v|--verbose print status information about all files
102 ** -W|--width <num> Width of lines (default is to auto-detect). Must be >20
103 ** or 0 (= no limit, resulting in a single line per entry).
104 **
105
--- src/update.c
+++ src/update.c
@@ -95,10 +95,11 @@
95 ** Options:
96 ** --case-sensitive <BOOL> override case-sensitive setting
97 ** --debug print debug information on stdout
98 ** --latest acceptable in place of VERSION, update to latest version
99 ** --force-missing force update if missing content after sync
100 ** --no-dir-symlinks Disables support for directory symlinks.
101 ** -n|--dry-run If given, display instead of run actions
102 ** -v|--verbose print status information about all files
103 ** -W|--width <num> Width of lines (default is to auto-detect). Must be >20
104 ** or 0 (= no limit, resulting in a single line per entry).
105 **
106

Keyboard Shortcuts

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