From lsof at mailbox.org Tue Feb 8 11:37:45 2022 From: lsof at mailbox.org (lemon) Date: Tue, 8 Feb 2022 12:37:45 +0100 Subject: [PATCH] html: fix fmt() off-by-one error Message-ID: <20220208113745.13748-1-lsof@mailbox.org> vsnprintf returns the byte count of the formatted output not including the null terminator, so in the case that len == 1024 the last character of the output was being truncated and not detected by the later check. Changing the greater than comparison to greater than or equal fixes this edge case. --- html.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html.c b/html.c index 7f81965..0bac34b 100644 --- a/html.c +++ b/html.c @@ -59,7 +59,7 @@ char *fmt(const char *format, ...) va_start(args, format); len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); va_end(args); - if (len > sizeof(buf[bufidx])) { + if (len >= sizeof(buf[bufidx])) { fprintf(stderr, "[html.c] string truncated: %s\n", format); exit(1); } -- 2.35.1 From list at eworm.de Tue Feb 8 12:38:28 2022 From: list at eworm.de (Christian Hesse) Date: Tue, 8 Feb 2022 13:38:28 +0100 Subject: [PATCH] html: fix fmt() off-by-one error In-Reply-To: <20220208113745.13748-1-lsof@mailbox.org> References: <20220208113745.13748-1-lsof@mailbox.org> Message-ID: <20220208133828.103214c7@leda.eworm.net> lemon on Tue, 2022/02/08 12:37: > vsnprintf returns the byte count of the formatted output not including > the null terminator, so in the case that len == 1024 the last character > of the output was being truncated and not detected by the later check. > Changing the greater than comparison to greater than or equal fixes this > edge case. We already have that pending... https://git.zx2c4.com/cgit/commit/?h=ch/html-fmt&id=d828a623442e3fc3159e2c188a78e6fd4aca8af4 -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From Jason at zx2c4.com Tue Feb 8 12:39:27 2022 From: Jason at zx2c4.com (Jason A. Donenfeld) Date: Tue, 8 Feb 2022 13:39:27 +0100 Subject: [PATCH] html: fix fmt() off-by-one error In-Reply-To: <20220208133828.103214c7@leda.eworm.net> References: <20220208113745.13748-1-lsof@mailbox.org> <20220208133828.103214c7@leda.eworm.net> Message-ID: Thanks guys. I'll get these merged to master branch in the coming two weeks and cut a new release. Jason From list at eworm.de Tue Feb 8 17:03:03 2022 From: list at eworm.de (Christian Hesse) Date: Tue, 8 Feb 2022 18:03:03 +0100 Subject: [PATCH] html: fix fmt() off-by-one error In-Reply-To: References: <20220208113745.13748-1-lsof@mailbox.org> <20220208133828.103214c7@leda.eworm.net> Message-ID: <20220208180303.623fe3ba@leda.eworm.net> "Jason A. Donenfeld" on Tue, 2022/02/08 13:39: > Thanks guys. I'll get these merged to master branch in the coming two > weeks and cut a new release. That would be great, much appreciated! /me hopes for review and merge of dynamic aging... -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);} -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 488 bytes Desc: OpenPGP digital signature URL: From john at keeping.me.uk Sun Feb 13 15:20:41 2022 From: john at keeping.me.uk (John Keeping) Date: Sun, 13 Feb 2022 15:20:41 +0000 Subject: [PATCH] Add "default-tab" and "root-default-tab" configuration options In-Reply-To: References: Message-ID: On Sun, Jan 30, 2022 at 06:04:10PM +0000, equa wrote: > These options allow the user to specify a page to display at the root > repository/index location instead of the default summary or repository list. > > Signed-off-by: equa We need a real name for the author and sign-off here. > diff --git a/ui-shared.c b/ui-shared.c > index acd8ab5..17b1e49 100644 > --- a/ui-shared.c > +++ b/ui-shared.c > @@ -203,6 +203,9 @@ static void site_url(const char *page, const char *search, const char *sort, int > { > char *delim = "?"; > > + if (!strcmp(page ? page : "", ctx.cfg.root_default_tab)) > + page = NULL; > + Why is this necessary? Is there any requirement to shorten the URL here or does it just make it shorter? > if (always_root || page) > html_attr(cgit_rooturl()); > else { > @@ -317,6 +320,12 @@ static void reporevlink(const char *page, const char *name, const char *title, > { > char *delim; > > + if (page > + && !rev > + && !path > + && !strcmp(page, ctx.repo->default_tab)) > + page = NULL; > + Same as above, I don't see what advantage this gives. From john at keeping.me.uk Sun Feb 13 15:29:06 2022 From: john at keeping.me.uk (John Keeping) Date: Sun, 13 Feb 2022 15:29:06 +0000 Subject: [PATCH] blame: add a link to the parent commit Message-ID: <5fe03939a1254f65961ea211ce5bd51bdc1e3895.1644766088.git.john@keeping.me.uk> When walking through the history, it is useful to quickly see the same file at the previous revision, so add a link to do this. It would be nice to link to the correct line with an additional fragment, but this requires significantly more work so it can be done as an enhancement later. (ent->s_lno is mostly the right thing, but it is the line number in the post-image of the target commit whereas the link is to the parent of that commit, i.e. the pre-image of the target.) Suggested-by: Alejandro Colomar Signed-off-by: John Keeping --- ui-blame.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui-blame.c b/ui-blame.c index 03136f7..3b0bcad 100644 --- a/ui-blame.c +++ b/ui-blame.c @@ -54,6 +54,15 @@ static void emit_blame_entry_hash(struct blame_entry *ent) html(""); free(detail); + if (!parse_commit(suspect->commit) && suspect->commit->parents) { + struct commit *parent = suspect->commit->parents->item; + + html(" "); + cgit_blame_link("^", "Blame the previous revision", NULL, + ctx.qry.head, oid_to_hex(&parent->object.oid), + suspect->path); + } + while (line++ < ent->num_lines) html("\n"); } -- 2.35.1 From john at keeping.me.uk Sun Feb 13 15:34:50 2022 From: john at keeping.me.uk (John Keeping) Date: Sun, 13 Feb 2022 15:34:50 +0000 Subject: [PATCH] treewide: use release_commit_memory() Message-ID: <98d70d24a2a37f9bbfec2f25d2c026005757a246.1644766431.git.john@keeping.me.uk> Instead of calling two separate Git functions to free memory associated with a commit object, use Git's wrapper which does this. This also counts as a potential future bug fix since release_commit_memory() also resets the parsed state of the commit, meaning any attempt to use it in the future will correctly fill out the fields again. release_commit_memory() does not set parents to zero, so keep that for additional safety in case CGit checks this without calling parse_commit() again. Signed-off-by: John Keeping --- ui-atom.c | 3 +-- ui-log.c | 6 ++---- ui-stats.c | 3 +-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ui-atom.c b/ui-atom.c index 1056f36..83fde7d 100644 --- a/ui-atom.c +++ b/ui-atom.c @@ -140,8 +140,7 @@ void cgit_print_atom(char *tip, const char *path, int max_count) } while ((commit = get_revision(&rev)) != NULL) { add_entry(commit, host); - free_commit_buffer(the_repository->parsed_objects, commit); - free_commit_list(commit->parents); + release_commit_memory(the_repository->parsed_objects, commit); commit->parents = NULL; } html("\n"); diff --git a/ui-log.c b/ui-log.c index 20774bf..db63424 100644 --- a/ui-log.c +++ b/ui-log.c @@ -489,8 +489,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern for (i = 0; i < ofs && (commit = get_revision(&rev)) != NULL; /* nop */) { if (show_commit(commit, &rev)) i++; - free_commit_buffer(the_repository->parsed_objects, commit); - free_commit_list(commit->parents); + release_commit_memory(the_repository->parsed_objects, commit); commit->parents = NULL; } @@ -511,8 +510,7 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern i++; print_commit(commit, &rev); } - free_commit_buffer(the_repository->parsed_objects, commit); - free_commit_list(commit->parents); + release_commit_memory(the_repository->parsed_objects, commit); commit->parents = NULL; } if (pager) { diff --git a/ui-stats.c b/ui-stats.c index 09b3625..40ed6c2 100644 --- a/ui-stats.c +++ b/ui-stats.c @@ -241,8 +241,7 @@ static struct string_list collect_stats(const struct cgit_period *period) memset(&authors, 0, sizeof(authors)); while ((commit = get_revision(&rev)) != NULL) { add_commit(&authors, commit, period); - free_commit_buffer(the_repository->parsed_objects, commit); - free_commit_list(commit->parents); + release_commit_memory(the_repository->parsed_objects, commit); commit->parents = NULL; } return authors; -- 2.35.1 From john at keeping.me.uk Sun Feb 13 15:35:29 2022 From: john at keeping.me.uk (John Keeping) Date: Sun, 13 Feb 2022 15:35:29 +0000 Subject: [PATCH] css: blame: reset font size for oid Message-ID: In Firefox, the hashes in the blame UI are out of step with the line number and content leading to ever increasing vertical misalignment. This is caused by the .oid class setting font-size to 90%, so override this back to 100% for the blame case, bringing the height of lines in all three columns of the table back into step. Signed-off-by: John Keeping --- cgit.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cgit.css b/cgit.css index dfa144d..1b848cf 100644 --- a/cgit.css +++ b/cgit.css @@ -363,6 +363,10 @@ div#cgit table.blame td.lines > div > pre { top: 0; } +div#cgit table.blame .oid { + font-size: 100%; +} + div#cgit table.bin-blob { margin-top: 0.5em; border: solid 1px black; -- 2.35.1 From june at causal.agency Sun Feb 13 16:05:46 2022 From: june at causal.agency (june) Date: Sun, 13 Feb 2022 11:05:46 -0500 Subject: [PATCH] Add "default-tab" and "root-default-tab" configuration options In-Reply-To: References: Message-ID: <7228B16B-3092-4EAD-9FCB-B3E8EA5C75FE@causal.agency> > On Feb 13, 2022, at 10:20, John Keeping wrote: > > On Sun, Jan 30, 2022 at 06:04:10PM +0000, equa wrote: >> These options allow the user to specify a page to display at the root >> repository/index location instead of the default summary or repository list. >> >> Signed-off-by: equa > > We need a real name for the author and sign-off here. No you don't lol From tmz at pobox.com Wed Feb 16 06:07:56 2022 From: tmz at pobox.com (Todd Zullinger) Date: Wed, 16 Feb 2022 01:07:56 -0500 Subject: [PATCH 0/2] wiki: update some links and fix some formatting Message-ID: <20220216060758.949317-1-tmz@pobox.com> Hi, I noticed a few of the URLs on the about page had grown stale. While I was looking at the page, I noticed the git clone command didn't appear to be indented as intended. Trivial fixes for both follow. Todd Zullinger (2): update Fedora & OS X package links, add OpenBSD index: avoid formatting issue in git clone instructions index | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.35.1 From tmz at pobox.com Wed Feb 16 06:07:57 2022 From: tmz at pobox.com (Todd Zullinger) Date: Wed, 16 Feb 2022 01:07:57 -0500 Subject: [PATCH 1/2] update Fedora & OS X package links, add OpenBSD In-Reply-To: <20220216060758.949317-1-tmz@pobox.com> References: <20220216060758.949317-1-tmz@pobox.com> Message-ID: <20220216060758.949317-2-tmz@pobox.com> Use the current URL's for the Fedora and OS X (Mac Ports) packages. Add a link to the OpenBSD ports tree. Expand the Fedora link to mention EPEL, which covers Alma Linux and Rocky Linux as well as RHEL and CentOS. This may help folks find us better if they're using a RHEL-8 rebuild like Alma or Rocky, now that CentOS Linux 8 is EOL. Signed-off-by: Todd Zullinger --- index | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index b/index index 8ff5fce..048ab05 100644 --- a/index +++ b/index @@ -46,16 +46,18 @@ Packages -------- * [Arch Linux][archlinux] * [Gentoo][gentoo] - * [Fedora/RHEL/CentOS][fedora] + * [Fedora/EPEL (RHEL/Alma/CentOS/Rocky)][fedora] * [OS X][macports] * [OpenSUSE][OpenSUSE] * [NetBSD][pkgsrc] * [FreeBSD][freshports] + * [OpenBSD][openbsd] [archlinux]: https://www.archlinux.org/packages/?name=cgit -[fedora]: https://apps.fedoraproject.org/packages/cgit +[fedora]: https://packages.fedoraproject.org/pkgs/cgit/cgit/ [gentoo]: https://packages.gentoo.org/packages/www-apps/cgit -[macports]: https://trac.macports.org/browser/trunk/dports/www/cgit +[macports]: https://ports.macports.org/port/cgit/ [opensuse]: https://software.opensuse.org/package/cgit [pkgsrc]: http://pkgsrc.se/www/cgit [freshports]: https://www.freshports.org/devel/cgit/ +[openbsd]: https://cvsweb.openbsd.org/ports/www/cgit/ -- 2.35.1 From tmz at pobox.com Wed Feb 16 06:07:58 2022 From: tmz at pobox.com (Todd Zullinger) Date: Wed, 16 Feb 2022 01:07:58 -0500 Subject: [PATCH 2/2] index: avoid formatting issue in git clone instructions In-Reply-To: <20220216060758.949317-1-tmz@pobox.com> References: <20220216060758.949317-1-tmz@pobox.com> Message-ID: <20220216060758.949317-3-tmz@pobox.com> The bulleted list which includes instructions for cloning cgit are intended to be formatted as: * clone the repo: * git clone https://git.zx2c4.com/cgit with the git clone command being a nested list. This does not work with markdown-python and instead is rendered as two separate bullet points. According to upstream?: Python-Markdown consistently requires 4 spaces of indent per level or it ignores the indent While we could adjust the indent level, it seems cleaner to simply remove the nested list item for the git clone command and format it as code. ? https://github.com/Python-Markdown/markdown/issues/125#issuecomment-7210925 Signed-off-by: Todd Zullinger --- index | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index b/index index 048ab05..2570c42 100644 --- a/index +++ b/index @@ -35,8 +35,7 @@ Features Source Code ----------- * download current or past [releases][] - * clone the repo: - * git clone https://git.zx2c4.com/cgit + * clone the repo: `git clone https://git.zx2c4.com/cgit` * see the [README][] for build instructions [releases]: /cgit/refs/tags -- 2.35.1 From actionmystique at gmail.com Sun Feb 20 16:17:32 2022 From: actionmystique at gmail.com (jean-christophe manciot) Date: Sun, 20 Feb 2022 17:17:32 +0100 Subject: What does the value of the size column for folders represent? Message-ID: Hi there, The value shown for files is as expected the ... exact size of the files in bytes. But I cannot make sense of that value for folders. Here is an example at https://git.sdxlive.com/PPA/tree/Ubuntu/pool/stable/l - linux-signed folder has the size '5267' - its contents total size is ~ 302 MB (as shown by du on a cloned repository) - it contains 62 files Is this an issue or is the cgit size showing something else for folders? -- Jean-Christophe From june at causal.agency Sun Feb 20 16:31:54 2022 From: june at causal.agency (june) Date: Sun, 20 Feb 2022 11:31:54 -0500 Subject: What does the value of the size column for folders represent? In-Reply-To: References: Message-ID: <933AB390-9166-451C-B3C5-7441607F7C7B@causal.agency> > On Feb 20, 2022, at 11:17, jean-christophe manciot wrote: > > Hi there, > The value shown for files is as expected the ... exact size of the > files in bytes. > But I cannot make sense of that value for folders. > > Here is an example at https://git.sdxlive.com/PPA/tree/Ubuntu/pool/stable/l > - linux-signed folder has the size '5267' > - its contents total size is ~ 302 MB (as shown by du on a cloned repository) > - it contains 62 files > > Is this an issue or is the cgit size showing something else for folders? It is showing the size of the tree object[1] in git. This command should show the same size: $ git cat-file tree master^{tree}:Ubuntu/pool/stable/l/linux-signed | wc -c [1]: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects#_tree_objects