Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge-in trunk |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | wiki-history |
| Files: | files | file ages | folders |
| SHA3-256: |
f4a75745f9d18ca50b7a2e0edfcf0d54 |
| User & Date: | george 2020-11-17 18:46:12.105 |
Context
|
2020-12-14
| ||
| 20:34 | Merge from trunk ... (check-in: df330b709f user: george tags: wiki-history) | |
|
2020-11-17
| ||
| 18:46 | Merge-in trunk ... (check-in: f4a75745f9 user: george tags: wiki-history) | |
| 18:38 | Merge-in styling improvements from trunk ... (check-in: bb159b9e96 user: george tags: wiki-history) | |
|
2020-11-16
| ||
| 02:48 | Noted the fact that Fossil 2.9+ remembers the HTTPS URI in sync when accessed via an HTTP to HTTPS redirect. ... (check-in: 6b472ae172 user: wyoung tags: trunk) | |
Changes
Changes to skins/xekri/details.txt.
1 2 3 | timeline-arrowheads: 1 timeline-circle-nodes: 0 timeline-color-graph-lines: 1 | | | 1 2 3 4 | timeline-arrowheads: 1 timeline-circle-nodes: 0 timeline-color-graph-lines: 1 white-foreground: 1 |
Changes to src/export.c.
| ︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 |
char *zBranch; /* The branch of the check-in */
char *zMark; /* The Git-name of the check-in */
Blob sql; /* String of SQL for part of the query */
Blob comment; /* The comment text for the check-in */
int nErr = 0; /* Number of errors */
int bPhantomOk; /* True if phantom files should be ignored */
char buf[24];
pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
if( pMan==0 ){
/* Must be a phantom. Return without doing anything, and in particular
** without creating a mark for this check-in. */
gitmirror_message(VERB_NORMAL, "missing check-in: %s\n", zUuid);
return 0;
| > | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 |
char *zBranch; /* The branch of the check-in */
char *zMark; /* The Git-name of the check-in */
Blob sql; /* String of SQL for part of the query */
Blob comment; /* The comment text for the check-in */
int nErr = 0; /* Number of errors */
int bPhantomOk; /* True if phantom files should be ignored */
char buf[24];
char *zEmail; /* Contact info for Git committer field */
pMan = manifest_get(rid, CFTYPE_MANIFEST, 0);
if( pMan==0 ){
/* Must be a phantom. Return without doing anything, and in particular
** without creating a mark for this check-in. */
gitmirror_message(VERB_NORMAL, "missing check-in: %s\n", zUuid);
return 0;
|
| ︙ | ︙ | |||
1162 1163 1164 1165 1166 1167 1168 |
fossil_free(zBranch);
zMark = gitmirror_find_mark(zUuid,0,1);
fprintf(xCmd, "mark %s\n", zMark);
fossil_free(zMark);
sqlite3_snprintf(sizeof(buf), buf, "%lld",
(sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
);
| > > > > > > > > > > > > > > > > > > > | < | | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 |
fossil_free(zBranch);
zMark = gitmirror_find_mark(zUuid,0,1);
fprintf(xCmd, "mark %s\n", zMark);
fossil_free(zMark);
sqlite3_snprintf(sizeof(buf), buf, "%lld",
(sqlite3_int64)((pMan->rDate-2440587.5)*86400.0)
);
/*
** Check for 'fx_' table from previous Git import, otherwise take contact info
** from user table for <emailaddr> in committer field. If no emailaddr, check
** if username is in email form, otherwise use generic 'username@noemail.net'.
*/
if (db_table_exists("repository", "fx_git")) {
zEmail = db_text(0, "SELECT email FROM fx_git WHERE user=%Q", pMan->zUser);
} else {
zEmail = db_text(0, "SELECT info FROM user WHERE login=%Q", pMan->zUser);
}
/* Some repo 'info' fields return an empty string hence the second check */
if (zEmail == NULL || zEmail[0] == '\0') {
/* If username is in emailaddr form, don't append '@noemail.net' */
if (strchr(pMan->zUser, '@') == NULL) {
zEmail = mprintf("%s@noemail.net", pMan->zUser);
} else {
zEmail = fossil_strdup(pMan->zUser);
}
}
fprintf(xCmd, "committer %s <%s> %s +0000\n", pMan->zUser, zEmail, buf);
fossil_free(zEmail);
blob_init(&comment, pMan->zComment, -1);
if( blob_size(&comment)==0 ){
blob_append(&comment, "(no comment)", -1);
}
blob_appendf(&comment, "\n\nFossilOrigin-Name: %s", zUuid);
fprintf(xCmd, "data %d\n%s\n", blob_size(&comment), blob_str(&comment));
blob_reset(&comment);
|
| ︙ | ︙ |
Changes to src/import.c.
| ︙ | ︙ | |||
285 286 287 288 289 290 291 | Blob record, cksum; import_prior_files(); qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp); blob_zero(&record); blob_appendf(&record, "C %F\n", gg.zComment); blob_appendf(&record, "D %s\n", gg.zDate); | > | > > | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
Blob record, cksum;
import_prior_files();
qsort(gg.aFile, gg.nFile, sizeof(gg.aFile[0]), mfile_cmp);
blob_zero(&record);
blob_appendf(&record, "C %F\n", gg.zComment);
blob_appendf(&record, "D %s\n", gg.zDate);
if( !g.fQuiet ){
fossil_print("%.10s\r", gg.zDate);
fflush(stdout);
}
for(i=0; i<gg.nFile; i++){
const char *zUuid = gg.aFile[i].zUuid;
if( zUuid==0 ) continue;
blob_appendf(&record, "F %F %s", gg.aFile[i].zName, zUuid);
if( gg.aFile[i].isExe ){
blob_append(&record, " x\n", 3);
}else if( gg.aFile[i].isLink ){
|
| ︙ | ︙ | |||
538 539 540 541 542 543 544 545 546 547 548 549 550 551 |
zName[i] = 0;
}
static struct{
const char *zMasterName; /* Name of master branch */
int authorFlag; /* Use author as checkin committer */
} ggit;
/*
** Read the git-fast-import format from pIn and insert the corresponding
** content into the database.
*/
static void git_fast_import(FILE *pIn){
| > > > > > | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 |
zName[i] = 0;
}
static struct{
const char *zMasterName; /* Name of master branch */
int authorFlag; /* Use author as checkin committer */
int nGitAttr; /* Number of Git --attribute entries */
struct { /* Git --attribute details */
char *zUser;
char *zEmail;
} *gitUserInfo;
} ggit;
/*
** Read the git-fast-import format from pIn and insert the corresponding
** content into the database.
*/
static void git_fast_import(FILE *pIn){
|
| ︙ | ︙ | |||
662 663 664 665 666 667 668 |
|| (ggit.authorFlag && strncmp(zLine, "author ", 7)==0)
|| strncmp(zLine, "committer ",10)==0 ){
sqlite3_int64 secSince1970;
z = strchr(zLine, ' ');
while( fossil_isspace(*z) ) z++;
if( (zTo=strchr(z, '>'))==NULL ) goto malformed_line;
*(++zTo) = '\0';
| > | > > > > > > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 |
|| (ggit.authorFlag && strncmp(zLine, "author ", 7)==0)
|| strncmp(zLine, "committer ",10)==0 ){
sqlite3_int64 secSince1970;
z = strchr(zLine, ' ');
while( fossil_isspace(*z) ) z++;
if( (zTo=strchr(z, '>'))==NULL ) goto malformed_line;
*(++zTo) = '\0';
/*
** If --attribute requested, lookup user in fx_ table by email address,
** otherwise lookup Git {author,committer} contact info in user table. If
** no matches, use email address as username for check-in attribution.
*/
fossil_free(gg.zUser);
gg.zUser = db_text(0, "SELECT login FROM user WHERE info=%Q", z);
if( gg.zUser==NULL ){
/* If there is no user with this contact info,
* then use the email address as the username. */
if ( (z=strchr(z, '<'))==NULL ) goto malformed_line;
z++;
*(zTo-1) = '\0';
gg.zUser = fossil_strdup(z);
}
if (ggit.nGitAttr > 0 || db_table_exists("repository", "fx_git")) {
gg.zUser = db_text(gg.zUser,
"SELECT user FROM fx_git WHERE email=%Q", z);
}
secSince1970 = 0;
for(zTo++; fossil_isdigit(*zTo); zTo++){
secSince1970 = secSince1970*10 + *zTo - '0';
}
fossil_free(gg.zDate);
gg.zDate = db_text(0, "SELECT datetime(%lld, 'unixepoch')",secSince1970);
|
| ︙ | ︙ | |||
710 711 712 713 714 715 716 |
dequote_git_filename(zName);
i = 0;
pFile = import_find_file(zName, &i, gg.nFile);
if( pFile==0 ){
pFile = import_add_file();
pFile->zName = fossil_strdup(zName);
}
| | | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 |
dequote_git_filename(zName);
i = 0;
pFile = import_find_file(zName, &i, gg.nFile);
if( pFile==0 ){
pFile = import_add_file();
pFile->zName = fossil_strdup(zName);
}
pFile->isExe = (sqlite3_strglob("*755",zPerm)==0);
pFile->isLink = (fossil_strcmp(zPerm, "120000")==0);
fossil_free(pFile->zUuid);
if( strcmp(zUuid,"inline")==0 ){
pFile->zUuid = 0;
gg.pInlineFile = pFile;
}else{
pFile->zUuid = resolve_committish(zUuid);
|
| ︙ | ︙ | |||
750 751 752 753 754 755 756 |
mx = gg.nFile;
nFrom = strlen(zFrom);
while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
if( pFile->isFrom==0 ) continue;
pNew = import_add_file();
pFile = &gg.aFile[i-1];
if( strlen(pFile->zName)>nFrom ){
| | | 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
mx = gg.nFile;
nFrom = strlen(zFrom);
while( (pFile = import_find_file(zFrom, &i, mx))!=0 ){
if( pFile->isFrom==0 ) continue;
pNew = import_add_file();
pFile = &gg.aFile[i-1];
if( strlen(pFile->zName)>nFrom ){
pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
}else{
pNew->zName = fossil_strdup(zTo);
}
pNew->isExe = pFile->isExe;
pNew->isLink = pFile->isLink;
pNew->zUuid = fossil_strdup(pFile->zUuid);
pNew->isFrom = 0;
|
| ︙ | ︙ | |||
773 774 775 776 777 778 779 |
i = 0;
nFrom = strlen(zFrom);
while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
if( pFile->isFrom==0 ) continue;
pNew = import_add_file();
pFile = &gg.aFile[i-1];
if( strlen(pFile->zName)>nFrom ){
| | | 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 |
i = 0;
nFrom = strlen(zFrom);
while( (pFile = import_find_file(zFrom, &i, gg.nFile))!=0 ){
if( pFile->isFrom==0 ) continue;
pNew = import_add_file();
pFile = &gg.aFile[i-1];
if( strlen(pFile->zName)>nFrom ){
pNew->zName = mprintf("%s%s", zTo, pFile->zName+nFrom);
}else{
pNew->zName = fossil_strdup(zTo);
}
pNew->zPrior = pFile->zName;
pNew->isExe = pFile->isExe;
pNew->isLink = pFile->isLink;
pNew->zUuid = pFile->zUuid;
|
| ︙ | ︙ | |||
801 802 803 804 805 806 807 808 809 810 811 812 813 814 |
/* Breezy uses this property to store the branch name.
** It has two values. Integer branch number, then the
** user-readable branch name. */
z = &zLine[21];
next_token(&z);
fossil_free(gg.zBranch);
gg.zBranch = fossil_strdup(next_token(&z));
}else
{
goto malformed_line;
}
}
gg.xFinish();
import_reset(1);
| > > > > | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 |
/* Breezy uses this property to store the branch name.
** It has two values. Integer branch number, then the
** user-readable branch name. */
z = &zLine[21];
next_token(&z);
fossil_free(gg.zBranch);
gg.zBranch = fossil_strdup(next_token(&z));
}else
if( strncmp(zLine, "property rebase-of ", 19)==0 ){
/* Breezy uses this property to record that a branch
** was rebased. Silently ignore it. */
}else
{
goto malformed_line;
}
}
gg.xFinish();
import_reset(1);
|
| ︙ | ︙ | |||
1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | ** ** --git Import from the git-fast-export file format (default) ** Options: ** --import-marks FILE Restore marks table from FILE ** --export-marks FILE Save marks table to FILE ** --rename-master NAME Renames the master branch to NAME ** --use-author Uses author as the committer ** ** --svn Import from the svnadmin-dump file format. The default ** behaviour (unless overridden by --flat) is to treat 3 ** folders in the SVN root as special, following the ** common layout of SVN repositories. These are (by ** default) trunk/, branches/ and tags/. The SVN --deltas ** format is supported but not required. | > > | 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 | ** ** --git Import from the git-fast-export file format (default) ** Options: ** --import-marks FILE Restore marks table from FILE ** --export-marks FILE Save marks table to FILE ** --rename-master NAME Renames the master branch to NAME ** --use-author Uses author as the committer ** --attribute "EMAIL USER" Attribute commits to USER ** instead of Git committer EMAIL address ** ** --svn Import from the svnadmin-dump file format. The default ** behaviour (unless overridden by --flat) is to treat 3 ** folders in the SVN root as special, following the ** common layout of SVN repositories. These are (by ** default) trunk/, branches/ and tags/. The SVN --deltas ** format is supported but not required. |
| ︙ | ︙ | |||
1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 |
** with the original name. For example, "--rename-tag svn-%-tag" renames
** the tag called "release" to "svn-release-tag".
**
** --ignore-tree is useful for importing Subversion repositories which
** move branches to subdirectories of "branches/deleted" instead of
** deleting them. It can be supplied multiple times if necessary.
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
| > > > > > | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 |
** with the original name. For example, "--rename-tag svn-%-tag" renames
** the tag called "release" to "svn-release-tag".
**
** --ignore-tree is useful for importing Subversion repositories which
** move branches to subdirectories of "branches/deleted" instead of
** deleting them. It can be supplied multiple times if necessary.
**
** The --attribute option takes a quoted string argument comprised of a
** Git committer email and the username to be attributed to corresponding
** check-ins in the Fossil repository. This option can be repeated. For
** example, --attribute "drh@sqlite.org drh" --attribute "xyz@abc.net X"
**
** See also: export
*/
void import_cmd(void){
char *zPassword;
FILE *pIn;
Stmt q;
int forceFlag = find_option("force", "f", 0)!=0;
|
| ︙ | ︙ | |||
1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 |
}else if( gitFlag ){
markfile_in = find_option("import-marks", 0, 1);
markfile_out = find_option("export-marks", 0, 1);
if( !(ggit.zMasterName = find_option("rename-master", 0, 1)) ){
ggit.zMasterName = "master";
}
ggit.authorFlag = find_option("use-author", 0, 0)!=0;
}
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
| > > > > > > > > > > > > > | 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 |
}else if( gitFlag ){
markfile_in = find_option("import-marks", 0, 1);
markfile_out = find_option("export-marks", 0, 1);
if( !(ggit.zMasterName = find_option("rename-master", 0, 1)) ){
ggit.zMasterName = "master";
}
ggit.authorFlag = find_option("use-author", 0, 0)!=0;
/*
** Extract --attribute 'emailaddr username' args that will populate
** new 'fx_' table to later match username for check-in attribution.
*/
const char *zGitUser = find_option("attribute", 0, 1);
while( zGitUser != 0 ){
ggit.gitUserInfo = fossil_realloc(ggit.gitUserInfo, ++ggit.nGitAttr
* sizeof(ggit.gitUserInfo[0]));
char *currGitUser = fossil_strdup(zGitUser);
ggit.gitUserInfo[ggit.nGitAttr-1].zEmail = next_token(&currGitUser);
ggit.gitUserInfo[ggit.nGitAttr-1].zUser = rest_of_line(&currGitUser);
zGitUser = find_option("attribute", 0, 1);
}
}
verify_all_options();
if( g.argc!=3 && g.argc!=4 ){
usage("--git|--svn ?OPTIONS? NEW-REPOSITORY ?INPUT-FILE?");
}
if( g.argc==4 ){
|
| ︙ | ︙ | |||
1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 |
if( import_marks(f, &blobs, NULL, NULL)<0 ){
fossil_fatal("error importing marks from file: %s", markfile_in);
}
fclose(f);
}
manifest_crosslink_begin();
git_fast_import(pIn);
db_prepare(&q, "SELECT tcontent FROM xtag");
while( db_step(&q)==SQLITE_ROW ){
Blob record;
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0, 0, 1);
import_reset(0);
| > > > > > > > > > > > > > > > > > > | 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 1969 1970 |
if( import_marks(f, &blobs, NULL, NULL)<0 ){
fossil_fatal("error importing marks from file: %s", markfile_in);
}
fclose(f);
}
manifest_crosslink_begin();
/*
** The following 'fx_' table is used to hold information needed for
** importing and exporting to attribute Fossil check-ins or Git commits
** to either a desired username or full contact information string.
*/
if(ggit.nGitAttr > 0) {
db_unprotect(PROTECT_ALL);
db_multi_exec(
"CREATE TABLE fx_git(user TEXT, email TEXT UNIQUE);"
);
for( int idx = 0; idx < ggit.nGitAttr; ++idx ){
db_multi_exec(
"INSERT OR IGNORE INTO fx_git(user, email) VALUES(%Q, %Q)",
ggit.gitUserInfo[idx].zUser, ggit.gitUserInfo[idx].zEmail
);
}
db_protect_pop();
}
git_fast_import(pIn);
db_prepare(&q, "SELECT tcontent FROM xtag");
while( db_step(&q)==SQLITE_ROW ){
Blob record;
db_ephemeral_blob(&q, 0, &record);
fast_insert_content(&record, 0, 0, 0, 1);
import_reset(0);
|
| ︙ | ︙ |
Changes to src/info.c.
| ︙ | ︙ | |||
2396 2397 2398 2399 2400 2401 2402 |
style_submenu_element("Shun", "%R/shun?shun=%s#addshun",zUuid);
}
}
if( isFile ){
if( isSymbolicCI ){
zHeader = mprintf("%s at %s", file_tail(zName), zCI);
| | | 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 |
style_submenu_element("Shun", "%R/shun?shun=%s#addshun",zUuid);
}
}
if( isFile ){
if( isSymbolicCI ){
zHeader = mprintf("%s at %s", file_tail(zName), zCI);
}else if( zCIUuid && zCIUuid[0] ){
zHeader = mprintf("%s at [%S]", file_tail(zName), zCIUuid);
}else{
zHeader = mprintf("%s", file_tail(zName));
}
}else if( descOnly ){
zHeader = mprintf("Artifact Description [%S]", zUuid);
}else{
|
| ︙ | ︙ |
Changes to src/login.c.
| ︙ | ︙ | |||
641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
sleep(1);
zErrMsg =
@ <p><span class="loginError">
@ You entered an unknown user or an incorrect password.
@ </span></p>
;
record_login_attempt(zUsername, zIpAddr, 0);
}else{
/* Non-anonymous login is successful. Set a cookie of the form:
**
** HASH/PROJECT/LOGIN
**
** where HASH is a random hex number, PROJECT is either project
** code prefix, and LOGIN is the user name.
| > | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 |
sleep(1);
zErrMsg =
@ <p><span class="loginError">
@ You entered an unknown user or an incorrect password.
@ </span></p>
;
record_login_attempt(zUsername, zIpAddr, 0);
cgi_set_status(401, "Unauthorized");
}else{
/* Non-anonymous login is successful. Set a cookie of the form:
**
** HASH/PROJECT/LOGIN
**
** where HASH is a random hex number, PROJECT is either project
** code prefix, and LOGIN is the user name.
|
| ︙ | ︙ |
Changes to src/markdown_html.c.
| ︙ | ︙ | |||
345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
const char *zArg, int nArg /* Addition arguments */
){
int pikFlags = PIKCHR_PROCESS_NONCE
| PIKCHR_PROCESS_DIV
| PIKCHR_PROCESS_SRC
| PIKCHR_PROCESS_ERR_PRE;
Blob bSrc = empty_blob;
while( nArg>0 ){
int i;
for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){}
if( i==6 && strncmp(zArg, "center", 6)==0 ){
pikFlags |= PIKCHR_PROCESS_DIV_CENTER;
}else if( i==6 && strncmp(zArg, "indent", 6)==0 ){
| > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
const char *zArg, int nArg /* Addition arguments */
){
int pikFlags = PIKCHR_PROCESS_NONCE
| PIKCHR_PROCESS_DIV
| PIKCHR_PROCESS_SRC
| PIKCHR_PROCESS_ERR_PRE;
Blob bSrc = empty_blob;
const char *zFgColor;
while( nArg>0 ){
int i;
for(i=0; i<nArg && !fossil_isspace(zArg[i]); i++){}
if( i==6 && strncmp(zArg, "center", 6)==0 ){
pikFlags |= PIKCHR_PROCESS_DIV_CENTER;
}else if( i==6 && strncmp(zArg, "indent", 6)==0 ){
|
| ︙ | ︙ | |||
368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
}else if( i==13 && strncmp(zArg, "source-inline", 13)==0 ){
pikFlags |= PIKCHR_PROCESS_DIV_SOURCE_INLINE;
}
while( i<nArg && fossil_isspace(zArg[i]) ){ i++; }
zArg += i;
nArg -= i;
}
blob_append(&bSrc, zSrc, nSrc)
/*have to dup input to ensure a NUL-terminated source string */;
pikchr_process(blob_str(&bSrc), pikFlags, 0, ob);
blob_reset(&bSrc);
}
/* Invoked for `...` blocks where there are nSep grave accents in a
| > > > > > > > | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
}else if( i==13 && strncmp(zArg, "source-inline", 13)==0 ){
pikFlags |= PIKCHR_PROCESS_DIV_SOURCE_INLINE;
}
while( i<nArg && fossil_isspace(zArg[i]) ){ i++; }
zArg += i;
nArg -= i;
}
if( skin_detail_boolean("white-foreground") ){
pikFlags |= 0x02; /* PIKCHR_DARK_MODE */
}
zFgColor = skin_detail("pikchr-foreground");
if( zFgColor && zFgColor[0] ){
blob_appendf(&bSrc, "fgcolor = %s\n", zFgColor);
}
blob_append(&bSrc, zSrc, nSrc)
/*have to dup input to ensure a NUL-terminated source string */;
pikchr_process(blob_str(&bSrc), pikFlags, 0, ob);
blob_reset(&bSrc);
}
/* Invoked for `...` blocks where there are nSep grave accents in a
|
| ︙ | ︙ |
Changes to src/name.c.
| ︙ | ︙ | |||
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 |
/*
** Output HTML that shows a table of all public phantoms.
*/
void table_of_public_phantoms(void){
Stmt q;
char *zRange;
zRange = mprintf("IN (SELECT rid FROM phantom EXCEPT"
" SELECT rid FROM private)");
describe_artifacts(zRange);
fossil_free(zRange);
db_prepare(&q,
| > | > > > | > > > > > | | > > > | 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 |
/*
** Output HTML that shows a table of all public phantoms.
*/
void table_of_public_phantoms(void){
Stmt q;
char *zRange;
double rNow;
zRange = mprintf("IN (SELECT rid FROM phantom EXCEPT"
" SELECT rid FROM private)");
describe_artifacts(zRange);
fossil_free(zRange);
db_prepare(&q,
"SELECT rid, uuid, summary, ref,"
" (SELECT mtime FROM blob, rcvfrom"
" WHERE blob.uuid=ref AND rcvfrom.rcvid=blob.rcvid)"
" FROM description ORDER BY rid"
);
rNow = db_double(0.0, "SELECT julianday('now')");
@ <table cellpadding="2" cellspacing="0" border="1">
@ <tr><th>RID<th>Description<th>Source<th>Age
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q,0);
const char *zUuid = db_column_text(&q, 1);
const char *zDesc = db_column_text(&q, 2);
const char *zRef = db_column_text(&q,3);
double mtime = db_column_double(&q,4);
@ <tr><td valign="top">%d(rid)</td>
@ <td valign="top" align="left">%h(zUuid)<br>%h(zDesc)</td>
if( zRef && zRef[0] ){
@ <td valign="top">%z(href("%R/info/%!S",zRef))%!S(zRef)</a>
if( mtime>0 ){
char *zAge = human_readable_age(rNow - mtime);
@ <td valign="top">%h(zAge)
fossil_free(zAge);
}else{
@ <td>
}
}else{
@ <td> <td>
}
@ </tr>
}
@ </table>
db_finalize(&q);
}
|
| ︙ | ︙ |
Changes to src/pikchr.c.
| ︙ | ︙ | |||
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
PNum wArrow; /* Width of arrowhead at the fat end */
PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
char bLayoutVars; /* True if cache is valid */
char thenFlag; /* True if "then" seen */
char samePath; /* aTPath copied by "same" */
const char *zClass; /* Class name for the <svg> */
int wSVG, hSVG; /* Width and height of the <svg> */
/* Paths for lines are constructed here first, then transferred into
** the PObj object at the end: */
int nTPath; /* Number of entries on aTPath[] */
int mTPath; /* For last entry, 1: x set, 2: y set */
PPoint aTPath[1000]; /* Path under construction */
/* Error contexts */
unsigned int nCtx; /* Number of error contexts */
PToken aCtx[10]; /* Nested error contexts */
};
/* Include PIKCHR_PLAINTEXT_ERRORS among the bits of mFlags on the 3rd
** argument to pikchr() in order to cause error message text to come out
** as text/plain instead of as text/html
*/
#define PIKCHR_PLAINTEXT_ERRORS 0x0001
/*
** The behavior of an object class is defined by an instance of
** this structure. This is the "virtual method" table.
*/
struct PClass {
const char *zName; /* Name of class */
| > > > > > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
PNum wArrow; /* Width of arrowhead at the fat end */
PNum hArrow; /* Ht of arrowhead - dist from tip to fat end */
char bLayoutVars; /* True if cache is valid */
char thenFlag; /* True if "then" seen */
char samePath; /* aTPath copied by "same" */
const char *zClass; /* Class name for the <svg> */
int wSVG, hSVG; /* Width and height of the <svg> */
int fgcolor; /* fgcolor value, or -1 for none */
/* Paths for lines are constructed here first, then transferred into
** the PObj object at the end: */
int nTPath; /* Number of entries on aTPath[] */
int mTPath; /* For last entry, 1: x set, 2: y set */
PPoint aTPath[1000]; /* Path under construction */
/* Error contexts */
unsigned int nCtx; /* Number of error contexts */
PToken aCtx[10]; /* Nested error contexts */
};
/* Include PIKCHR_PLAINTEXT_ERRORS among the bits of mFlags on the 3rd
** argument to pikchr() in order to cause error message text to come out
** as text/plain instead of as text/html
*/
#define PIKCHR_PLAINTEXT_ERRORS 0x0001
/* Include PIKCHR_DARK_MODE among the mFlag bits to invert colors.
*/
#define PIKCHR_DARK_MODE 0x0002
/*
** The behavior of an object class is defined by an instance of
** this structure. This is the "virtual method" table.
*/
struct PClass {
const char *zName; /* Name of class */
|
| ︙ | ︙ | |||
405 406 407 408 409 410 411 | static void pik_append_num(Pik*,const char*,PNum); static void pik_append_point(Pik*,const char*,PPoint*); static void pik_append_x(Pik*,const char*,PNum,const char*); static void pik_append_y(Pik*,const char*,PNum,const char*); static void pik_append_xy(Pik*,const char*,PNum,PNum); static void pik_append_dis(Pik*,const char*,PNum,const char*); static void pik_append_arc(Pik*,PNum,PNum,PNum,PNum); | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | static void pik_append_num(Pik*,const char*,PNum); static void pik_append_point(Pik*,const char*,PPoint*); static void pik_append_x(Pik*,const char*,PNum,const char*); static void pik_append_y(Pik*,const char*,PNum,const char*); static void pik_append_xy(Pik*,const char*,PNum,PNum); static void pik_append_dis(Pik*,const char*,PNum,const char*); static void pik_append_arc(Pik*,PNum,PNum,PNum,PNum); static void pik_append_clr(Pik*,const char*,PNum,const char*,int); static void pik_append_style(Pik*,PObj*,int); static void pik_append_txt(Pik*,PObj*, PBox*); static void pik_draw_arrowhead(Pik*,PPoint*pFrom,PPoint*pTo,PObj*); static void pik_chop(PPoint*pFrom,PPoint*pTo,PNum); static void pik_error(Pik*,PToken*,const char*); static void pik_elist_free(Pik*,PList*); static void pik_elem_free(Pik*,PObj*); |
| ︙ | ︙ | |||
466 467 468 469 470 471 472 | static void pik_behind(Pik*,PObj*); static PObj *pik_assert(Pik*,PNum,PToken*,PNum); static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*); static PNum pik_dist(PPoint*,PPoint*); static void pik_add_macro(Pik*,PToken *pId,PToken *pCode); | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | static void pik_behind(Pik*,PObj*); static PObj *pik_assert(Pik*,PNum,PToken*,PNum); static PObj *pik_position_assert(Pik*,PPoint*,PToken*,PPoint*); static PNum pik_dist(PPoint*,PPoint*); static void pik_add_macro(Pik*,PToken *pId,PToken *pCode); #line 504 "pikchr.c" /**************** End of %include directives **********************************/ /* These constants specify the various numeric values for terminal symbols. ***************** Begin token definitions *************************************/ #ifndef T_ID #define T_ID 1 #define T_EDGEPT 2 #define T_OF 3 |
| ︙ | ︙ | |||
1683 1684 1685 1686 1687 1688 1689 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 98: /* statement_list */
{
| | | | | | 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 |
** Note: during a reduce, the only symbols destroyed are those
** which appear on the RHS of the rule, but which are *not* used
** inside the C code.
*/
/********* Begin destructor definitions ***************************************/
case 98: /* statement_list */
{
#line 493 "pikchr.y"
pik_elist_free(p,(yypminor->yy119));
#line 1722 "pikchr.c"
}
break;
case 99: /* statement */
case 100: /* unnamed_statement */
case 101: /* basetype */
{
#line 495 "pikchr.y"
pik_elem_free(p,(yypminor->yy38));
#line 1731 "pikchr.c"
}
break;
/********* End destructor definitions *****************************************/
default: break; /* If no destructor action specified: do nothing */
}
}
|
| ︙ | ︙ | |||
1912 1913 1914 1915 1916 1917 1918 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
| | | | 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 |
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
}
#endif
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
/* Here code is inserted which will execute if the parser
** stack every overflows */
/******** Begin %stack_overflow code ******************************************/
#line 527 "pikchr.y"
pik_error(p, 0, "parser stack overflow");
#line 1952 "pikchr.c"
/******** End %stack_overflow code ********************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument var */
pik_parserCTX_STORE
}
/*
** Print tracing information for a SHIFT action
|
| ︙ | ︙ | |||
2393 2394 2395 2396 2397 2398 2399 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= statement_list */
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 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 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 |
** { ... } // User supplied code
** #line <lineno> <thisfile>
** break;
*/
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* document ::= statement_list */
#line 531 "pikchr.y"
{pik_render(p,yymsp[0].minor.yy119);}
#line 2432 "pikchr.c"
break;
case 1: /* statement_list ::= statement */
#line 534 "pikchr.y"
{ yylhsminor.yy119 = pik_elist_append(p,0,yymsp[0].minor.yy38); }
#line 2437 "pikchr.c"
yymsp[0].minor.yy119 = yylhsminor.yy119;
break;
case 2: /* statement_list ::= statement_list EOL statement */
#line 536 "pikchr.y"
{ yylhsminor.yy119 = pik_elist_append(p,yymsp[-2].minor.yy119,yymsp[0].minor.yy38); }
#line 2443 "pikchr.c"
yymsp[-2].minor.yy119 = yylhsminor.yy119;
break;
case 3: /* statement ::= */
#line 539 "pikchr.y"
{ yymsp[1].minor.yy38 = 0; }
#line 2449 "pikchr.c"
break;
case 4: /* statement ::= direction */
#line 540 "pikchr.y"
{ pik_set_direction(p,yymsp[0].minor.yy0.eCode); yylhsminor.yy38=0; }
#line 2454 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 5: /* statement ::= lvalue ASSIGN rvalue */
#line 541 "pikchr.y"
{pik_set_var(p,&yymsp[-2].minor.yy0,yymsp[0].minor.yy265,&yymsp[-1].minor.yy0); yylhsminor.yy38=0;}
#line 2460 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 6: /* statement ::= PLACENAME COLON unnamed_statement */
#line 543 "pikchr.y"
{ yylhsminor.yy38 = yymsp[0].minor.yy38; pik_elem_setname(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0); }
#line 2466 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 7: /* statement ::= PLACENAME COLON position */
#line 545 "pikchr.y"
{ yylhsminor.yy38 = pik_elem_new(p,0,0,0);
if(yylhsminor.yy38){ yylhsminor.yy38->ptAt = yymsp[0].minor.yy43; pik_elem_setname(p,yylhsminor.yy38,&yymsp[-2].minor.yy0); }}
#line 2473 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 8: /* statement ::= unnamed_statement */
#line 547 "pikchr.y"
{yylhsminor.yy38 = yymsp[0].minor.yy38;}
#line 2479 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 9: /* statement ::= print prlist */
#line 548 "pikchr.y"
{pik_append(p,"<br>\n",5); yymsp[-1].minor.yy38=0;}
#line 2485 "pikchr.c"
break;
case 10: /* statement ::= ASSERT LP expr EQ expr RP */
#line 553 "pikchr.y"
{yymsp[-5].minor.yy38=pik_assert(p,yymsp[-3].minor.yy265,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy265);}
#line 2490 "pikchr.c"
break;
case 11: /* statement ::= ASSERT LP position EQ position RP */
#line 555 "pikchr.y"
{yymsp[-5].minor.yy38=pik_position_assert(p,&yymsp[-3].minor.yy43,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy43);}
#line 2495 "pikchr.c"
break;
case 12: /* statement ::= DEFINE ID CODEBLOCK */
#line 556 "pikchr.y"
{yymsp[-2].minor.yy38=0; pik_add_macro(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
#line 2500 "pikchr.c"
break;
case 13: /* rvalue ::= PLACENAME */
#line 567 "pikchr.y"
{yylhsminor.yy265 = pik_lookup_color(p,&yymsp[0].minor.yy0);}
#line 2505 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 14: /* pritem ::= FILL */
case 15: /* pritem ::= COLOR */ yytestcase(yyruleno==15);
case 16: /* pritem ::= THICKNESS */ yytestcase(yyruleno==16);
#line 572 "pikchr.y"
{pik_append_num(p,"",pik_value(p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.n,0));}
#line 2513 "pikchr.c"
break;
case 17: /* pritem ::= rvalue */
#line 575 "pikchr.y"
{pik_append_num(p,"",yymsp[0].minor.yy265);}
#line 2518 "pikchr.c"
break;
case 18: /* pritem ::= STRING */
#line 576 "pikchr.y"
{pik_append_text(p,yymsp[0].minor.yy0.z+1,yymsp[0].minor.yy0.n-2,0);}
#line 2523 "pikchr.c"
break;
case 19: /* prsep ::= COMMA */
#line 577 "pikchr.y"
{pik_append(p, " ", 1);}
#line 2528 "pikchr.c"
break;
case 20: /* unnamed_statement ::= basetype attribute_list */
#line 580 "pikchr.y"
{yylhsminor.yy38 = yymsp[-1].minor.yy38; pik_after_adding_attributes(p,yylhsminor.yy38);}
#line 2533 "pikchr.c"
yymsp[-1].minor.yy38 = yylhsminor.yy38;
break;
case 21: /* basetype ::= CLASSNAME */
#line 582 "pikchr.y"
{yylhsminor.yy38 = pik_elem_new(p,&yymsp[0].minor.yy0,0,0); }
#line 2539 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 22: /* basetype ::= STRING textposition */
#line 584 "pikchr.y"
{yymsp[-1].minor.yy0.eCode = yymsp[0].minor.yy196; yylhsminor.yy38 = pik_elem_new(p,0,&yymsp[-1].minor.yy0,0); }
#line 2545 "pikchr.c"
yymsp[-1].minor.yy38 = yylhsminor.yy38;
break;
case 23: /* basetype ::= LB savelist statement_list RB */
#line 586 "pikchr.y"
{ p->list = yymsp[-2].minor.yy119; yymsp[-3].minor.yy38 = pik_elem_new(p,0,0,yymsp[-1].minor.yy119); if(yymsp[-3].minor.yy38) yymsp[-3].minor.yy38->errTok = yymsp[0].minor.yy0; }
#line 2551 "pikchr.c"
break;
case 24: /* savelist ::= */
#line 591 "pikchr.y"
{yymsp[1].minor.yy119 = p->list; p->list = 0;}
#line 2556 "pikchr.c"
break;
case 25: /* relexpr ::= expr */
#line 598 "pikchr.y"
{yylhsminor.yy200.rAbs = yymsp[0].minor.yy265; yylhsminor.yy200.rRel = 0;}
#line 2561 "pikchr.c"
yymsp[0].minor.yy200 = yylhsminor.yy200;
break;
case 26: /* relexpr ::= expr PERCENT */
#line 599 "pikchr.y"
{yylhsminor.yy200.rAbs = 0; yylhsminor.yy200.rRel = yymsp[-1].minor.yy265/100;}
#line 2567 "pikchr.c"
yymsp[-1].minor.yy200 = yylhsminor.yy200;
break;
case 27: /* optrelexpr ::= */
#line 601 "pikchr.y"
{yymsp[1].minor.yy200.rAbs = 0; yymsp[1].minor.yy200.rRel = 1.0;}
#line 2573 "pikchr.c"
break;
case 28: /* attribute_list ::= relexpr alist */
#line 603 "pikchr.y"
{pik_add_direction(p,0,&yymsp[-1].minor.yy200);}
#line 2578 "pikchr.c"
break;
case 29: /* attribute ::= numproperty relexpr */
#line 607 "pikchr.y"
{ pik_set_numprop(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy200); }
#line 2583 "pikchr.c"
break;
case 30: /* attribute ::= dashproperty expr */
#line 608 "pikchr.y"
{ pik_set_dashed(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy265); }
#line 2588 "pikchr.c"
break;
case 31: /* attribute ::= dashproperty */
#line 609 "pikchr.y"
{ pik_set_dashed(p,&yymsp[0].minor.yy0,0); }
#line 2593 "pikchr.c"
break;
case 32: /* attribute ::= colorproperty rvalue */
#line 610 "pikchr.y"
{ pik_set_clrprop(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy265); }
#line 2598 "pikchr.c"
break;
case 33: /* attribute ::= go direction optrelexpr */
#line 611 "pikchr.y"
{ pik_add_direction(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy200);}
#line 2603 "pikchr.c"
break;
case 34: /* attribute ::= go direction even position */
#line 612 "pikchr.y"
{pik_evenwith(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy43);}
#line 2608 "pikchr.c"
break;
case 35: /* attribute ::= CLOSE */
#line 613 "pikchr.y"
{ pik_close_path(p,&yymsp[0].minor.yy0); }
#line 2613 "pikchr.c"
break;
case 36: /* attribute ::= CHOP */
#line 614 "pikchr.y"
{ p->cur->bChop = 1; }
#line 2618 "pikchr.c"
break;
case 37: /* attribute ::= FROM position */
#line 615 "pikchr.y"
{ pik_set_from(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy43); }
#line 2623 "pikchr.c"
break;
case 38: /* attribute ::= TO position */
#line 616 "pikchr.y"
{ pik_add_to(p,p->cur,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy43); }
#line 2628 "pikchr.c"
break;
case 39: /* attribute ::= THEN */
#line 617 "pikchr.y"
{ pik_then(p, &yymsp[0].minor.yy0, p->cur); }
#line 2633 "pikchr.c"
break;
case 40: /* attribute ::= THEN optrelexpr HEADING expr */
case 42: /* attribute ::= GO optrelexpr HEADING expr */ yytestcase(yyruleno==42);
#line 619 "pikchr.y"
{pik_move_hdg(p,&yymsp[-2].minor.yy200,&yymsp[-1].minor.yy0,yymsp[0].minor.yy265,0,&yymsp[-3].minor.yy0);}
#line 2639 "pikchr.c"
break;
case 41: /* attribute ::= THEN optrelexpr EDGEPT */
case 43: /* attribute ::= GO optrelexpr EDGEPT */ yytestcase(yyruleno==43);
#line 620 "pikchr.y"
{pik_move_hdg(p,&yymsp[-1].minor.yy200,0,0,&yymsp[0].minor.yy0,&yymsp[-2].minor.yy0);}
#line 2645 "pikchr.c"
break;
case 44: /* attribute ::= AT position */
#line 625 "pikchr.y"
{ pik_set_at(p,0,&yymsp[0].minor.yy43,&yymsp[-1].minor.yy0); }
#line 2650 "pikchr.c"
break;
case 45: /* attribute ::= SAME */
#line 627 "pikchr.y"
{pik_same(p,0,&yymsp[0].minor.yy0);}
#line 2655 "pikchr.c"
break;
case 46: /* attribute ::= SAME AS object */
#line 628 "pikchr.y"
{pik_same(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2660 "pikchr.c"
break;
case 47: /* attribute ::= STRING textposition */
#line 629 "pikchr.y"
{pik_add_txt(p,&yymsp[-1].minor.yy0,yymsp[0].minor.yy196);}
#line 2665 "pikchr.c"
break;
case 48: /* attribute ::= FIT */
#line 630 "pikchr.y"
{pik_size_to_fit(p,&yymsp[0].minor.yy0,3); }
#line 2670 "pikchr.c"
break;
case 49: /* attribute ::= BEHIND object */
#line 631 "pikchr.y"
{pik_behind(p,yymsp[0].minor.yy38);}
#line 2675 "pikchr.c"
break;
case 50: /* withclause ::= DOT_E edge AT position */
case 51: /* withclause ::= edge AT position */ yytestcase(yyruleno==51);
#line 639 "pikchr.y"
{ pik_set_at(p,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy43,&yymsp[-1].minor.yy0); }
#line 2681 "pikchr.c"
break;
case 52: /* numproperty ::= HEIGHT|WIDTH|RADIUS|DIAMETER|THICKNESS */
#line 643 "pikchr.y"
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
#line 2686 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 53: /* boolproperty ::= CW */
#line 654 "pikchr.y"
{p->cur->cw = 1;}
#line 2692 "pikchr.c"
break;
case 54: /* boolproperty ::= CCW */
#line 655 "pikchr.y"
{p->cur->cw = 0;}
#line 2697 "pikchr.c"
break;
case 55: /* boolproperty ::= LARROW */
#line 656 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=0; }
#line 2702 "pikchr.c"
break;
case 56: /* boolproperty ::= RARROW */
#line 657 "pikchr.y"
{p->cur->larrow=0; p->cur->rarrow=1; }
#line 2707 "pikchr.c"
break;
case 57: /* boolproperty ::= LRARROW */
#line 658 "pikchr.y"
{p->cur->larrow=1; p->cur->rarrow=1; }
#line 2712 "pikchr.c"
break;
case 58: /* boolproperty ::= INVIS */
#line 659 "pikchr.y"
{p->cur->sw = 0.0;}
#line 2717 "pikchr.c"
break;
case 59: /* boolproperty ::= THICK */
#line 660 "pikchr.y"
{p->cur->sw *= 1.5;}
#line 2722 "pikchr.c"
break;
case 60: /* boolproperty ::= THIN */
#line 661 "pikchr.y"
{p->cur->sw *= 0.67;}
#line 2727 "pikchr.c"
break;
case 61: /* boolproperty ::= SOLID */
#line 662 "pikchr.y"
{p->cur->sw = pik_value(p,"thickness",9,0);
p->cur->dotted = p->cur->dashed = 0.0;}
#line 2733 "pikchr.c"
break;
case 62: /* textposition ::= */
#line 665 "pikchr.y"
{yymsp[1].minor.yy196 = 0;}
#line 2738 "pikchr.c"
break;
case 63: /* textposition ::= textposition CENTER|LJUST|RJUST|ABOVE|BELOW|ITALIC|BOLD|ALIGNED|BIG|SMALL */
#line 668 "pikchr.y"
{yylhsminor.yy196 = pik_text_position(yymsp[-1].minor.yy196,&yymsp[0].minor.yy0);}
#line 2743 "pikchr.c"
yymsp[-1].minor.yy196 = yylhsminor.yy196;
break;
case 64: /* position ::= expr COMMA expr */
#line 671 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[0].minor.yy265;}
#line 2749 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 65: /* position ::= place PLUS expr COMMA expr */
#line 673 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-4].minor.yy43.x+yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[-4].minor.yy43.y+yymsp[0].minor.yy265;}
#line 2755 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 66: /* position ::= place MINUS expr COMMA expr */
#line 674 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-4].minor.yy43.x-yymsp[-2].minor.yy265; yylhsminor.yy43.y=yymsp[-4].minor.yy43.y-yymsp[0].minor.yy265;}
#line 2761 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 67: /* position ::= place PLUS LP expr COMMA expr RP */
#line 676 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-6].minor.yy43.x+yymsp[-3].minor.yy265; yylhsminor.yy43.y=yymsp[-6].minor.yy43.y+yymsp[-1].minor.yy265;}
#line 2767 "pikchr.c"
yymsp[-6].minor.yy43 = yylhsminor.yy43;
break;
case 68: /* position ::= place MINUS LP expr COMMA expr RP */
#line 678 "pikchr.y"
{yylhsminor.yy43.x=yymsp[-6].minor.yy43.x-yymsp[-3].minor.yy265; yylhsminor.yy43.y=yymsp[-6].minor.yy43.y-yymsp[-1].minor.yy265;}
#line 2773 "pikchr.c"
yymsp[-6].minor.yy43 = yylhsminor.yy43;
break;
case 69: /* position ::= LP position COMMA position RP */
#line 679 "pikchr.y"
{yymsp[-4].minor.yy43.x=yymsp[-3].minor.yy43.x; yymsp[-4].minor.yy43.y=yymsp[-1].minor.yy43.y;}
#line 2779 "pikchr.c"
break;
case 70: /* position ::= LP position RP */
#line 680 "pikchr.y"
{yymsp[-2].minor.yy43=yymsp[-1].minor.yy43;}
#line 2784 "pikchr.c"
break;
case 71: /* position ::= expr between position AND position */
#line 682 "pikchr.y"
{yylhsminor.yy43 = pik_position_between(yymsp[-4].minor.yy265,yymsp[-2].minor.yy43,yymsp[0].minor.yy43);}
#line 2789 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 72: /* position ::= expr LT position COMMA position GT */
#line 684 "pikchr.y"
{yylhsminor.yy43 = pik_position_between(yymsp[-5].minor.yy265,yymsp[-3].minor.yy43,yymsp[-1].minor.yy43);}
#line 2795 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 73: /* position ::= expr ABOVE position */
#line 685 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.y += yymsp[-2].minor.yy265;}
#line 2801 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 74: /* position ::= expr BELOW position */
#line 686 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.y -= yymsp[-2].minor.yy265;}
#line 2807 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 75: /* position ::= expr LEFT OF position */
#line 687 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.x -= yymsp[-3].minor.yy265;}
#line 2813 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 76: /* position ::= expr RIGHT OF position */
#line 688 "pikchr.y"
{yylhsminor.yy43=yymsp[0].minor.yy43; yylhsminor.yy43.x += yymsp[-3].minor.yy265;}
#line 2819 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 77: /* position ::= expr ON HEADING EDGEPT OF position */
#line 690 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-5].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2825 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 78: /* position ::= expr HEADING EDGEPT OF position */
#line 692 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-4].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2831 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 79: /* position ::= expr EDGEPT OF position */
#line 694 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_hdg(yymsp[-3].minor.yy265,&yymsp[-2].minor.yy0,yymsp[0].minor.yy43);}
#line 2837 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 80: /* position ::= expr ON HEADING expr FROM position */
#line 696 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_angle(yymsp[-5].minor.yy265,yymsp[-2].minor.yy265,yymsp[0].minor.yy43);}
#line 2843 "pikchr.c"
yymsp[-5].minor.yy43 = yylhsminor.yy43;
break;
case 81: /* position ::= expr HEADING expr FROM position */
#line 698 "pikchr.y"
{yylhsminor.yy43 = pik_position_at_angle(yymsp[-4].minor.yy265,yymsp[-2].minor.yy265,yymsp[0].minor.yy43);}
#line 2849 "pikchr.c"
yymsp[-4].minor.yy43 = yylhsminor.yy43;
break;
case 82: /* place ::= edge OF object */
#line 710 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2855 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 83: /* place2 ::= object */
#line 711 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[0].minor.yy38,0);}
#line 2861 "pikchr.c"
yymsp[0].minor.yy43 = yylhsminor.yy43;
break;
case 84: /* place2 ::= object DOT_E edge */
#line 712 "pikchr.y"
{yylhsminor.yy43 = pik_place_of_elem(p,yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 2867 "pikchr.c"
yymsp[-2].minor.yy43 = yylhsminor.yy43;
break;
case 85: /* place2 ::= NTH VERTEX OF object */
#line 713 "pikchr.y"
{yylhsminor.yy43 = pik_nth_vertex(p,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,yymsp[0].minor.yy38);}
#line 2873 "pikchr.c"
yymsp[-3].minor.yy43 = yylhsminor.yy43;
break;
case 86: /* object ::= nth */
#line 725 "pikchr.y"
{yylhsminor.yy38 = pik_find_nth(p,0,&yymsp[0].minor.yy0);}
#line 2879 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 87: /* object ::= nth OF|IN object */
#line 726 "pikchr.y"
{yylhsminor.yy38 = pik_find_nth(p,yymsp[0].minor.yy38,&yymsp[-2].minor.yy0);}
#line 2885 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 88: /* objectname ::= PLACENAME */
#line 728 "pikchr.y"
{yylhsminor.yy38 = pik_find_byname(p,0,&yymsp[0].minor.yy0);}
#line 2891 "pikchr.c"
yymsp[0].minor.yy38 = yylhsminor.yy38;
break;
case 89: /* objectname ::= objectname DOT_U PLACENAME */
#line 730 "pikchr.y"
{yylhsminor.yy38 = pik_find_byname(p,yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 2897 "pikchr.c"
yymsp[-2].minor.yy38 = yylhsminor.yy38;
break;
case 90: /* nth ::= NTH CLASSNAME */
#line 732 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-1].minor.yy0); }
#line 2903 "pikchr.c"
yymsp[-1].minor.yy0 = yylhsminor.yy0;
break;
case 91: /* nth ::= NTH LAST CLASSNAME */
#line 733 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-2].minor.yy0); }
#line 2909 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 92: /* nth ::= LAST CLASSNAME */
#line 734 "pikchr.y"
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.eCode = -1;}
#line 2915 "pikchr.c"
break;
case 93: /* nth ::= LAST */
#line 735 "pikchr.y"
{yylhsminor.yy0=yymsp[0].minor.yy0; yylhsminor.yy0.eCode = -1;}
#line 2920 "pikchr.c"
yymsp[0].minor.yy0 = yylhsminor.yy0;
break;
case 94: /* nth ::= NTH LB RB */
#line 736 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = pik_nth_value(p,&yymsp[-2].minor.yy0);}
#line 2926 "pikchr.c"
yymsp[-2].minor.yy0 = yylhsminor.yy0;
break;
case 95: /* nth ::= NTH LAST LB RB */
#line 737 "pikchr.y"
{yylhsminor.yy0=yymsp[-1].minor.yy0; yylhsminor.yy0.eCode = -pik_nth_value(p,&yymsp[-3].minor.yy0);}
#line 2932 "pikchr.c"
yymsp[-3].minor.yy0 = yylhsminor.yy0;
break;
case 96: /* nth ::= LAST LB RB */
#line 738 "pikchr.y"
{yymsp[-2].minor.yy0=yymsp[-1].minor.yy0; yymsp[-2].minor.yy0.eCode = -1; }
#line 2938 "pikchr.c"
break;
case 97: /* expr ::= expr PLUS expr */
#line 740 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265+yymsp[0].minor.yy265;}
#line 2943 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 98: /* expr ::= expr MINUS expr */
#line 741 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265-yymsp[0].minor.yy265;}
#line 2949 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 99: /* expr ::= expr STAR expr */
#line 742 "pikchr.y"
{yylhsminor.yy265=yymsp[-2].minor.yy265*yymsp[0].minor.yy265;}
#line 2955 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 100: /* expr ::= expr SLASH expr */
#line 743 "pikchr.y"
{
if( yymsp[0].minor.yy265==0.0 ){ pik_error(p, &yymsp[-1].minor.yy0, "division by zero"); yylhsminor.yy265 = 0.0; }
else{ yylhsminor.yy265 = yymsp[-2].minor.yy265/yymsp[0].minor.yy265; }
}
#line 2964 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 101: /* expr ::= MINUS expr */
#line 747 "pikchr.y"
{yymsp[-1].minor.yy265=-yymsp[0].minor.yy265;}
#line 2970 "pikchr.c"
break;
case 102: /* expr ::= PLUS expr */
#line 748 "pikchr.y"
{yymsp[-1].minor.yy265=yymsp[0].minor.yy265;}
#line 2975 "pikchr.c"
break;
case 103: /* expr ::= LP expr RP */
#line 749 "pikchr.y"
{yymsp[-2].minor.yy265=yymsp[-1].minor.yy265;}
#line 2980 "pikchr.c"
break;
case 104: /* expr ::= LP FILL|COLOR|THICKNESS RP */
#line 750 "pikchr.y"
{yymsp[-2].minor.yy265=pik_get_var(p,&yymsp[-1].minor.yy0);}
#line 2985 "pikchr.c"
break;
case 105: /* expr ::= NUMBER */
#line 751 "pikchr.y"
{yylhsminor.yy265=pik_atof(&yymsp[0].minor.yy0);}
#line 2990 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 106: /* expr ::= ID */
#line 752 "pikchr.y"
{yylhsminor.yy265=pik_get_var(p,&yymsp[0].minor.yy0);}
#line 2996 "pikchr.c"
yymsp[0].minor.yy265 = yylhsminor.yy265;
break;
case 107: /* expr ::= FUNC1 LP expr RP */
#line 753 "pikchr.y"
{yylhsminor.yy265 = pik_func(p,&yymsp[-3].minor.yy0,yymsp[-1].minor.yy265,0.0);}
#line 3002 "pikchr.c"
yymsp[-3].minor.yy265 = yylhsminor.yy265;
break;
case 108: /* expr ::= FUNC2 LP expr COMMA expr RP */
#line 754 "pikchr.y"
{yylhsminor.yy265 = pik_func(p,&yymsp[-5].minor.yy0,yymsp[-3].minor.yy265,yymsp[-1].minor.yy265);}
#line 3008 "pikchr.c"
yymsp[-5].minor.yy265 = yylhsminor.yy265;
break;
case 109: /* expr ::= DIST LP position COMMA position RP */
#line 755 "pikchr.y"
{yymsp[-5].minor.yy265 = pik_dist(&yymsp[-3].minor.yy43,&yymsp[-1].minor.yy43);}
#line 3014 "pikchr.c"
break;
case 110: /* expr ::= place2 DOT_XY X */
#line 756 "pikchr.y"
{yylhsminor.yy265 = yymsp[-2].minor.yy43.x;}
#line 3019 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 111: /* expr ::= place2 DOT_XY Y */
#line 757 "pikchr.y"
{yylhsminor.yy265 = yymsp[-2].minor.yy43.y;}
#line 3025 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
case 112: /* expr ::= object DOT_L numproperty */
case 113: /* expr ::= object DOT_L dashproperty */ yytestcase(yyruleno==113);
case 114: /* expr ::= object DOT_L colorproperty */ yytestcase(yyruleno==114);
#line 758 "pikchr.y"
{yylhsminor.yy265=pik_property_of(yymsp[-2].minor.yy38,&yymsp[0].minor.yy0);}
#line 3033 "pikchr.c"
yymsp[-2].minor.yy265 = yylhsminor.yy265;
break;
default:
/* (115) lvalue ::= ID */ yytestcase(yyruleno==115);
/* (116) lvalue ::= FILL */ yytestcase(yyruleno==116);
/* (117) lvalue ::= COLOR */ yytestcase(yyruleno==117);
/* (118) lvalue ::= THICKNESS */ yytestcase(yyruleno==118);
|
| ︙ | ︙ | |||
3099 3100 3101 3102 3103 3104 3105 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
| | | | 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 |
int yymajor, /* The major type of the error token */
pik_parserTOKENTYPE yyminor /* The minor type of the error token */
){
pik_parserARG_FETCH
pik_parserCTX_FETCH
#define TOKEN yyminor
/************ Begin %syntax_error code ****************************************/
#line 519 "pikchr.y"
if( TOKEN.z && TOKEN.z[0] ){
pik_error(p, &TOKEN, "syntax error");
}else{
pik_error(p, 0, "syntax error");
}
UNUSED_PARAMETER(yymajor);
#line 3144 "pikchr.c"
/************ End %syntax_error code ******************************************/
pik_parserARG_STORE /* Suppress warning about unused %extra_argument variable */
pik_parserCTX_STORE
}
/*
** The following is executed when the parser accepts
|
| ︙ | ︙ | |||
3340 3341 3342 3343 3344 3345 3346 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); return yyFallback[iToken]; #else (void)iToken; return 0; #endif } | | | | > | | | > > > | | > | > > | | | > | > | 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 |
assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
return yyFallback[iToken];
#else
(void)iToken;
return 0;
#endif
}
#line 763 "pikchr.y"
/* Chart of the 148 official CSS color names with their
** corresponding RGB values thru Color Module Level 4:
** https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
**
** Two new names "None" and "Off" are added with a value
** of -1.
*/
static const struct {
const char *zName; /* Name of the color */
int val; /* RGB value */
} aColor[] = {
{ "AliceBlue", 0xf0f8ff },
{ "AntiqueWhite", 0xfaebd7 },
{ "Aqua", 0x00ffff },
{ "Aquamarine", 0x7fffd4 },
{ "Azure", 0xf0ffff },
{ "Beige", 0xf5f5dc },
{ "Bisque", 0xffe4c4 },
{ "Black", 0x000000 },
{ "BlanchedAlmond", 0xffebcd },
{ "Blue", 0x0000ff },
{ "BlueViolet", 0x8a2be2 },
{ "Brown", 0xa52a2a },
{ "BurlyWood", 0xdeb887 },
{ "CadetBlue", 0x5f9ea0 },
{ "Chartreuse", 0x7fff00 },
{ "Chocolate", 0xd2691e },
{ "Coral", 0xff7f50 },
{ "CornflowerBlue", 0x6495ed },
{ "Cornsilk", 0xfff8dc },
{ "Crimson", 0xdc143c },
{ "Cyan", 0x00ffff },
{ "DarkBlue", 0x00008b },
{ "DarkCyan", 0x008b8b },
{ "DarkGoldenrod", 0xb8860b },
{ "DarkGray", 0xa9a9a9 },
{ "DarkGreen", 0x006400 },
{ "DarkGrey", 0xa9a9a9 },
{ "DarkKhaki", 0xbdb76b },
{ "DarkMagenta", 0x8b008b },
{ "DarkOliveGreen", 0x556b2f },
{ "DarkOrange", 0xff8c00 },
{ "DarkOrchid", 0x9932cc },
{ "DarkRed", 0x8b0000 },
{ "DarkSalmon", 0xe9967a },
{ "DarkSeaGreen", 0x8fbc8f },
{ "DarkSlateBlue", 0x483d8b },
{ "DarkSlateGray", 0x2f4f4f },
{ "DarkSlateGrey", 0x2f4f4f },
{ "DarkTurquoise", 0x00ced1 },
{ "DarkViolet", 0x9400d3 },
{ "DeepPink", 0xff1493 },
{ "DeepSkyBlue", 0x00bfff },
{ "DimGray", 0x696969 },
{ "DimGrey", 0x696969 },
{ "DodgerBlue", 0x1e90ff },
{ "Firebrick", 0xb22222 },
{ "FloralWhite", 0xfffaf0 },
{ "ForestGreen", 0x228b22 },
{ "Fuchsia", 0xff00ff },
{ "Gainsboro", 0xdcdcdc },
{ "GhostWhite", 0xf8f8ff },
{ "Gold", 0xffd700 },
{ "Goldenrod", 0xdaa520 },
{ "Gray", 0x808080 },
{ "Green", 0x008000 },
{ "GreenYellow", 0xadff2f },
{ "Grey", 0x808080 },
{ "Honeydew", 0xf0fff0 },
{ "HotPink", 0xff69b4 },
{ "IndianRed", 0xcd5c5c },
{ "Indigo", 0x4b0082 },
{ "Ivory", 0xfffff0 },
{ "Khaki", 0xf0e68c },
{ "Lavender", 0xe6e6fa },
{ "LavenderBlush", 0xfff0f5 },
{ "LawnGreen", 0x7cfc00 },
{ "LemonChiffon", 0xfffacd },
{ "LightBlue", 0xadd8e6 },
{ "LightCoral", 0xf08080 },
{ "LightCyan", 0xe0ffff },
{ "LightGoldenrodYellow", 0xfafad2 },
{ "LightGray", 0xd3d3d3 },
{ "LightGreen", 0x90ee90 },
{ "LightGrey", 0xd3d3d3 },
{ "LightPink", 0xffb6c1 },
{ "LightSalmon", 0xffa07a },
{ "LightSeaGreen", 0x20b2aa },
{ "LightSkyBlue", 0x87cefa },
{ "LightSlateGray", 0x778899 },
{ "LightSlateGrey", 0x778899 },
{ "LightSteelBlue", 0xb0c4de },
{ "LightYellow", 0xffffe0 },
{ "Lime", 0x00ff00 },
{ "LimeGreen", 0x32cd32 },
{ "Linen", 0xfaf0e6 },
{ "Magenta", 0xff00ff },
{ "Maroon", 0x800000 },
{ "MediumAquamarine", 0x66cdaa },
{ "MediumBlue", 0x0000cd },
{ "MediumOrchid", 0xba55d3 },
{ "MediumPurple", 0x9370db },
{ "MediumSeaGreen", 0x3cb371 },
{ "MediumSlateBlue", 0x7b68ee },
{ "MediumSpringGreen", 0x00fa9a },
{ "MediumTurquoise", 0x48d1cc },
{ "MediumVioletRed", 0xc71585 },
{ "MidnightBlue", 0x191970 },
{ "MintCream", 0xf5fffa },
{ "MistyRose", 0xffe4e1 },
{ "Moccasin", 0xffe4b5 },
{ "NavajoWhite", 0xffdead },
{ "Navy", 0x000080 },
{ "None", -1 }, /* Non-standard addition */
{ "Off", -1 }, /* Non-standard addition */
{ "OldLace", 0xfdf5e6 },
{ "Olive", 0x808000 },
{ "OliveDrab", 0x6b8e23 },
{ "Orange", 0xffa500 },
{ "OrangeRed", 0xff4500 },
{ "Orchid", 0xda70d6 },
{ "PaleGoldenrod", 0xeee8aa },
{ "PaleGreen", 0x98fb98 },
{ "PaleTurquoise", 0xafeeee },
{ "PaleVioletRed", 0xdb7093 },
{ "PapayaWhip", 0xffefd5 },
{ "PeachPuff", 0xffdab9 },
{ "Peru", 0xcd853f },
{ "Pink", 0xffc0cb },
{ "Plum", 0xdda0dd },
{ "PowderBlue", 0xb0e0e6 },
{ "Purple", 0x800080 },
{ "RebeccaPurple", 0x663399 },
{ "Red", 0xff0000 },
{ "RosyBrown", 0xbc8f8f },
{ "RoyalBlue", 0x4169e1 },
{ "SaddleBrown", 0x8b4513 },
{ "Salmon", 0xfa8072 },
{ "SandyBrown", 0xf4a460 },
{ "SeaGreen", 0x2e8b57 },
{ "Seashell", 0xfff5ee },
{ "Sienna", 0xa0522d },
{ "Silver", 0xc0c0c0 },
{ "SkyBlue", 0x87ceeb },
{ "SlateBlue", 0x6a5acd },
{ "SlateGray", 0x708090 },
{ "SlateGrey", 0x708090 },
{ "Snow", 0xfffafa },
{ "SpringGreen", 0x00ff7f },
{ "SteelBlue", 0x4682b4 },
{ "Tan", 0xd2b48c },
{ "Teal", 0x008080 },
{ "Thistle", 0xd8bfd8 },
{ "Tomato", 0xff6347 },
|
| ︙ | ︙ | |||
4443 4444 4445 4446 4447 4448 4449 | ddx = -w*dy; ddy = w*dx; bx = f->x + e1*dx; by = f->y + e1*dy; pik_append_xy(p,"<polygon points=\"", t->x, t->y); pik_append_xy(p," ",bx-ddx, by-ddy); pik_append_xy(p," ",bx+ddx, by+ddy); | | | 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 | ddx = -w*dy; ddy = w*dx; bx = f->x + e1*dx; by = f->y + e1*dy; pik_append_xy(p,"<polygon points=\"", t->x, t->y); pik_append_xy(p," ",bx-ddx, by-ddy); pik_append_xy(p," ",bx+ddx, by+ddy); pik_append_clr(p,"\" style=\"fill:",pObj->color,"\"/>\n",0); pik_chop(f,t,h/2); } /* ** Compute the relative offset to an edge location from the reference for a ** an statement. */ |
| ︙ | ︙ | |||
4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 |
char buf[100];
snprintf(buf, sizeof(buf)-1, "%.10g,%.10g",
(double)pPt->x, (double)pPt->y);
buf[sizeof(buf)-1] = 0;
pik_append(p, z, -1);
pik_append(p, buf, -1);
}
/* Append a PNum value surrounded by text. Do coordinate transformations
** on the value.
*/
static void pik_append_x(Pik *p, const char *z1, PNum v, const char *z2){
char buf[200];
v -= p->bbox.sw.x;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 |
char buf[100];
snprintf(buf, sizeof(buf)-1, "%.10g,%.10g",
(double)pPt->x, (double)pPt->y);
buf[sizeof(buf)-1] = 0;
pik_append(p, z, -1);
pik_append(p, buf, -1);
}
/*
** Invert the RGB color so that it is appropriate for dark mode.
*/
static int pik_color_to_dark_mode(int x, int isBg){
int r, g, b;
int mn, mx;
x = 0xffffff - x;
r = (x>>16) & 0xff;
g = (x>>8) & 0xff;
b = x & 0xff;
mx = r;
if( g>mx ) mx = g;
if( b>mx ) mx = b;
mn = r;
if( g<mn ) mn = g;
if( b<mn ) mn = b;
r = mn + (mx-r);
g = mn + (mx-g);
b = mn + (mx-b);
if( isBg ){
if( mx>127 ){
r = (127*r)/mx;
g = (127*g)/mx;
b = (127*b)/mx;
}
}else{
if( mn<128 && mx>mn ){
r = 127 + ((r-mn)*128)/(mx-mn);
g = 127 + ((g-mn)*128)/(mx-mn);
b = 127 + ((b-mn)*128)/(mx-mn);
}
}
return r*0x10000 + g*0x100 + b;
}
/* Append a PNum value surrounded by text. Do coordinate transformations
** on the value.
*/
static void pik_append_x(Pik *p, const char *z1, PNum v, const char *z2){
char buf[200];
v -= p->bbox.sw.x;
|
| ︙ | ︙ | |||
4583 4584 4585 4586 4587 4588 4589 |
}
static void pik_append_dis(Pik *p, const char *z1, PNum v, const char *z2){
char buf[200];
snprintf(buf, sizeof(buf)-1, "%s%g%s", z1, p->rScale*v, z2);
buf[sizeof(buf)-1] = 0;
pik_append(p, buf, -1);
}
| | > > > > > > | | | | 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 |
}
static void pik_append_dis(Pik *p, const char *z1, PNum v, const char *z2){
char buf[200];
snprintf(buf, sizeof(buf)-1, "%s%g%s", z1, p->rScale*v, z2);
buf[sizeof(buf)-1] = 0;
pik_append(p, buf, -1);
}
static void pik_append_clr(Pik *p,const char *z1,PNum v,const char *z2,int bg){
char buf[200];
int x = (int)v;
int r, g, b;
if( x==0 && p->fgcolor>0 && !bg ){
x = p->fgcolor;
}else if( p->mFlags & PIKCHR_DARK_MODE ){
x = pik_color_to_dark_mode(x,bg);
}
r = (x>>16) & 0xff;
g = (x>>8) & 0xff;
b = x & 0xff;
snprintf(buf, sizeof(buf)-1, "%srgb(%d,%d,%d)%s", z1, r, g, b, z2);
buf[sizeof(buf)-1] = 0;
pik_append(p, buf, -1);
}
/* Append an SVG path A record:
**
|
| ︙ | ︙ | |||
4615 4616 4617 4618 4619 4620 4621 |
/* Append a style="..." text. But, leave the quote unterminated, in case
** the caller wants to add some more.
*/
static void pik_append_style(Pik *p, PObj *pObj, int bFill){
pik_append(p, " style=\"", -1);
if( pObj->fill>=0 && bFill ){
| | | | 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 |
/* Append a style="..." text. But, leave the quote unterminated, in case
** the caller wants to add some more.
*/
static void pik_append_style(Pik *p, PObj *pObj, int bFill){
pik_append(p, " style=\"", -1);
if( pObj->fill>=0 && bFill ){
pik_append_clr(p, "fill:", pObj->fill, ";",1);
}else{
pik_append(p,"fill:none;",-1);
}
if( pObj->sw>0.0 && pObj->color>=0.0 ){
PNum sw = pObj->sw;
pik_append_dis(p, "stroke-width:", sw, ";");
if( pObj->nPath>2 && pObj->rad<=pObj->sw ){
pik_append(p, "stroke-linejoin:round;", -1);
}
pik_append_clr(p, "stroke:",pObj->color,";",0);
if( pObj->dotted>0.0 ){
PNum v = pObj->dotted;
if( sw<2.1/p->rScale ) sw = 2.1/p->rScale;
pik_append_dis(p,"stroke-dasharray:",sw,"");
pik_append_dis(p,",",v,";");
}else if( pObj->dashed>0.0 ){
PNum v = pObj->dashed;
|
| ︙ | ︙ | |||
4880 4881 4882 4883 4884 4885 4886 |
if( t->eCode & TP_ITALIC ){
pik_append(p, " font-style=\"italic\"", -1);
}
if( t->eCode & TP_BOLD ){
pik_append(p, " font-weight=\"bold\"", -1);
}
if( pObj->color>=0.0 ){
| | | 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 |
if( t->eCode & TP_ITALIC ){
pik_append(p, " font-style=\"italic\"", -1);
}
if( t->eCode & TP_BOLD ){
pik_append(p, " font-weight=\"bold\"", -1);
}
if( pObj->color>=0.0 ){
pik_append_clr(p, " fill=\"", pObj->color, "\"",0);
}
xtraFontScale *= p->fontScale;
if( xtraFontScale<=0.99 || xtraFontScale>=1.01 ){
pik_append_num(p, " font-size=\"", xtraFontScale*100.0);
pik_append(p, "%\"", 2);
}
if( (t->eCode & TP_ALIGN)!=0 && pObj->nPath>=2 ){
|
| ︙ | ︙ | |||
6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 6844 6845 6846 |
if( pList==0 ) return;
if( p->nErr==0 ){
PNum thickness; /* Stroke width */
PNum margin; /* Extra bounding box margin */
PNum w, h; /* Drawing width and height */
PNum wArrow;
PNum pikScale; /* Value of the "scale" variable */
/* Set up rendering parameters */
pik_compute_layout_settings(p);
thickness = pik_value(p,"thickness",9,0);
if( thickness<=0.01 ) thickness = 0.01;
margin = pik_value(p,"margin",6,0);
margin += thickness;
wArrow = p->wArrow*thickness;
/* Compute a bounding box over all objects so that we can know
** how big to declare the SVG canvas */
pik_bbox_init(&p->bbox);
pik_bbox_add_elist(p, pList, wArrow);
/* Expand the bounding box slightly to account for line thickness
| > > > > > > > > | 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 6904 6905 6906 6907 6908 6909 |
if( pList==0 ) return;
if( p->nErr==0 ){
PNum thickness; /* Stroke width */
PNum margin; /* Extra bounding box margin */
PNum w, h; /* Drawing width and height */
PNum wArrow;
PNum pikScale; /* Value of the "scale" variable */
int miss = 0;
/* Set up rendering parameters */
pik_compute_layout_settings(p);
thickness = pik_value(p,"thickness",9,0);
if( thickness<=0.01 ) thickness = 0.01;
margin = pik_value(p,"margin",6,0);
margin += thickness;
wArrow = p->wArrow*thickness;
p->fgcolor = (int)pik_value(p,"fgcolor",7,&miss);
if( miss ){
PToken t;
t.z = "fgcolor";
t.n = 7;
p->fgcolor = (int)pik_lookup_color(0, &t);
}
/* Compute a bounding box over all objects so that we can know
** how big to declare the SVG canvas */
pik_bbox_init(&p->bbox);
pik_bbox_add_elist(p, pList, wArrow);
/* Expand the bounding box slightly to account for line thickness
|
| ︙ | ︙ | |||
7618 7619 7620 7621 7622 7623 7624 7625 7626 7627 7628 7629 7630 7631 |
*/
int main(int argc, char **argv){
int i;
int bSvgOnly = 0; /* Output SVG only. No HTML wrapper */
int bDontStop = 0; /* Continue in spite of errors */
int exitCode = 0; /* What to return */
int mFlags = 0; /* mFlags argument to pikchr() */
const char *zHtmlHdr =
"<!DOCTYPE html>\n"
"<html lang=\"en-US\">\n"
"<head>\n<title>PIKCHR Test</title>\n"
"<style>\n"
" .hidden {\n"
" position: absolute !important;\n"
| > | 7681 7682 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 7694 7695 |
*/
int main(int argc, char **argv){
int i;
int bSvgOnly = 0; /* Output SVG only. No HTML wrapper */
int bDontStop = 0; /* Continue in spite of errors */
int exitCode = 0; /* What to return */
int mFlags = 0; /* mFlags argument to pikchr() */
const char *zStyle = ""; /* Extra styling */
const char *zHtmlHdr =
"<!DOCTYPE html>\n"
"<html lang=\"en-US\">\n"
"<head>\n<title>PIKCHR Test</title>\n"
"<style>\n"
" .hidden {\n"
" position: absolute !important;\n"
|
| ︙ | ︙ | |||
7655 7656 7657 7658 7659 7660 7661 7662 7663 7664 7665 7666 7667 7668 |
if( argv[i][0]=='-' ){
char *z = argv[i];
z++;
if( z[0]=='-' ) z++;
if( strcmp(z,"dont-stop")==0 ){
bDontStop = 1;
}else
if( strcmp(z,"svg-only")==0 ){
if( zHtmlHdr==0 ){
fprintf(stderr, "the \"%s\" option must come first\n",argv[i]);
exit(1);
}
bSvgOnly = 1;
| > > > > | 7719 7720 7721 7722 7723 7724 7725 7726 7727 7728 7729 7730 7731 7732 7733 7734 7735 7736 |
if( argv[i][0]=='-' ){
char *z = argv[i];
z++;
if( z[0]=='-' ) z++;
if( strcmp(z,"dont-stop")==0 ){
bDontStop = 1;
}else
if( strcmp(z,"dark-mode")==0 ){
zStyle = "color:white;background-color:black;";
mFlags |= PIKCHR_DARK_MODE;
}else
if( strcmp(z,"svg-only")==0 ){
if( zHtmlHdr==0 ){
fprintf(stderr, "the \"%s\" option must come first\n",argv[i]);
exit(1);
}
bSvgOnly = 1;
|
| ︙ | ︙ | |||
7704 7705 7706 7707 7708 7709 7710 |
zHtmlHdr = 0;
}
printf("<h1>File %s</h1>\n", argv[i]);
if( w<0 ){
printf("<p>ERROR</p>\n%s\n", zOut);
}else{
printf("<div id=\"svg-%d\" onclick=\"toggleHidden('svg-%d')\">\n",i,i);
| | > | 7772 7773 7774 7775 7776 7777 7778 7779 7780 7781 7782 7783 7784 7785 7786 7787 |
zHtmlHdr = 0;
}
printf("<h1>File %s</h1>\n", argv[i]);
if( w<0 ){
printf("<p>ERROR</p>\n%s\n", zOut);
}else{
printf("<div id=\"svg-%d\" onclick=\"toggleHidden('svg-%d')\">\n",i,i);
printf("<div style='border:3px solid lightgray;max-width:%dpx;%s'>\n",
w,zStyle);
printf("%s</div>\n", zOut);
printf("<pre class='hidden'>");
print_escape_html(zIn);
printf("</pre>\n</div>\n");
}
}
free(zOut);
|
| ︙ | ︙ | |||
7781 7782 7783 7784 7785 7786 7787 | return TCL_OK; } #endif /* PIKCHR_TCL */ | | | 7850 7851 7852 7853 7854 7855 7856 7857 | return TCL_OK; } #endif /* PIKCHR_TCL */ #line 7882 "pikchr.c" |
Changes to src/pikchrshow.c.
| ︙ | ︙ | |||
20 21 22 23 24 25 26 | #include "config.h" #include <assert.h> #include <ctype.h> #include "pikchrshow.h" #if INTERFACE /* These are described in pikchr_process()'s docs. */ | > | | | | | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #include "config.h" #include <assert.h> #include <ctype.h> #include "pikchrshow.h" #if INTERFACE /* These are described in pikchr_process()'s docs. */ #define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */ #define PIKCHR_PROCESS_TH1 0x0004 #define PIKCHR_PROCESS_TH1_NOSVG 0x0008 #define PIKCHR_PROCESS_NONCE 0x0010 #define PIKCHR_PROCESS_ERR_PRE 0x0020 #define PIKCHR_PROCESS_SRC 0x0040 #define PIKCHR_PROCESS_DIV 0x0080 #define PIKCHR_PROCESS_DIV_INDENT 0x0100 #define PIKCHR_PROCESS_DIV_CENTER 0x0200 #define PIKCHR_PROCESS_DIV_FLOAT_LEFT 0x0400 #define PIKCHR_PROCESS_DIV_FLOAT_RIGHT 0x0800 #define PIKCHR_PROCESS_DIV_TOGGLE 0x1000 #define PIKCHR_PROCESS_DIV_SOURCE 0x2000 #define PIKCHR_PROCESS_DIV_SOURCE_INLINE 0x4000 |
| ︙ | ︙ | |||
157 158 159 160 161 162 163 |
if(PIKCHR_PROCESS_TH1_NOSVG & pikFlags){
blob_append(pOut, blob_str(&bIn), blob_size(&bIn));
}else{
int w = 0, h = 0;
const char * zContent = blob_str(&bIn);
char *zOut;
zOut = pikchr(zContent, "pikchr",
| | | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
if(PIKCHR_PROCESS_TH1_NOSVG & pikFlags){
blob_append(pOut, blob_str(&bIn), blob_size(&bIn));
}else{
int w = 0, h = 0;
const char * zContent = blob_str(&bIn);
char *zOut;
zOut = pikchr(zContent, "pikchr",
0x01 | (pikFlags&PIKCHR_PROCESS_PASSTHROUGH),
&w, &h);
if( w>0 && h>0 ){
const char * zClassToggle = "";
const char * zClassSource = "";
const char * zWrapperClass = "";
if(PIKCHR_PROCESS_DIV & pikFlags){
if(PIKCHR_PROCESS_DIV_CENTER & pikFlags){
|
| ︙ | ︙ |
Changes to src/security_audit.c.
| ︙ | ︙ | |||
577 578 579 580 581 582 583 584 585 586 587 588 589 590 |
@ <li><p>\
@ There exists public phantom artifacts in this repository, shown below.
@ Phantom artifacts are artifacts whose hash name is referenced by some
@ other artifact but whose content is unknown. Some phantoms are marked
@ private and those are ignored. But public phantoms cause unnecessary
@ sync traffic and might represent malicious attempts to corrupt the
@ repository structure.
@ </p>
table_of_public_phantoms();
@ </li>
}
@ </ol>
style_finish_page("secaudit");
| > > > > > > | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
@ <li><p>\
@ There exists public phantom artifacts in this repository, shown below.
@ Phantom artifacts are artifacts whose hash name is referenced by some
@ other artifact but whose content is unknown. Some phantoms are marked
@ private and those are ignored. But public phantoms cause unnecessary
@ sync traffic and might represent malicious attempts to corrupt the
@ repository structure.
@ </p><p>
@ To suppress unnecessary sync traffic caused by phantoms, add the RID
@ of each phantom to the "private" table. Example:
@ <blockquote><pre>
@ INSERT INTO private SELECT rid FROM blob WHERE content IS NULL;
@ </pre></blockquote>
@ </p>
table_of_public_phantoms();
@ </li>
}
@ </ol>
style_finish_page("secaudit");
|
| ︙ | ︙ |
Changes to src/skins.c.
| ︙ | ︙ | |||
83 84 85 86 87 88 89 |
**
** The following array holds the value for all known skin details.
*/
static struct SkinDetail {
const char *zName; /* Name of the detail */
const char *zValue; /* Value of the detail */
} aSkinDetail[] = {
| > | | | | | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
**
** The following array holds the value for all known skin details.
*/
static struct SkinDetail {
const char *zName; /* Name of the detail */
const char *zValue; /* Value of the detail */
} aSkinDetail[] = {
{ "pikchr-foreground", "" },
{ "timeline-arrowheads", "1" },
{ "timeline-circle-nodes", "0" },
{ "timeline-color-graph-lines", "0" },
{ "white-foreground", "0" },
};
/*
** Invoke this routine to set the alternative skin. Return NULL if the
** alternative was successfully installed. Return a string listing all
** available skins if zName does not match an available skin. Memory
** for the returned string comes from fossil_malloc() and should be freed
|
| ︙ | ︙ |
Changes to src/stat.c.
| ︙ | ︙ | |||
333 334 335 336 337 338 339 |
|| (z = db_get("short-project-name",0))!=0
){
fossil_print("%*s%s\n", colWidth, "project-name:", z);
}
fsize = file_size(g.zRepositoryName, ExtFILE);
fossil_print( "%*s%,lld bytes\n", colWidth, "repository-size:", fsize);
if( !brief ){
| | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
|| (z = db_get("short-project-name",0))!=0
){
fossil_print("%*s%s\n", colWidth, "project-name:", z);
}
fsize = file_size(g.zRepositoryName, ExtFILE);
fossil_print( "%*s%,lld bytes\n", colWidth, "repository-size:", fsize);
if( !brief ){
n = db_int(0, "SELECT count(*) FROM blob WHERE content IS NOT NULL");
m = db_int(0, "SELECT count(*) FROM delta");
fossil_print("%*s%,d (stored as %,d full text and %,d deltas)\n",
colWidth, "artifact-count:",
n, n-m, m);
if( n>0 ){
int a, b;
Stmt q;
|
| ︙ | ︙ | |||
374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='w'");
fossil_print("%*s%,d (%,d changes)\n", colWidth, "wiki-pages:", n, m);
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
" WHERE tagname GLOB 'tkt-*'");
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='t'");
fossil_print("%*s%,d (%,d changes)\n", colWidth, "tickets:", n, m);
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
fossil_print("%*s%,d\n", colWidth, "events:", n);
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
fossil_print("%*s%,d\n", colWidth, "tag-changes:", n);
z = db_text(0, "SELECT datetime(mtime) || ' - about ' ||"
" CAST(julianday('now') - mtime AS INTEGER)"
" || ' days ago' FROM event "
" ORDER BY mtime DESC LIMIT 1");
| > > > > > > > > > | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='w'");
fossil_print("%*s%,d (%,d changes)\n", colWidth, "wiki-pages:", n, m);
n = db_int(0, "SELECT count(*) FROM tag /*scan*/"
" WHERE tagname GLOB 'tkt-*'");
m = db_int(0, "SELECT COUNT(*) FROM event WHERE type='t'");
fossil_print("%*s%,d (%,d changes)\n", colWidth, "tickets:", n, m);
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='e'");
if( db_table_exists("repository","forumpost") ){
n = db_int(0, "SELECT count(*) FROM forumpost/*scan*/");
if( n>0 ){
int nThread = db_int(0, "SELECT count(*) FROM forumpost"
" WHERE froot=fpid");
fossil_print("%*s%,d (on %,d threads)\n", colWidth, "forum-posts:",
n, nThread);
}
}
fossil_print("%*s%,d\n", colWidth, "events:", n);
n = db_int(0, "SELECT COUNT(*) FROM event WHERE type='g'");
fossil_print("%*s%,d\n", colWidth, "tag-changes:", n);
z = db_text(0, "SELECT datetime(mtime) || ' - about ' ||"
" CAST(julianday('now') - mtime AS INTEGER)"
" || ' days ago' FROM event "
" ORDER BY mtime DESC LIMIT 1");
|
| ︙ | ︙ |
Changes to www/caps/index.md.
| ︙ | ︙ | |||
254 255 256 257 258 259 260 | get a complete clone, including the parent repo’s complete user table. All of the above applies to [login groups][lg] as well. ## <a name="webonly"></a>Caps Affect Web Interfaces Only | > | | > < > | > > > > > > | | > > | | | | | > > | > | | | | | > | > > | > | | > > > | > | | > | | | < | < | | > > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
get a complete clone, including the parent repo’s complete user table.
All of the above applies to [login groups][lg] as well.
## <a name="webonly"></a>Caps Affect Web Interfaces Only
Fossil’s user capability system only affects accesses over `http[s]://`
URLs. This includes clone, sync/push/pull, the [UI pages][wp], and [the
JSON API][japi]. For everything else, the user caps aren’t consulted at
all.
The only checks made when working directly with a local repository are
the operating system’s file system permissions. This should strike you
as sensible, since if you have local file access to the repository, you
can do anything you want to that repo DB including adding a
[**Setup**][s] user for yourself, after which Fossil’s user capability
system is effectively bypassed. This is why the `fossil ui` command
gives you Setup permissions within Fossil UI: it can’t usefully prevent
you from doing anything through the UI since only the local file system
permissions actually matter.
What may be more surprising to you is that this is also true when
working on a *clone* done over a local file path, except that there are
then two sets of file system permission checks: once to modify the
working check-out’s repo clone DB file, then again on [sync][sync] with
the parent DB file. The Fossil capability checks are effectively
defeated because your user has [**Setup**][s] capability on both sides
of the sync. Be aware that those file checks do still matter, however:
Fossil requires write access to a repo DB while cloning from it, so you
can’t clone from a read-only repo DB file over a local file path.
Even more surprising may be the fact that user caps do not affect
cloning and syncing over SSH! When you make a change to such a
repository, the change first goes to the local clone where file system
permissions are all that matter, but then upon sync, the situation is
effectively the same as when the parent repo is on the local file
system. The reason behind this is that if you can log into the remote
system over SSH and that user has the necessary file system permissions
on that remote repo DB file to allow clone and sync operations, then
we’re back in the same situation as with local files: there’s no point
trying to enforce the Fossil user capabilities when you can just modify
the remote DB directly, so the operation proceeds unimpeded.
Where this gets confusing is that *all* Fossil syncs are done over the
HTTP protocol, including those done over `file://` and `ssh://` URLs,
not just those done over `http[s]://` URLs:
* For `ssh://` URLs, Fossil pipes the HTTP conversation through a
local SSH client to a remote instance of Fossil running the
[`test-http`](/help?name=test-http) command to receive the tunneled
HTTP connection. The reason Fossil’s user capability system is
bypassed in this case is that [`test-http` gives full capabilities
to its users][sxcap].
The SSH client command defaults to “`ssh -e none -T`” on most
platforms except Windows where it defaults to “`plink -ssh -T`”.
You can override this with [the `ssh-command`
setting](/help?name=ssh-command).
* For `file://` URLs — as opposed to plain local file paths —
the “sending” Fossil instance writes its side of
the HTTP conversation out to a temporary file in the same directory
as the local repo clone and then calls itself on the “receiving”
repository to read that same HTTP transcript file back in to apply
those changes to that repository. Presumably Fossil does this
instead of using a pipe to ease portability to Windows.
Checks for capabilities like [**Read**][o] and [**Write**][i] within the
HTTP conversation between two Fossil instances only have a useful effect
when done over an `http[s]://` URL.
[sxcap]: https://fossil-scm.org/home/file?ci=8813ae91a699ac73&name=src%2Fmain.c&ln=2632-2637
## <a name="pubpg"></a>Public Pages
In Admin → Access, there is an option for giving a list of [globs][glob]
to name URLs which get treated as if the visitor had [the default cap
set](#defcap). For example, you could take the [**Read**][o] capability
|
| ︙ | ︙ |
Changes to www/customskin.md.
| ︙ | ︙ | |||
167 168 169 170 171 172 173 174 175 176 177 178 179 | <dt><b>details.txt</b><dt><dd> <p>The details.txt file is short list of settings that control the look and feel, mostly of the timeline. The default details.txt file looks like this: <blockquote><pre> timeline-arrowheads: 1 timeline-circle-nodes: 1 timeline-color-graph-lines: 1 white-foreground: 0 </pre></blockquote> | > | | > > > > > > > | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | <dt><b>details.txt</b><dt><dd> <p>The details.txt file is short list of settings that control the look and feel, mostly of the timeline. The default details.txt file looks like this: <blockquote><pre> pikchr-foreground: "" timeline-arrowheads: 1 timeline-circle-nodes: 1 timeline-color-graph-lines: 1 white-foreground: 0 </pre></blockquote> The three "timeline-" settings in details.txt control the appearance of certain aspects of the timeline graph. The number on the right is a boolean - "1" to activate the feature and "0" to disable it. The "white-foreground:" setting should be set to "1" if the page color has light-color text on a darker background, and "0" if the page has dark text on a light-colored background. <p> If the "pikchr-foreground" setting (only available in Fossil 2.14 and later) is defined and is not an empty string then it specifies a foreground color to use for [pikchr diagrams](./pikchr.md). The default pikchr foreground color is black, or white if the "white-foreground" boolean is set. </dd> <dt><b>footer.txt</b> and <b>header.txt</b></dt><dd> <p>The footer.txt and header.txt files contain the Content Footer and Content Header respectively. Of these, the Content Header is the most important, as it contains the markup used to generate the banner and menu bar for each page. |
| ︙ | ︙ |
Changes to www/delta_format.wiki.
| ︙ | ︙ | |||
93 94 95 96 97 98 99 |
reading the first line of the delta and decoding the number found
there. In other words, before it has to decode everything else.</p>
<a name="trailer"></a><h2>2.2 Trailer</h2>
<verbatim type="pikchr">
leftmargin = 0.1
box height 50% "Checksum"
| | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
reading the first line of the delta and decoding the number found
there. In other words, before it has to decode everything else.</p>
<a name="trailer"></a><h2>2.2 Trailer</h2>
<verbatim type="pikchr">
leftmargin = 0.1
box height 50% "Checksum"
box same "\";\""
</verbatim>
<p>The trailer consists of a single number followed by a semicolon (ASCII
0x3b). This number is a checksum of the target and can be used by a
decoder to verify that the delta applied correctly, reconstructing the
target from the original.</p>
|
| ︙ | ︙ |
Changes to www/gitusers.md.
| ︙ | ︙ | |||
793 794 795 796 797 798 799 |
critical:
1. It’s a bit cryptic. Leave off the refname or punctuation, and it
means something else. You cannot simplify the cryptic incantation in
the typical use case.
2. A date string in Git without a time will be interpreted as
| | | > | | | | | 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 |
critical:
1. It’s a bit cryptic. Leave off the refname or punctuation, and it
means something else. You cannot simplify the cryptic incantation in
the typical use case.
2. A date string in Git without a time will be interpreted as
“[at the local wall clock time on the given date][gapxd],” so the
command means something different from one second to the next. This
can be a problem if there are multiple commits on that date, because
the command will give diffferent results depending on the time of
day you run it.
3. It gives misleading output if there is no close match for the date
in the local [reflog]. It starts out empty after a fresh clone, and
while it does build up as you use that clone, Git [automatically
prunes][gle] the reflog to 90 days of history by default. This means
the command above can give different results from one machine to the
next, or even from one day to the next on the same clone.
The command won’t fail outright if the reflog can’t resolve the
given date: it simply gives the closest commit it can come up with,
even if it’s months or years out from your target! Sometimes it
|
| ︙ | ︙ |
Changes to www/inout.wiki.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | The --git option is not actually required. The git-fast-export file format is currently the only VCS interchange format that Fossil understands. But future versions of Fossil might be enhanced to understand other VCS interchange formats, and so for compatibility, use of the --git option is recommended. <h2>Fossil → Git</h2> To convert a Fossil repository into a Git repository, run commands like this: <blockquote><pre> git init new-repo | > > > > > > > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | The --git option is not actually required. The git-fast-export file format is currently the only VCS interchange format that Fossil understands. But future versions of Fossil might be enhanced to understand other VCS interchange formats, and so for compatibility, use of the --git option is recommended. <a name="fx_git"></a> Note that in new imports, Fossil defaults to using the email component of the Git <em>committer</em> (or <em>author</em> if <code>--use-author</code> is passed) to attribute check-ins in the imported repository. Alternatively, the [/help?cmd=import | <code>--attribute</code>] option can be passed to have all commits by a given committer attributed to a desired username. This will create and populate the new <code>fx_git</code> table in the repository database to maintain a record of correspondent usernames and email addresses that can be used in subsequent exports or incremental imports. <h2>Fossil → Git</h2> To convert a Fossil repository into a Git repository, run commands like this: <blockquote><pre> git init new-repo |
| ︙ | ︙ |
Changes to www/mirrortogithub.md.
| ︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
* There is a
[long list of restrictions](https://git-scm.com/docs/git-check-ref-format)
on tag and branch names in Git. If any of your Fossil tag or branch names
violate these rules, then the names are translated prior to being exported
to Git. The translation usually involves converting the offending characters
into underscores.
<a name='ex1'></a>
## Example GitHub Mirrors
As of this writing (2019-03-16) Fossil’s own repository is mirrored
on GitHub at:
| > > > > > > > > > > > > > > > > > | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
* There is a
[long list of restrictions](https://git-scm.com/docs/git-check-ref-format)
on tag and branch names in Git. If any of your Fossil tag or branch names
violate these rules, then the names are translated prior to being exported
to Git. The translation usually involves converting the offending characters
into underscores.
* If your Fossil user contact info is not set and this repository was not
initially [imported from Git](./inout.wiki), `fossil git export` will
construct a generic `user@noemail.net` for the Git *committer* and *author*
email fields of each commit. However, Fossil will first attempt to parse an
email address from your user contact info, which can be set through a
Fossil [UI][ui] browser window or with the [`user contact`][usercmd]
subcommand on the command line. Alternatively, if this repository was
previously imported from Git using the [`--attribute`][attr] option, the
[`fx_git`][fxgit] table will be queried for correspondent email addresses.
Only if neither of these methods produce a user specified email will the
abovementioned generic address be used.
[attr]: /help?cmd=import
[fxgit]: ./inout.wiki#fx_git
[ui]: /help?cmd=ui
[usercmd]: /help?cmd=user
<a name='ex1'></a>
## Example GitHub Mirrors
As of this writing (2019-03-16) Fossil’s own repository is mirrored
on GitHub at:
|
| ︙ | ︙ |
Changes to www/mkindex.tcl.
| ︙ | ︙ | |||
98 99 100 101 102 103 104 |
sync.wiki {The Fossil Sync Protocol}
tech_overview.wiki {A Technical Overview Of The Design And Implementation
Of Fossil}
tech_overview.wiki {SQLite Databases Used By Fossil}
th1.md {The TH1 Scripting Language}
tickets.wiki {The Fossil Ticket System}
theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
| < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
sync.wiki {The Fossil Sync Protocol}
tech_overview.wiki {A Technical Overview Of The Design And Implementation
Of Fossil}
tech_overview.wiki {SQLite Databases Used By Fossil}
th1.md {The TH1 Scripting Language}
tickets.wiki {The Fossil Ticket System}
theory1.wiki {Thoughts On The Design Of The Fossil DVCS}
unvers.wiki {Unversioned Files}
webpage-ex.md {Webpage Examples}
webui.wiki {The Fossil Web Interface}
whyusefossil.wiki {Why You Should Use Fossil}
whyusefossil.wiki {Benefits Of Version Control}
wikitheory.wiki {Wiki In Fossil}
/wiki_rules {Wiki Formatting Rules}
|
| ︙ | ︙ |
Changes to www/permutedindex.html.
| ︙ | ︙ | |||
174 175 176 177 178 179 180 | <li><a href="aboutcgi.wiki"><b>How CGI Works In Fossil</b></a></li> <li><a href="aboutdownload.wiki"><b>How The Download Page Works</b></a></li> <li><a href="server/"><b>How To Configure A Fossil Server</b></a></li> <li><a href="newrepo.wiki"><b>How To Create A New Fossil Repository</b></a></li> <li><a href="mirrortogithub.md"><b>How To Mirror A Fossil Repository On GitHub</b></a></li> <li><a href="encryptedrepos.wiki"><b>How To Use Encrypted Repositories</b></a></li> <li><a href="hacker-howto.wiki">How-To — Hacker</a></li> | < | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | <li><a href="aboutcgi.wiki"><b>How CGI Works In Fossil</b></a></li> <li><a href="aboutdownload.wiki"><b>How The Download Page Works</b></a></li> <li><a href="server/"><b>How To Configure A Fossil Server</b></a></li> <li><a href="newrepo.wiki"><b>How To Create A New Fossil Repository</b></a></li> <li><a href="mirrortogithub.md"><b>How To Mirror A Fossil Repository On GitHub</b></a></li> <li><a href="encryptedrepos.wiki"><b>How To Use Encrypted Repositories</b></a></li> <li><a href="hacker-howto.wiki">How-To — Hacker</a></li> <li><a href="fossil-from-msvc.wiki">IDE — Integrating Fossil in the Microsoft Express 2010</a></li> <li><a href="hashes.md">Identification — Hashes: Fossil Artifact</a></li> <li><a href="image-format-vs-repo-size.md"><b>Image Format vs Fossil Repo Size</b></a></li> <li><a href="tech_overview.wiki">Implementation Of Fossil — A Technical Overview Of The Design And</a></li> <li><a href="inout.wiki"><b>Import And Export To And From Git</b></a></li> <li><a href="build.wiki">Installing Fossil — Compiling and</a></li> <li><a href="fossil-from-msvc.wiki"><b>Integrating Fossil in the Microsoft Express 2010 IDE</b></a></li> |
| ︙ | ︙ | |||
205 206 207 208 209 210 211 | <li><a href="fiveminutes.wiki">Minutes as a Single User — Up and Running in 5</a></li> <li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub — How To</a></li> <li><a href="mirrorlimitations.md">Mirrors — Limitations On Git</a></li> <li><a href="globs.md">Name Glob Patterns — File</a></li> <li><a href="checkin_names.wiki">Names — Check-in And Version</a></li> <li><a href="adding_code.wiki">New Features To Fossil — Adding</a></li> <li><a href="newrepo.wiki">New Fossil Repository — How To Create A</a></li> | < | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | <li><a href="fiveminutes.wiki">Minutes as a Single User — Up and Running in 5</a></li> <li><a href="mirrortogithub.md">Mirror A Fossil Repository On GitHub — How To</a></li> <li><a href="mirrorlimitations.md">Mirrors — Limitations On Git</a></li> <li><a href="globs.md">Name Glob Patterns — File</a></li> <li><a href="checkin_names.wiki">Names — Check-in And Version</a></li> <li><a href="adding_code.wiki">New Features To Fossil — Adding</a></li> <li><a href="newrepo.wiki">New Fossil Repository — How To Create A</a></li> <li><a href="alerts.md">Notifications — Email Alerts And</a></li> <li><a href="foss-cklist.wiki">Open-Source Projects — Checklist For Successful</a></li> <li><a href="pop.wiki">Operation — Principles Of</a></li> <li><a href="cgi.wiki">Options — CGI Script Configuration</a></li> <li><a href="env-opts.md">Options — Environment Variables and Global</a></li> <li><a href="tech_overview.wiki">Overview Of The Design And Implementation Of Fossil — A Technical</a></li> <li><a href="index.wiki">Page — Home</a></li> |
| ︙ | ︙ | |||
233 234 235 236 237 238 239 | <li><a href="makefile.wiki">Process — The Fossil Build</a></li> <li><a href="contribute.wiki">Project — Contributing Code or Documentation To The Fossil</a></li> <li><a href="embeddeddoc.wiki">Project Documentation — Embedded</a></li> <li><a href="foss-cklist.wiki">Projects — Checklist For Successful Open-Source</a></li> <li><a href="childprojects.wiki">Projects — Child</a></li> <li><a href="fossil_prompt.wiki">Prompt — Fossilized Bash</a></li> <li><a href="sync.wiki">Protocol — The Fossil Sync</a></li> | < | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | <li><a href="makefile.wiki">Process — The Fossil Build</a></li> <li><a href="contribute.wiki">Project — Contributing Code or Documentation To The Fossil</a></li> <li><a href="embeddeddoc.wiki">Project Documentation — Embedded</a></li> <li><a href="foss-cklist.wiki">Projects — Checklist For Successful Open-Source</a></li> <li><a href="childprojects.wiki">Projects — Child</a></li> <li><a href="fossil_prompt.wiki">Prompt — Fossilized Bash</a></li> <li><a href="sync.wiki">Protocol — The Fossil Sync</a></li> <li><a href="history.md">Purpose And History Of Fossil — The</a></li> <li><a href="faq.wiki">Questions — Frequently Asked</a></li> <li><a href="qandc.wiki"><b>Questions And Criticisms</b></a></li> <li><a href="quickstart.wiki">Quick Start Guide — Fossil</a></li> <li><a href="quotes.wiki"><b>Quotes: What People Are Saying About Fossil, Git, and DVCSes in General</b></a></li> <li><a href="rebaseharm.md"><b>Rebase Considered Harmful</b></a></li> <li><a href="caps/ref.html">Reference — User Capability</a></li> |
| ︙ | ︙ | |||
325 326 327 328 329 330 331 | <li><a href="caps/admin-v-setup.md">Users — Differences Between Setup and Admin</a></li> <li><a href="serverext.wiki">Using CGI Scripts — Adding Extensions To A Fossil Server</a></li> <li><a href="ssl.wiki"><b>Using SSL with Fossil</b></a></li> <li><a href="env-opts.md">Variables and Global Options — Environment</a></li> <li><a href="whyusefossil.wiki">Version Control — Benefits Of</a></li> <li><a href="checkin_names.wiki">Version Names — Check-in And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> | < | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | <li><a href="caps/admin-v-setup.md">Users — Differences Between Setup and Admin</a></li> <li><a href="serverext.wiki">Using CGI Scripts — Adding Extensions To A Fossil Server</a></li> <li><a href="ssl.wiki"><b>Using SSL with Fossil</b></a></li> <li><a href="env-opts.md">Variables and Global Options — Environment</a></li> <li><a href="whyusefossil.wiki">Version Control — Benefits Of</a></li> <li><a href="checkin_names.wiki">Version Names — Check-in And</a></li> <li><a href="fossil-v-git.wiki">Versus Git — Fossil</a></li> <li><a href="image-format-vs-repo-size.md">vs Fossil Repo Size — Image Format</a></li> <li><a href="grep.md">vs POSIX grep — Fossil grep</a></li> <li><a href="webui.wiki">Web Interface — The Fossil</a></li> <li><a href="customskin.md">Web Pages — Theming: Customizing The Appearance of</a></li> <li><a href="webpage-ex.md"><b>Webpage Examples</b></a></li> <li><a href="../../../help">Webpages — Lists of Commands and</a></li> <li><a href="quotes.wiki">What People Are Saying About Fossil, Git, and DVCSes in General — Quotes:</a></li> |
| ︙ | ︙ |
Changes to www/server/debian/nginx.md.
1 2 3 4 5 6 7 8 | # Serving via nginx on Debian and Ubuntu This document is an extension of [the platform-independent SCGI instructions][scgii], which may suffice for your purposes if your needs are simple. Here, we add more detailed information on nginx itself, plus details about running it on Debian type OSes. We focus on Debian 10 (Buster) and | | | | | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Serving via nginx on Debian and Ubuntu This document is an extension of [the platform-independent SCGI instructions][scgii], which may suffice for your purposes if your needs are simple. Here, we add more detailed information on nginx itself, plus details about running it on Debian type OSes. We focus on Debian 10 (Buster) and Ubuntu 20.04 here, which are common Tier 1 OS offerings for [virtual private servers][vps] at the time of writing. This material may not work for older OSes. It is known in particular to not work as given for Debian 9 and older! We also cover adding TLS to the basic configuration, because several details depend on the host OS and web stack details. Besides, TLS is widely considered part of the baseline configuration these days. [scgii]: ../any/scgi.md [vps]: https://en.wikipedia.org/wiki/Virtual_private_server ## <a name="benefits"></a>Benefits This scheme is considerably more complicated than the [standalone HTTP server](../any/none.md) and [CGI options](../any/cgi.md). Even with the |
| ︙ | ︙ | |||
33 34 35 36 37 38 39 |
can’t scale with nginx is very low.
To give you some idea of the sort of thing you can readily
accomplish with nginx, your author runs a single public web server
that provides transparent name-based virtual hosting for four
separate domains:
| | | | | | | | | | > > > > > < < < < < < < > > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
can’t scale with nginx is very low.
To give you some idea of the sort of thing you can readily
accomplish with nginx, your author runs a single public web server
that provides transparent name-based virtual hosting for four
separate domains:
* <p>One is entirely static, not involving any dynamic content or
Fossil integration at all.</p>
* <p>Another is served almost entirely by Fossil, with a few select
static content exceptions punched past Fossil, which are handled
entirely via nginx.</p>
* <p>The other two domains are aliases for one another — e.g.
`example.com` and `example.net` — with most of the content being
static. This pair of domains has several unrelated Fossil repo
proxies attached to various sections of the URI hierarchy.</p>
By using nginx, I was able to do all of the above with minimal
repetition between the site configurations.
* **Integration** — Because nginx is so popular, it integrates with
many different technologies, and many other systems integrate with it in
turn. This makes it great middleware, sitting between the outer web
world and interior site services like Fossil. It allows Fossil to
participate seamlessly as part of a larger web stack.
* **Availability** — nginx is already in most operating system binary
package repositories, so you don’t need to go out of your way to get it.
## <a name="modes"></a>Fossil Service Modes
Fossil provides four major ways to access a repository it’s serving
remotely, three of which are straightforward to use with nginx:
* **HTTP** — Fossil has [a built-in HTTP server](../any/none.md).
While this method is efficient and it’s
possible to use nginx to proxy access to another HTTP server, we
don’t see any particularly good reason to make nginx reinterpret
Fossil’s own implementation of HTTP when we have a better option.
(But see [below](#http).)
* **SSH** — This method exists primarily to avoid the need for HTTPS,
but we *want* HTTPS. (We’ll get to that [below](#tls).)
There is probably a way to get nginx to proxy Fossil to HTTPS via
SSH, but it would be pointlessly complicated.
* **CGI** — This method is simple but inefficient, because it launches
a separate Fossil instance on every HTTP hit.
Since Fossil is a relatively small self-contained program, and it’s
designed to start up quickly, this method can work well in a
surprisingly large number of cases.
Nevertheless, we will avoid this option in this document because
we’re already buying into a certain amount of complexity here in
order to gain power. There’s no sense in throwing away any of that
hard-won performance on CGI overhead.
* **SCGI** — The [SCGI protocol][scgip] provides the simplicity of CGI
without its performance problems.
SCGI it is, then.
[scgip]: https://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface
## <a name="deps"></a>Installing the Dependencies
The first step is to install some non-default packages we’ll need. SSH into
your server, then say:
$ sudo apt install fossil nginx
You can leave “`fossil`” out of that if you’re building Fossil from
source to get a more up-to-date version than is shipped with the host
OS.
## <a name="scgi"></a>Running Fossil in SCGI Mode
For the following nginx configuration to work, it needs to contact a
Fossil instance speaking the SCGI protocol. There are [many ways](../)
to set that up. For Debian type systems, we recommend
|
| ︙ | ︙ | |||
188 189 190 191 192 193 194 |
the `access_log` and `error_log` directives, which follow an obvious
pattern from one host to the next. Sadly, you must tolerate some
repetition across `server { }` blocks when setting up multiple domains
on a single server.
The configuration for `foo.net` is similar.
| | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 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 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 |
the `access_log` and `error_log` directives, which follow an obvious
pattern from one host to the next. Sadly, you must tolerate some
repetition across `server { }` blocks when setting up multiple domains
on a single server.
The configuration for `foo.net` is similar.
See [the nginx docs](https://nginx.org/en/docs/) for more ideas.
## <a name="http"></a>Proxying HTTP Anyway
[Above](#modes), we argued that proxying SCGI is a better option than
making nginx reinterpret Fossil’s own implementation of HTTP. If you
want Fossil to speak HTTP, just [set Fossil up as a standalone
server](../any/none.md). And if you want nginx to [provide TLS
encryption for Fossil](#tls), proxying HTTP instead of SCGI provides no
benefit.
However, it is still worth showing the proper method of proxying
Fossil’s HTTP server through nginx if only to make reading nginx
documentation on other sites easier:
location /code {
rewrite ^/code(/.*) $1 break;
proxy_pass http://127.0.0.1:12345;
}
The most common thing people get wrong when hand-rolling a configuration
like this is to get the slashes wrong. Fossil is sensitive to this. For
instance, Fossil will not collapse double slashes down to a single
slash, as some other HTTP servers will.
## <a name="fail2ban"></a> Integrating `fail2ban`
You can have `fail2ban` recognize attacks and automatically block them,
but the stock configuration doesn’t work with our Fossil setup above, so
we have to do a bit of local adjustment.
First, install it:
sudo apt install fail2ban
Out of the box, you get SSH monitoring only. There are nginx monitors
included with the package, but they don’t look in the right places for
the right things. We’d like it to react to Fossil `/login` failures, for
example. Put the following into
`/etc/fail2ban/filter.d/nginx-fossil-login.conf`:
[Definition]
failregex = ^<HOST> - .*POST .*/login HTTP/..." 401
That teaches `fail2ban` how to recognize the errors logged by Fossil
[as of 2.14](/info/39d7eb0e22). (Earlier versions of Fossil returned
HTTP status code 200 for this, so you couldn’t distinguish a successful
login from a failure.)
Then in `/etc/fail2ban/jail.local`, add this section:
[nginx-fossil-login]
enabled = true
logpath = /var/log/nginx/*-https-access.log
The last line is the key: it tells `fail2ban` where we’ve put all of our
per-repo access logs in the nginx config above.
There’s a [lot more you can do][dof2b], but that gets us out of scope of
this guide.
[dof2b]: https://www.digitalocean.com/community/tutorials/how-to-protect-an-nginx-server-with-fail2ban-on-ubuntu-14-04
## <a name="tls"></a> Adding TLS (HTTPS) Support
One of the [many ways](../../ssl.wiki) to provide TLS-encrypted HTTP access
(a.k.a. HTTPS) to Fossil is to run it behind a web proxy that supports
TLS. One such option is nginx on Debian, so we show the details of that
here.
You can extend this guide to other operating systems by following the
instructions found via [the front Certbot web page][cb] instead, telling
it what OS and web stack you’re using. Chances are good that they’ve got
a good guide for you already.
### <a id="leew"></a> Configuring Let’s Encrypt, the Easy Way
If your web serving needs are simple, [Certbot][cb] can configure nginx
for you and keep its certificates up to date. Simply follow Certbot’s
[nginx on Ubuntu 20.04 LTS guide][cbnu].
Unfortunately, the setup above was beyond Certbot’s ability to cope the
last time we tried it. The use of per-subdomain files in particular
confused Certbot, so we had to [arrange these details manually](#lehw),
else the Let’s Encrypt [ACME] exchange failed in the necessary domain
validation steps.
At this point, if your configuration needs are simple, needing only a
single Internet domain and a single Fossil repo, you might wish to try
to reduce the above configuration to a more typical single-file nginx
config, which Certbot might then cope with out of the box.
### <a id="lehw"></a> Configuring Let’s Encrypt, the Hard Way
The primary motivation for this section is that it documents the manual
Certbot configuration on my public Fossil-based site. I’m addressing
the “me” years hence who needs to upgrade to Ubuntu 22.04 or 24.04 LTS
and has forgotten all of this stuff. 😉
#### Step 1: Shifting into Manual
The first thing we’ll do is install Certbot in the normal way, but we’ll
turn off all of the Certbot automation and won’t follow through with use
of the `--nginx` plugin:
$ sudo snap install --classic certbot
$ sudo systemctl disable certbot.timer
Next, edit `/etc/letsencrypt/renewal/example.com.conf` to disable the
nginx plugins. You’re looking for two lines setting the “install” and
“auth” plugins to “nginx”. You can comment them out or remove them
entirely.
#### Step 2: Configuring nginx
This is a straightforward extension to the HTTP-only configuration
[above](#config):
server {
server_name .foo.net;
include local/tls-common;
charset utf-8;
access_log /var/log/nginx/foo.net-https-access.log;
error_log /var/log/nginx/foo.net-https-error.log;
# Bypass Fossil for the static Doxygen docs
location /doc/html {
root /var/www/foo.net;
location ~* \.(html|ico|css|js|gif|jpg|png)$ {
expires 7d;
add_header Vary Accept-Encoding;
access_log off;
}
}
# Redirect everything else to the Fossil instance
location / {
include scgi_params;
scgi_pass 127.0.0.1:12345;
scgi_param HTTPS "on";
scgi_param SCRIPT_NAME "";
}
}
server {
server_name .foo.net;
root /var/www/foo.net;
include local/http-certbot-only;
access_log /var/log/nginx/foo.net-http-access.log;
error_log /var/log/nginx/foo.net-http-error.log;
}
One big difference between this and the HTTP-only case is
that we need two `server { }` blocks: one for HTTPS service, and
one for HTTP-only service.
##### HTTP over TLS (HTTPS) Service
The first `server { }` block includes this file, `local/tls-common`:
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_stapling on;
ssl_stapling_verify on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers "ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-CBC-SHA:ECDHE-ECDSA-AES256-CBC-SHA:ECDHE-ECDSA-AES128-CBC-SHA256:ECDHE-ECDSA-AES256-CBC-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-CBC-SHA:ECDHE-RSA-AES256-CBC-SHA:ECDHE-RSA-AES128-CBC-SHA256:ECDHE-RSA-AES256-CBC-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-CBC-SHA:DHE-RSA-AES256-CBC-SHA:DHE-RSA-AES128-CBC-SHA256:DHE-RSA-AES256-CBC-SHA256";
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_prefer_server_ciphers on;
ssl_session_timeout 1440m;
These are the common TLS configuration parameters used by all domains
hosted by this server.
The first line tells nginx to accept TLS-encrypted HTTP connections on
the standard HTTPS port. It is the same as `listen 443; ssl on;` in
older versions of nginx.
Since all of those domains share a single TLS certificate, we reference
the same `example.com/*.pem` files written out by Certbot with the
`ssl_certificate*` lines.
The `ssl_dhparam` directive isn’t strictly required, but without it, the
server becomes vulnerable to the [Logjam attack][lja] because some of
the cryptography steps are precomputed, making the attacker’s job much
easier. The parameter file this directive references should be
generated automatically by the Let’s Encrypt package upon installation,
making those parameters unique to your server and thus unguessable. If
the file doesn’t exist on your system, you can create it manually, so:
$ sudo openssl dhparam -out /etc/letsencrypt/dhparams.pem 2048
Beware, this can take a long time. On a shared Linux host I tried it on
running OpenSSL 1.1.0g, it took about 21 seconds, but on a fast, idle
iMac running LibreSSL 2.6.5, it took 8 minutes and 4 seconds!
The next section is also optional. It enables [OCSP stapling][ocsp], a
protocol that improves the speed and security of the TLS connection
negotiation.
The next section containing the `ssl_protocols` and `ssl_ciphers` lines
restricts the TLS implementation to only those protocols and ciphers
that are currently believed to be safe and secure. This section is the
one most prone to bit-rot: as new attacks on TLS and its associated
technologies are discovered, this configuration is likely to need to
change. Even if we fully succeed in keeping this document up-to-date in
the face of the evolving security landscape, we’re recommending static
configurations for your server: it will thus be up to you to track
changes in this document and others to merge the changes into your local
static configuration.
Running a TLS certificate checker against your site occasionally is a
good idea. The most thorough service I’m aware of is the [Qualys SSL
Labs Test][qslt], which gives the site I’m basing this guide on an “A+”
rating at the time of this writing. The long `ssl_ciphers` line above is
based on [their advice][qslc]: the default nginx configuration tells
OpenSSL to use whatever ciphersuites it considers “high security,” but
some of those have come to be considered “weak” in the time between that
judgement and the time of this writing. By explicitly giving the list of
ciphersuites we want OpenSSL to use within nginx, we can remove those
that become considered weak in the future.
<a id=”hsts”></a>There are a few things you can do to get an even better
grade, such as to enable [HSTS][hsts]:
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
This prevents a particular variety of [man in the middle attack][mitm]
where our HTTP-to-HTTPS permanent redirect is intercepted, allowing the
attacker to prevent the automatic upgrade of the connection to a secure
TLS-encrypted one. I didn’t enable that in the configuration above
because it is something a site administrator should enable only after
the configuration is tested and stable, and then only after due
consideration. There are ways to lock your users out of your site by
jumping to HSTS hastily. When you’re ready, there are [guides you can
follow][nest] elsewhere online.
##### HTTP-Only Service
While we’d prefer not to offer HTTP service at all, we need to do so for
two reasons:
* The temporary reason is that until we get Let’s Encrypt certificates
minted and configured properly, we can’t use HTTPS yet at all.
* The ongoing reason is that the Certbot [ACME][acme] HTTP-01
challenge used by the Let’s Encrypt service only runs over HTTP. This is
not only because it has to work before HTTPS is first configured,
but also because it might need to work after a certificate is
accidentally allowed to lapse to get that server back into a state
where it can speak HTTPS safely again.
So, from the second `service { }` block, we include this file to set up
the minimal HTTP service we require, `local/http-certbot-only`:
listen 80;
listen [::]:80;
# This is expressed as a rewrite rule instead of an "if" because
# http://wiki.nginx.org/IfIsEvil
#rewrite ^(/.well-known/acme-challenge/.*) $1 break;
# Force everything else to HTTPS with a permanent redirect.
#return 301 https://$host$request_uri;
As written above, this configuration does nothing other than to tell
nginx that it’s allowed to serve content via HTTP on port 80 as well.
We’ll uncomment the `rewrite` and `return` directives below, when we’re
ready to begin testing.
Notice that most of the nginx directives given [above](#config) moved up
into the TLS `server { }` block, because we eventually want this site to
be as close to HTTPS-only as we can get it.
#### Step 3: Dry Run
We want to first request a dry run, because Let’s Encrypt puts some
rather low limits on how often you’re allowed to request an actual
certificate. You want to be sure everything’s working before you do
that. You’ll run a command something like this:
$ sudo certbot certonly --webroot --dry-run \
--webroot-path /var/www/example.com \
-d example.com -d www.example.com \
-d example.net -d www.example.net \
--webroot-path /var/www/foo.net \
-d foo.net -d www.foo.net
There are two key options here.
First, we’re telling Certbot to use its `--webroot` plugin instead of
the automated `--nginx` plugin. With this plugin, Certbot writes the
[ACME][acme] HTTP-01 challenge files to the static web document root
directory behind each domain. For this example, we’ve got two web
roots, one of which holds documents for two different second-level
domains (`example.com` and `example.net`) with `www` at the third level
being optional. This is a common sort of configuration these days, but
you needn’t feel that you must slavishly imitate it. The other web root
is for an entirely different domain, also with `www` being optional.
Since all of these domains are served by a single nginx instance, we
need to give all of this in a single command, because we want to mint a
single certificate that authenticates all of these domains.
The second key option is `--dry-run`, which tells Certbot not to do
anything permanent. We’re just seeing if everything works as expected,
at this point.
##### Troubleshooting the Dry Run
If that didn’t work, try creating a manual test:
$ mkdir -p /var/www/example.com/.well-known/acme-challenge
$ echo hi > /var/www/example.com/.well-known/acme-challenge/test
Then try to pull that file over HTTP — not HTTPS! — as
`http://example.com/.well-known/acme-challenge/test`. I’ve found that
using Firefox or Safari is better for this sort of thing than Chrome,
because Chrome is more aggressive about automatically forwarding URLs to
HTTPS even if you requested “`http`”.
In extremis, you can do the test manually:
$ curl -i http://example.com/.well-known/acme-challenge/test
HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Sat, 19 Jan 2019 19:43:58 GMT
Content-Type: application/octet-stream
Content-Length: 3
Last-Modified: Sat, 19 Jan 2019 18:21:54 GMT
Connection: keep-alive
ETag: "5c436ac2-4"
Accept-Ranges: bytes
hi
The key bits you’re looking for here are the “200 OK” response code at
the start and the “hi” line at the end. (Or whatever you wrote in to the
test file.)
If you get a 301 redirect to an `https://` URI, you either haven’t
uncommented the `rewrite` line for HTTP-only service for this directory,
or there’s some other problem with the “redirect to HTTPS” config.
If you get a 404 or other error response, you need to look into your web
server logs to find out what’s going wrong.
If you’re still running into trouble, the log file written by Certbot
can be helpful. It tells you where it’s writing the ACME files early in
each run.
#### Step 4: Getting Your First Certificate
Once the dry run is working, you can drop the `--dry-run` option and
re-run the long command above. (The one with all the `--webroot*`
flags.) This should now succeed, and it will save all of those flag
values to your Let’s Encrypt configuration file, so you don’t need to
keep giving them.
#### Step 5: Test It
Edit the `local/http-certbot-only` file and uncomment the `redirect` and
`return` directives, then restart your nginx server and make sure it now
forces everything to HTTPS like it should:
$ sudo systemctl restart nginx
Test ideas:
* Visit both Fossil and non-Fossil URLs
* Log into the repo, log out, and log back in
* Clone via `http`: ensure that it redirects to `https`, and that
subsequent `fossil sync` commands go directly to `https` due to the
301 permanent redirect.
This forced redirect is why we don’t need the Fossil Admin → Access
"Redirect to HTTPS on the Login page" setting to be enabled. Not only
is it unnecessary with this HTTPS redirect at the front-end proxy level,
it would actually [cause an infinite redirect loop if
enabled](./ssl.wiki#rloop).
#### Step 6: Switch to HTTPS Sync
Fossil remembers permanent HTTP-to-HTTPS redirects on sync since version
2.9, so all you need to do to switch your syncs to HTTPS is:
$ fossil sync -R /path/to/repo.fossil
#### Step 7: Renewing Automatically
Now that the configuration is solid, you can renew the LE cert with the
`certbot` command from above without the `--dry-run` flag plus a restart
of nginx:
sudo certbot certonly --webroot \
--webroot-path /var/www/example.com \
-d example.com -d www.example.com \
-d example.net -d www.example.net \
--webroot-path /var/www/foo.net \
-d foo.net -d www.foo.net
sudo systemctl restart nginx
I put those commands in a script in the `PATH`, then arrange to call that
periodically. Let’s Encrypt doesn’t let you renew the certificate very
often unless forced, and when forced there’s a maximum renewal counter.
Nevertheless, some people recommend running this daily and just letting
it fail until the server lets you renew. Others arrange to run it no
more often than it’s known to work without complaint. Suit yourself.
[acme]: https://en.wikipedia.org/wiki/Automated_Certificate_Management_Environment
[cb]: https://certbot.eff.org/
[cbnu]: https://certbot.eff.org/lets-encrypt/ubuntufocal-nginx
[hsts]: https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
[lja]: https://en.wikipedia.org/wiki/Logjam_(computer_security)
[mitm]: https://en.wikipedia.org/wiki/Man-in-the-middle_attack
[nest]: https://www.nginx.com/blog/http-strict-transport-security-hsts-and-nginx/
[ocsp]: https://en.wikipedia.org/wiki/OCSP_stapling
[qslc]: https://github.com/ssllabs/research/wiki/SSL-and-TLS-Deployment-Best-Practices
[qslt]: https://www.ssllabs.com/ssltest/
*[Return to the top-level Fossil server article.](../)*
|
Changes to www/ssl.wiki.
| ︙ | ︙ | |||
233 234 235 236 237 238 239 | Fossil to OpenSSL. To serve a Fossil repository via HTTPS, you must put it behind some kind of HTTPS proxy. We have a number of documents elsewhere in this repository that cover your options for [./server/ | serving Fossil repositories]. A few of the most useful of these are: * <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a> * <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a> | | > > > > > > | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | Fossil to OpenSSL. To serve a Fossil repository via HTTPS, you must put it behind some kind of HTTPS proxy. We have a number of documents elsewhere in this repository that cover your options for [./server/ | serving Fossil repositories]. A few of the most useful of these are: * <a id="stunnel" href="./server/any/stunnel.md">Serving via stunnel</a> * <a id="althttpd" href="./server/any/althttpd.md">Serving via stunnel + althttpd</a> * <a id="nginx" href="./server/debian/nginx.md#tls">Serving via SCGI with nginx on Debian</a> <h2 id="enforcing">Enforcing TLS Access</h2> To use TLS encryption in cloning and syncing to a remote Fossil repository, be sure to use the <tt>https:</tt> URI scheme in <tt>clone</tt> and <tt>sync</tt> commands. If your server is configured to serve the repository via both HTTP and HTTPS, it's easy to accidentally use unencrypted HTTP if you forget the all-important 's'. As of Fossil 2.9, using an <tt>http://</tt> URI with <tt>fossil clone</tt> or <tt>sync</tt> on a site that forwards to HTTPS will cause Fossil to remember the secure URL. However, there's a [https://en.wikipedia.org/wiki/Trust_on_first_use | TOFU problem] with this: it's still better to use <tt>https://</tt> from the start. As of Fossil 2.8, there is a setting in the Fossil UI under Admin → Access called "Redirect to HTTPS," which is set to "Off" by default. Changing this only affects web UI access to the Fossil repository. It doesn't affect clones and syncs done via the <tt>http</tt> URI scheme. In Fossil 2.7 and earlier, there was a much weaker form of this setting affecting the <tt>/login</tt> page only. If you're using this setting, |
| ︙ | ︙ | |||
278 279 280 281 282 283 284 |
# <p><b>Download, fix, and restore.</b> You can copy the remote
repository file down to a local machine, use <tt>fossil ui</tt> to
fix the setting, and then upload it to the repository server
again.</p>
It's best to enforce TLS-only access at the front-end proxy level
anyway. It not only avoids the problem entirely, it can be significantly
| | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# <p><b>Download, fix, and restore.</b> You can copy the remote
repository file down to a local machine, use <tt>fossil ui</tt> to
fix the setting, and then upload it to the repository server
again.</p>
It's best to enforce TLS-only access at the front-end proxy level
anyway. It not only avoids the problem entirely, it can be significantly
more secure. The [server/debian/nginx.md#tls | nginx-on-Debian proxy guide] shows one way
to achieve this.</p>
<h2>Terminology Note</h2>
This document is called <tt>ssl.wiki</tt> for historical reasons. The
TLS protocol was originally called SSL, and it went through several
|
| ︙ | ︙ |
Changes to www/tls-nginx.md.
1 2 | # Proxying Fossil via HTTPS with nginx | < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 | # Proxying Fossil via HTTPS with nginx This document has [moved](./server/debian/nginx.md#tls). |