From: john at keeping.me.uk (John Keeping)
Subject: Crash when using path limit in ui-patch.c
Date: Thu, 24 Nov 2016 18:49:06 +0000 [thread overview]
Message-ID: <20161124184854.GA24063@john.keeping.me.uk> (raw)
In-Reply-To: <08e7db12-42ae-87d6-4fbb-d1c87226f98b@xinu.at>
On Thu, Nov 24, 2016 at 10:57:22AM +0100, Florian Pritz wrote:
> I get the following backtrace when trying to use the path limit feature
> while getting a patch.
>
> > #0 0x0000000000467bb5 in prefix_pathspec (item=0x77ba48, p_short_magic=0x7fffffffb2e8, raw=0x76e488, flags=0, prefix=0x0, prefixlen=0, elt=0x3637353238343130 <error: Cannot access memory at address 0x3637353238343130>) at pathspec.c:149
> > #1 0x0000000000468872 in parse_pathspec (pathspec=0x7fffffffc550, magic_mask=0, flags=0, prefix=0x0, argv=0x76e480) at pathspec.c:418
> > #2 0x0000000000487efb in setup_revisions (argc=4, argv=0x7fffffffc430, revs=0x7fffffffc500, opt=0x0) at revision.c:2253
> > #3 0x00000000004135eb in cgit_print_patch (new_rev=0x791670 "03c580a9b31fb82187de3c882bc274441c41847d", old_rev=0x0, prefix=0x76dfd0 "application/libraries") at ../ui-patch.c:88
> > #4 0x0000000000409534 in patch_fn () at ../cmd.c:119
> > #5 0x0000000000407281 in process_request () at ../cgit.c:744
> > #6 0x0000000000408d2b in cache_process (size=0, path=0x4fc87a "/var/cache/cgit", key=0x777670 "users/flo/filebin/patch/application/libraries?id=03c580a9b31fb82187de3c882bc274441c41847d", ttl=-1, fn=0x407141 <process_request>) at ../cache.c:367
> > #7 0x00000000004083aa in cmd_main (argc=1, argv=0x7fffffffe048) at ../cgit.c:1092
> > #8 0x000000000041d40b in main (argc=1, argv=0x7fffffffe048) at common-main.c:40
>
> I'm not exactly sure what is going on, but I don't have the time to
> debug so I cobbled together a quick test case for this which you can
> view here: https://paste.xinu.at/vgCm/
>
> The test "works" before commit 5fe88a9c81517b1a8a93d930c738cbb6f71dec2a
> since that introduces the feature and using the path limit doesn't
> actually change the output. It's just a quick reproducer.
Where does the test fail for you? I assume it's the line:
cgit_query "url=foo/patch/file-5"
which doesn't fail for me. The only failure I get is because CGit
inserts a message "(limited to 'file-5')" which is not inserted by
git-format-patch.
I had a quick look at the code, and even though I can't trigger a
failure, the count passed in to setup_revisions() does look suspicious.
Can you try the patch below and see if it fixes the problem?
-- >8 --
diff --git a/ui-patch.c b/ui-patch.c
index ec7f3523..d29f74c7 100644
--- a/ui-patch.c
+++ b/ui-patch.c
@@ -85,8 +85,7 @@ void cgit_print_patch(const char *new_rev, const char *old_rev,
DIFF_FORMAT_PATCH | DIFF_FORMAT_SUMMARY;
if (prefix)
rev.diffopt.stat_sep = fmt("(limited to '%s')\n\n", prefix);
- setup_revisions(ARRAY_SIZE(rev_argv), rev_argv, &rev,
- NULL);
+ setup_revisions(rev_argc, rev_argv, &rev, NULL);
prepare_revision_walk(&rev);
while ((commit = get_revision(&rev)) != NULL) {
next prev parent reply other threads:[~2016-11-24 18:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 9:57 bluewind
2016-11-24 18:49 ` john [this message]
2016-11-24 19:14 ` lfleischer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161124184854.GA24063@john.keeping.me.uk \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).