Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSIF: git args seem incorrect #5940

Closed
chrismwendt opened this issue Oct 10, 2019 · 5 comments · Fixed by #5941
Closed

LSIF: git args seem incorrect #5940

chrismwendt opened this issue Oct 10, 2019 · 5 comments · Fixed by #5941
Assignees
Labels
Milestone

Comments

@chrismwendt
Copy link
Contributor

@chrismwendt chrismwendt commented Oct 10, 2019

  • Clear out existing commits to be able to trigger a gitserver call later psql --dbname sourcegraph_lsif -c "delete from commits;"
  • Apply the following diff to log gitserver errors:
diff --git a/lsif/src/commits.ts b/lsif/src/commits.ts
index 3ae1faecd2..2cd3a822b9 100644
--- a/lsif/src/commits.ts
+++ b/lsif/src/commits.ts
@@ -163,7 +163,11 @@ async function gitserverExecLines(gitserverUrl: string, repository: string, args
  * @param args The command to run in the repository's git directory.
  */
 async function gitserverExec(gitserverUrl: string, repository: string, args: string[]): Promise<string> {
-    return (await got(new URL(`http://${gitserverUrl}/exec`).href, {
+    const r = await got(new URL(`http://${gitserverUrl}/exec`).href, {
         body: JSON.stringify({ repo: repository, args }),
-    })).body
+    })
+    console.log({ repo: repository, args })
+    console.log(r.trailers)
+    console.log(r.body)
+    return r.body
 }
20:12:10            lsif-server | {
20:12:10            lsif-server |   repo: 'github.com/sourcegraph/sourcegraph',
20:12:10            lsif-server |   args: [
20:12:10            lsif-server |     'git',
20:12:10            lsif-server |     'log',
20:12:10            lsif-server |     '--pretty=%H %P',
20:12:10            lsif-server |     '4a7d469702c5f71bff6baa150b982e77517a5aa0',
20:12:10            lsif-server |     '-5000'
20:12:10            lsif-server |   ]
20:12:10            lsif-server | }
20:12:10            lsif-server | {
20:12:10            lsif-server |   'x-exec-error': 'exit status 1',
20:12:10            lsif-server |   'x-exec-exit-status': '1',
20:12:10            lsif-server |   'x-exec-stderr': "git: 'git' is not a git command. See 'git --help'.  The most similar command is \tinit"
20:12:10            lsif-server | }

I believe this is caused by the presence of the git command in the args:

const args = ['git', 'log', '--pretty=%H %P', commit, `-${MAX_COMMITS_PER_UPDATE}`]

@efritz

This comment has been minimized.

Copy link
Contributor

@efritz efritz commented Oct 10, 2019

Can't reproduce with those instructions. My output on 603ce95:

21:21:59            lsif-server | {
21:21:59            lsif-server |   repo: 'github.com/sourcegraph/codeintellify',
21:21:59            lsif-server |   args: [
21:21:59            lsif-server |     'git',
21:21:59            lsif-server |     'log',
21:21:59            lsif-server |     '--pretty=%H %P',
21:21:59            lsif-server |     '5f4f8fa15216626941742a69f2f4993db7e4e5d9',
21:21:59            lsif-server |     '-5000'
21:21:59            lsif-server |   ]
21:21:59            lsif-server | }
21:21:59            lsif-server | { 'x-exec-error': '', 'x-exec-exit-status': '0', 'x-exec-stderr': '' }
21:21:59            lsif-server | 5f4f8fa15216626941742a69f2f4993db7e4e5d9 de47fe7b3652ca93a2c0b5fb81bdb0ca9e483691
21:21:59            lsif-server | de47fe7b3652ca93a2c0b5fb81bdb0ca9e483691 c5256abc9d8be5b77747e7b4eee5904c2283e2ba
21:21:59            lsif-server | c5256abc9d8be5b77747e7b4eee5904c2283e2ba 401ea4c7d2b489c8c35c56112c13a35cd8719e5a
21:21:59            lsif-server | 401ea4c7d2b489c8c35c56112c13a35cd8719e5a 1b6a84a9608900573e4d46376f31a7a8a916bdf7
21:21:59            lsif-server | 1b6a84a9608900573e4d46376f31a7a8a916bdf7 afcba75a449da2cab9dc90b93066129ba0b7e9fc
21:21:59            lsif-server | afcba75a449da2cab9dc90b93066129ba0b7e9fc 7605d2c6dda6f0b9d2061a9449532c8cb6ba1e01
21:21:59            lsif-server | 7605d2c6dda6f0b9d2061a9449532c8cb6ba1e01 1fe98184952ea5f3bbb763c931bfba0769824d55
21:21:59            lsif-server | 1fe98184952ea5f3bbb763c931bfba0769824d55 b1ed14a7ac0f77e4b8b15998515a2abae64a2855
21:21:59            lsif-server | b1ed14a7ac0f77e4b8b15998515a2abae64a2855 e97f3a439af148b271af1981114f956f44b07eaf
21:21:59            lsif-server | e97f3a439af148b271af1981114f956f44b07eaf eee431b248c2ccba48b635c6ee5109f3d9745bf6
21:21:59            lsif-server | eee431b248c2ccba48b635c6ee5109f3d9745bf6 ffa701513b756a9cde4b1fc4236daca3424e6caf
21:21:59            lsif-server | ffa701513b756a9cde4b1fc4236daca3424e6caf 8797529df4ced4861a7616762faec695c7198b96
21:21:59            lsif-server | 8797529df4ced4861a7616762faec695c7198b96 426b37cef904b1586b2263b3476d1f345cccb5d8
21:21:59            lsif-server | 426b37cef904b1586b2263b3476d1f345cccb5d8 b8a22080711f8b5a213fdbfe1e5fa0fbe28b834e
21:21:59            lsif-server | b8a22080711f8b5a213fdbfe1e5fa0fbe28b834e 47adbe8b36b545decbf32831724032bcf601b462
21:21:59            lsif-server | 47adbe8b36b545decbf32831724032bcf601b462 c21c0da7b2a6cacafcbf90c85a81bf432020ad9b
21:21:59            lsif-server | c21c0da7b2a6cacafcbf90c85a81bf432020ad9b 814fcb258eef5b3674394e1de3b5cb48980b9a2f
21:21:59            lsif-server | 814fcb258eef5b3674394e1de3b5cb48980b9a2f 74933bbf456b08b42fd3439e7018564eed23d52a
21:21:59            lsif-server | 74933bbf456b08b42fd3439e7018564eed23d52a 3beb5c1913c131b0b1c6d8dd4877957ee509f9ed
@felixfbecker

This comment has been minimized.

Copy link
Member

@felixfbecker felixfbecker commented Oct 10, 2019

Does the LSIF server handle errors reported through trailers?

@chrismwendt

This comment has been minimized.

Copy link
Contributor Author

@chrismwendt chrismwendt commented Oct 10, 2019

Can't reproduce with those instructions. My output on 603ce95:

Strange! I'm on 603ce95 as well. Let's try to narrow this down via screen share tomorrow.

@efritz

This comment has been minimized.

Copy link
Contributor

@efritz efritz commented Oct 10, 2019

Does the LSIF server handle errors reported through trailers?

No, I'm drafting a change for that. I'm not sure in what capacity it is necessary (though good to log). I've just re-confirmed that the three scenarios work locally:

  • unknown repo, unknown commit
  • known repo, unknown commit
  • known repo, known commit

In the first we get a 404 response. The later two return a usable body or not. I can expand errors to better disambiguate the middle condition.

@chrismwendt

This comment has been minimized.

Copy link
Contributor Author

@chrismwendt chrismwendt commented Oct 10, 2019

Can't reproduce with those instructions. My output on 603ce95:

Strange! I'm on 603ce95 as well. Let's try to narrow this down via screen share tomorrow.

Turns out @efritz had an alias to compress git git to git, which made it work on his machine 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants
You can’t perform that action at this time.