Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Fix --chdir on Windows/Cygwin when using non-ascii characters or characters invalid for win32 filenames. On Cygwin, allow enter_chroot_jail() using win32 paths as well. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
12bc63aae53e482cd769c07d814cc825 |
| User & Date: | jan.nijtmans 2013-05-02 19:44:36.006 |
Context
|
2013-05-03
| ||
| 11:50 | Implement "fossil undo -n|--dry-run" as replacement for the --explain flag which does the same. (--explain is retained but no longer documented) check-in: 57cfcc2621 user: jan.nijtmans tags: trunk | |
|
2013-05-02
| ||
| 19:44 | Fix --chdir on Windows/Cygwin when using non-ascii characters or characters invalid for win32 filenames. On Cygwin, allow enter_chroot_jail() using win32 paths as well. check-in: 12bc63aae5 user: jan.nijtmans tags: trunk | |
| 13:28 | Allow boolean parameters sbs= and v= to taken values like "on", "off", "yes", and "no". Assign meaningful defaults even if the argument is omitted. check-in: e09d84f297 user: drh tags: trunk | |
Changes
Changes to src/file.c.
| ︙ | ︙ | |||
311 312 313 314 315 316 317 318 319 320 321 322 323 324 | #else char *zMbcs = fossil_utf8_to_filename(zFilename); int rc = access(zMbcs, flags); #endif fossil_filename_free(zMbcs); return rc; } /* ** Find an unused filename similar to zBase with zSuffix appended. ** ** Make the name relative to the working directory if relFlag is true. ** ** Space to hold the new filename is obtained form mprintf() and should | > > > > > > > > > > > > > > > > > > > > > | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
#else
char *zMbcs = fossil_utf8_to_filename(zFilename);
int rc = access(zMbcs, flags);
#endif
fossil_filename_free(zMbcs);
return rc;
}
/*
** Wrapper around the chdir() system call.
** If bChroot=1, do a chroot to this dir as well
** (UNIX only)
*/
int file_chdir(const char *zChDir, int bChroot){
#ifdef _WIN32
wchar_t *zPath = fossil_utf8_to_filename(zChDir);
int rc = _wchdir(zPath);
#else
char *zPath = fossil_utf8_to_filename(zChDir);
int rc = chdir(zPath);
if( !rc && bChroot ){
rc = chroot(zPath);
if( !rc ) rc = chdir("/");
}
#endif
fossil_filename_free(zPath);
return rc;
}
/*
** Find an unused filename similar to zBase with zSuffix appended.
**
** Make the name relative to the working directory if relFlag is true.
**
** Space to hold the new filename is obtained form mprintf() and should
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
557 558 559 560 561 562 563 |
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
g.zLogin = find_option("user", "U", 1);
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
| | | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
if( g.fSqlTrace ) g.fSqlStats = 1;
g.fSqlPrint = find_option("sqlprint", 0, 0)!=0;
g.fHttpTrace = find_option("httptrace", 0, 0)!=0;
g.zLogin = find_option("user", "U", 1);
g.zSSLIdentity = find_option("ssl-identity", 0, 1);
if( find_option("utc",0,0) ) g.fTimeFormat = 1;
if( find_option("localtime",0,0) ) g.fTimeFormat = 2;
if( zChdir && file_chdir(zChdir, 0) ){
fossil_fatal("unable to change directories to %s", zChdir);
}
if( find_option("help",0,0)!=0 ){
/* --help anywhere on the command line is translated into
** "fossil help argv[1] argv[2]..." */
int i;
char **zNewArgv = fossil_malloc( sizeof(char*)*(g.argc+2) );
|
| ︙ | ︙ | |||
1084 1085 1086 1087 1088 1089 1090 |
struct stat sStat;
Blob dir;
char *zDir;
file_canonical_name(zRepo, &dir, 0);
zDir = blob_str(&dir);
if( file_isdir(zDir)==1 ){
| | | | 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 |
struct stat sStat;
Blob dir;
char *zDir;
file_canonical_name(zRepo, &dir, 0);
zDir = blob_str(&dir);
if( file_isdir(zDir)==1 ){
if( file_chdir(zDir, 1) ){
fossil_fatal("unable to chroot into %s", zDir);
}
zRepo = "/";
}else{
for(i=strlen(zDir)-1; i>0 && zDir[i]!='/'; i--){}
if( zDir[i]!='/' ) fossil_panic("bad repository name: %s", zRepo);
if( i>0 ){
zDir[i] = 0;
if( file_chdir(zDir, 1) ){
fossil_fatal("unable to chroot into %s", zDir);
}
zDir[i] = '/';
}
zRepo = &zDir[i];
}
if( stat(zRepo, &sStat)!=0 ){
|
| ︙ | ︙ |