Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | New setting "large-file-size" is a 64-bit integer. If any file of a check-in is larger than this amount, a warning is issues that the users has to confirm before continuing. Warnings can be bypassed using --ignore-oversize or --no-warnings. Use "fossil set large-file-size 0" to permanently disable this warning. Default value is 20,000,000. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
3ffe893f88a4b65b6a1ac6e9d5f2039a |
| User & Date: | drh 2022-01-01 00:36:52.509 |
References
|
2022-01-05
| ||
| 13:09 | Fix a harmless compiler warning in checkin.c that resulted from the oversize file check-in warning enhancements of [3ffe893f88a4b65b]. check-in: a36cddb453 user: drh tags: trunk | |
Context
|
2022-01-01
| ||
| 00:41 | Update the built-in SQLite to the latest 3.38.0 alpha, for testing. check-in: 3e74ae503f user: drh tags: trunk | |
| 00:36 | New setting "large-file-size" is a 64-bit integer. If any file of a check-in is larger than this amount, a warning is issues that the users has to confirm before continuing. Warnings can be bypassed using --ignore-oversize or --no-warnings. Use "fossil set large-file-size 0" to permanently disable this warning. Default value is 20,000,000. check-in: 3ffe893f88 user: drh tags: trunk | |
|
2021-12-31
| ||
| 19:02 | Fix harmless compiler warnings. check-in: 96a66d75f8 user: mistachkin tags: trunk | |
Changes
Changes to src/checkin.c.
| ︙ | ︙ | |||
1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 |
** and the original file will have been renamed to "<filename>-original".
*/
static int commit_warning(
Blob *pContent, /* The content of the file being committed. */
int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
int binOk, /* Non-zero if binary warnings should be disabled. */
int encodingOk, /* Non-zero if encoding warnings should be disabled. */
int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
const char *zFilename, /* The full name of the file being committed. */
Blob *pReason /* Reason for warning, if any (non-fatal only). */
){
int bReverse; /* UTF-16 byte order is reversed? */
int fUnicode; /* return value of could_be_utf16() */
int fBinary; /* does the blob content appear to be binary? */
int lookFlags; /* output flags from looks_like_utf8/utf16() */
int fHasAnyCr; /* the blob contains one or more CR chars */
int fHasLoneCrOnly; /* all detected line endings are CR only */
int fHasCrLfOnly; /* all detected line endings are CR/LF pairs */
int fHasInvalidUtf8 = 0;/* contains invalid UTF-8 */
char *zMsg; /* Warning message */
Blob fname; /* Relative pathname of the file */
static int allOk = 0; /* Set to true to disable this routine */
if( allOk ) return 0;
| > > | | | | | | | | | | | | | > > > | | | > | 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 |
** and the original file will have been renamed to "<filename>-original".
*/
static int commit_warning(
Blob *pContent, /* The content of the file being committed. */
int crlfOk, /* Non-zero if CR/LF warnings should be disabled. */
int binOk, /* Non-zero if binary warnings should be disabled. */
int encodingOk, /* Non-zero if encoding warnings should be disabled. */
int sizeOk, /* Non-zero if oversize warnings are disabled */
int noPrompt, /* 0 to always prompt, 1 for 'N', 2 for 'Y'. */
const char *zFilename, /* The full name of the file being committed. */
Blob *pReason /* Reason for warning, if any (non-fatal only). */
){
int bReverse; /* UTF-16 byte order is reversed? */
int fUnicode; /* return value of could_be_utf16() */
int fBinary; /* does the blob content appear to be binary? */
int lookFlags; /* output flags from looks_like_utf8/utf16() */
int fHasAnyCr; /* the blob contains one or more CR chars */
int fHasLoneCrOnly; /* all detected line endings are CR only */
int fHasCrLfOnly; /* all detected line endings are CR/LF pairs */
int fHasInvalidUtf8 = 0;/* contains invalid UTF-8 */
char *zMsg; /* Warning message */
Blob fname; /* Relative pathname of the file */
static int allOk = 0; /* Set to true to disable this routine */
if( allOk ) return 0;
if( sizeOk ){
fUnicode = could_be_utf16(pContent, &bReverse);
if( fUnicode ){
lookFlags = looks_like_utf16(pContent, bReverse, LOOK_NUL);
}else{
lookFlags = looks_like_utf8(pContent, LOOK_NUL);
if( !(lookFlags & LOOK_BINARY) && invalid_utf8(pContent) ){
fHasInvalidUtf8 = 1;
}
}
fHasAnyCr = (lookFlags & LOOK_CR);
fBinary = (lookFlags & LOOK_BINARY);
fHasLoneCrOnly = ((lookFlags & LOOK_EOL) == LOOK_LONE_CR);
fHasCrLfOnly = ((lookFlags & LOOK_EOL) == LOOK_CRLF);
}else{
fUnicode = fHasAnyCr = fBinary = fHasInvalidUtf8 = 0;
}
if( !sizeOk || fUnicode || fHasAnyCr || fBinary || fHasInvalidUtf8 ){
const char *zWarning = 0;
const char *zDisable = 0;
const char *zConvert = "c=convert/";
const char *zIn = "in";
Blob ans;
char cReply;
if( fBinary ){
int fHasNul = (lookFlags & LOOK_NUL); /* contains NUL chars? */
int fHasLong = (lookFlags & LOOK_LONG); /* overly long line? */
if( binOk ){
|
| ︙ | ︙ | |||
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 |
zWarning = "CR line endings";
}else if( fHasCrLfOnly ){
zWarning = "CR/LF line endings";
}else{
zWarning = "mixed line endings";
}
zDisable = "\"crlf-glob\" setting";
}else{
if( encodingOk ){
return 0; /* We don't want encoding warnings for this file. */
}
zWarning = "Unicode";
zDisable = "\"encoding-glob\" setting";
}
file_relative_name(zFilename, &fname, 0);
| > > > > | > > > > > | | | | > | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 |
zWarning = "CR line endings";
}else if( fHasCrLfOnly ){
zWarning = "CR/LF line endings";
}else{
zWarning = "mixed line endings";
}
zDisable = "\"crlf-glob\" setting";
}else if( !sizeOk ){
zWarning = "oversize";
zIn = "file";
}else{
if( encodingOk ){
return 0; /* We don't want encoding warnings for this file. */
}
zWarning = "Unicode";
zDisable = "\"encoding-glob\" setting";
}
file_relative_name(zFilename, &fname, 0);
if( !sizeOk ){
zMsg = mprintf(
"%s is more than %,lld bytes in size.\n"
"Commit anyhow (a=all/y/N)? ",
blob_str(&fname), db_large_file_size());
}else{
zMsg = mprintf(
"%s contains %s. Use --no-warnings or the %s to"
" disable this warning.\n"
"Commit anyhow (a=all/%sy/N)? ",
blob_str(&fname), zWarning, zDisable, zConvert);
}
if( noPrompt==0 ){
prompt_user(zMsg, &ans);
cReply = blob_str(&ans)[0];
blob_reset(&ans);
}else if( noPrompt==2 ){
cReply = 'Y';
}else{
|
| ︙ | ︙ | |||
1976 1977 1978 1979 1980 1981 1982 |
blob_to_lf_only(pContent);
}
fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
fclose(f);
}
return 1;
}else if( cReply!='y' && cReply!='Y' ){
| | | | 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 |
blob_to_lf_only(pContent);
}
fwrite(blob_buffer(pContent), 1, blob_size(pContent), f);
fclose(f);
}
return 1;
}else if( cReply!='y' && cReply!='Y' ){
fossil_fatal("Abandoning commit due to %s %s %s",
zWarning, zIn, blob_str(&fname));
}else if( noPrompt==2 ){
if( pReason ){
blob_append(pReason, zWarning, -1);
}
return 1;
}
blob_reset(&fname);
|
| ︙ | ︙ | |||
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 |
**
** See also: commit, extras
*/
void test_commit_warning(void){
int rc = 0;
int noSettings;
int verboseFlag;
Stmt q;
noSettings = find_option("no-settings",0,0)!=0;
verboseFlag = find_option("verbose","v",0)!=0;
verify_all_options();
db_must_be_within_tree();
db_prepare(&q,
"SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
" WHERE NOT deleted",
g.zLocalRoot,
glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
db_get("crnl-glob",""))),
glob_expr("pathname", noSettings ? 0 : db_get("binary-glob","")),
glob_expr("pathname", noSettings ? 0 : db_get("encoding-glob",""))
);
while( db_step(&q)==SQLITE_ROW ){
const char *zFullname;
const char *zName;
Blob content;
Blob reason;
| > > | > | | 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 |
**
** See also: commit, extras
*/
void test_commit_warning(void){
int rc = 0;
int noSettings;
int verboseFlag;
i64 mxSize;
Stmt q;
noSettings = find_option("no-settings",0,0)!=0;
verboseFlag = find_option("verbose","v",0)!=0;
verify_all_options();
db_must_be_within_tree();
mxSize = db_large_file_size();
db_prepare(&q,
"SELECT %Q || pathname, pathname, %s, %s, %s FROM vfile"
" WHERE NOT deleted",
g.zLocalRoot,
glob_expr("pathname", noSettings ? 0 : db_get("crlf-glob",
db_get("crnl-glob",""))),
glob_expr("pathname", noSettings ? 0 : db_get("binary-glob","")),
glob_expr("pathname", noSettings ? 0 : db_get("encoding-glob",""))
);
while( db_step(&q)==SQLITE_ROW ){
const char *zFullname;
const char *zName;
Blob content;
Blob reason;
int crlfOk, binOk, encodingOk, sizeOk;
int fileRc;
zFullname = db_column_text(&q, 0);
zName = db_column_text(&q, 1);
crlfOk = db_column_int(&q, 2);
binOk = db_column_int(&q, 3);
encodingOk = db_column_int(&q, 4);
sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
blob_zero(&content);
blob_read_from_file(&content, zFullname, RepoFILE);
blob_zero(&reason);
fileRc = commit_warning(&content, crlfOk, binOk, encodingOk, sizeOk, 2,
zFullname, &reason);
if( fileRc || verboseFlag ){
fossil_print("%d\t%s\t%s\n", fileRc, zName, blob_str(&reason));
}
blob_reset(&reason);
rc |= fileRc;
}
|
| ︙ | ︙ | |||
2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 | ** --delta use a delta manifest in the commit process ** --hash verify file status using hashing rather ** than relying on file mtimes ** --ignore-clock-skew If a clock skew is detected, ignore it and ** behave as if the user had entered 'yes' to ** the question of whether to proceed despite ** the skew. ** --integrate close all merged-in branches ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment ** -M|--message-file FILE read the commit comment from given file ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** -v|--verbose Show a diff in the commit message prompt ** --no-prompt This option disables prompting the user for | > | 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 | ** --delta use a delta manifest in the commit process ** --hash verify file status using hashing rather ** than relying on file mtimes ** --ignore-clock-skew If a clock skew is detected, ignore it and ** behave as if the user had entered 'yes' to ** the question of whether to proceed despite ** the skew. ** --ignore-oversize Do not warning the user about oversized files ** --integrate close all merged-in branches ** -m|--comment COMMENT-TEXT use COMMENT-TEXT as commit comment ** -M|--message-file FILE read the commit comment from given file ** --mimetype MIMETYPE mimetype of check-in comment ** -n|--dry-run If given, display instead of run actions ** -v|--verbose Show a diff in the commit message prompt ** --no-prompt This option disables prompting the user for |
| ︙ | ︙ | |||
2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 |
int nConflict = 0; /* Number of unresolved merge conflicts */
int abortCommit = 0; /* Abort the commit due to text format conversions */
Blob ans; /* Answer to continuation prompts */
char cReply; /* First character of ans */
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
memset(&sCiInfo, 0, sizeof(sCiInfo));
url_proxy_options();
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
noSign = find_option("nosign",0,0)!=0;
privateFlag = find_option("private",0,0)!=0;
| > | 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 |
int nConflict = 0; /* Number of unresolved merge conflicts */
int abortCommit = 0; /* Abort the commit due to text format conversions */
Blob ans; /* Answer to continuation prompts */
char cReply; /* First character of ans */
int bRecheck = 0; /* Repeat fork and closed-branch checks*/
int bAutoBrClr = 0; /* Value of "--branchcolor" is "auto" */
int bIgnoreSkew = 0; /* --ignore-clock-skew flag */
int mxSize;
memset(&sCiInfo, 0, sizeof(sCiInfo));
url_proxy_options();
/* --sha1sum is an undocumented alias for --hash for backwards compatiblity */
useHash = find_option("hash",0,0)!=0 || find_option("sha1sum",0,0)!=0;
noSign = find_option("nosign",0,0)!=0;
privateFlag = find_option("private",0,0)!=0;
|
| ︙ | ︙ | |||
2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 |
sCiInfo.zUserOvrd = find_option("user-override",0,1);
db_must_be_within_tree();
noSign = db_get_boolean("omitsign", 0)|noSign;
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
useCksum = db_get_boolean("repo-cksum", 1);
bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
outputManifest = db_get_manifest_setting();
verify_all_options();
/* Get the ID of the parent manifest artifact */
vid = db_lget_int("checkout", 0);
if( vid==0 ){
useCksum = 1;
if( privateFlag==0 && sCiInfo.zBranch==0 ) {
| > > | 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 |
sCiInfo.zUserOvrd = find_option("user-override",0,1);
db_must_be_within_tree();
noSign = db_get_boolean("omitsign", 0)|noSign;
if( db_get_boolean("clearsign", 0)==0 ){ noSign = 1; }
useCksum = db_get_boolean("repo-cksum", 1);
bIgnoreSkew = find_option("ignore-clock-skew",0,0)!=0;
outputManifest = db_get_manifest_setting();
mxSize = db_large_file_size();
if( find_option("ignore-oversize",0,0)!=0 ) mxSize = 0;
verify_all_options();
/* Get the ID of the parent manifest artifact */
vid = db_lget_int("checkout", 0);
if( vid==0 ){
useCksum = 1;
if( privateFlag==0 && sCiInfo.zBranch==0 ) {
|
| ︙ | ︙ | |||
2590 2591 2592 2593 2594 2595 2596 |
glob_expr("pathname", db_get("binary-glob","")),
glob_expr("pathname", db_get("encoding-glob",""))
);
while( db_step(&q)==SQLITE_ROW ){
int id, rid;
const char *zFullname;
Blob content;
| | > | | 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 |
glob_expr("pathname", db_get("binary-glob","")),
glob_expr("pathname", db_get("encoding-glob",""))
);
while( db_step(&q)==SQLITE_ROW ){
int id, rid;
const char *zFullname;
Blob content;
int crlfOk, binOk, encodingOk, sizeOk;
id = db_column_int(&q, 0);
zFullname = db_column_text(&q, 1);
rid = db_column_int(&q, 2);
crlfOk = db_column_int(&q, 3);
binOk = db_column_int(&q, 4);
encodingOk = db_column_int(&q, 5);
sizeOk = mxSize<=0 || file_size(zFullname, ExtFILE)<=mxSize;
blob_zero(&content);
blob_read_from_file(&content, zFullname, RepoFILE);
/* Do not emit any warnings when they are disabled. */
if( !noWarningFlag ){
abortCommit |= commit_warning(&content, crlfOk, binOk,
encodingOk, sizeOk, noPrompt,
zFullname, 0);
}
if( contains_merge_marker(&content) ){
Blob fname; /* Relative pathname of the file */
nConflict++;
file_relative_name(zFullname, &fname, 0);
|
| ︙ | ︙ |
Changes to src/db.c.
| ︙ | ︙ | |||
3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 |
if( db_step(&q2)==SQLITE_ROW ){
v = db_column_int(&q2, 0);
}
db_reset(&q2);
}
return v;
}
void db_set_int(const char *zName, int value, int globalFlag){
db_assert_protection_off_or_not_sensitive(zName);
db_unprotect(PROTECT_CONFIG);
if( globalFlag ){
db_swap_connections();
db_multi_exec("REPLACE INTO global_config(name,value) VALUES(%Q,%d)",
zName, value);
| > > > > | 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 |
if( db_step(&q2)==SQLITE_ROW ){
v = db_column_int(&q2, 0);
}
db_reset(&q2);
}
return v;
}
i64 db_large_file_size(void){
/* Return size of the largest file that is not considered oversized */
return strtoll(db_get("large-file-size","20000000"),0,0);
}
void db_set_int(const char *zName, int value, int globalFlag){
db_assert_protection_off_or_not_sensitive(zName);
db_unprotect(PROTECT_CONFIG);
if( globalFlag ){
db_swap_connections();
db_multi_exec("REPLACE INTO global_config(name,value) VALUES(%Q,%d)",
zName, value);
|
| ︙ | ︙ | |||
4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 | /* ** SETTING: web-browser width=30 sensitive ** A shell command used to launch your preferred ** web browser when given a URL as an argument. ** Defaults to "start" on windows, "open" on Mac, ** and "firefox" on Unix. */ /* ** Look up a control setting by its name. Return a pointer to the Setting ** object, or NULL if there is no such setting. ** ** If allowPrefix is true, then the Setting returned is the first one for ** which zName is a prefix of the Setting name. | > > > > > > > | 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 | /* ** SETTING: web-browser width=30 sensitive ** A shell command used to launch your preferred ** web browser when given a URL as an argument. ** Defaults to "start" on windows, "open" on Mac, ** and "firefox" on Unix. */ /* ** SETTING: large-file-size width=10 default=200000000 ** Fossil considers any file whose size is greater than this value ** to be a "large file". Fossil might issue warnings if you try to ** "add" or "commit" a "large file". Set this value to 0 or less ** to disable all such warnings. */ /* ** Look up a control setting by its name. Return a pointer to the Setting ** object, or NULL if there is no such setting. ** ** If allowPrefix is true, then the Setting returned is the first one for ** which zName is a prefix of the Setting name. |
| ︙ | ︙ |