8000 Error ls remote by dinosaure · Pull Request #351 · mirage/ocaml-git · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Error ls remote #351

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

Merged
merged 15 commits into from
Apr 10, 2019
Merged

Error ls remote #351

merged 15 commits into from
Apr 10, 2019

Conversation

dinosaure
Copy link
Member

Continuation of #350 to handle, this time, error when we want to clone/push/pull/ls-remote a non-existing git repository or a repository where we did not have right.

…ide PKT-line and use p_http_report_status in TCP flow (wip)
This was referenced Apr 4, 2019
@hannesm
Copy link
Member
hannesm commented Apr 4, 2019

with ke and encore from master each, I run into:

File "src/git/smart.ml", line 1183, characters 10-72:
Error: This expression has type ('a, [> Rresult.R.msg ] as 'b) result state
       but an expression was expected of type Common.advertised_refs state
       Type ('a, 'b) result is not compatible with type
         Common.advertised_refs 

when attempting to compile this... (edit: CI says same)

… repository or a repository where we did not have rights
@dinosaure
Copy link
Member Author

Fixed sorry for the noise.

@hannesm
Copy link
Member
hannesm commented Apr 4, 2019

ok, tests with this PR (08e5082 and ke & encore from their master branches):

  • https remote with username + password
    • pull works fine
    • push reports now:
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object 078437c0ebe67cf2583fa70c6b613b14b2fdb247 in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object 88c2893ef8df18fd38034deab08cfee24dfb26fe in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Add the object a4deab8cfe3ffadde4cbf7fbfd4355fc27e2acc0 in the new PACK file.
2019-04-04 12:03:33 -00:00: DBG [git.gc] Ask to try to delta-ify the object a4deab8cfe3ffadde4cbf7fbfd4355fc27e2acc0.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.gc] Ask to try to delta-ify the object 078437c0ebe67cf2583fa70c6b613b14b2fdb247.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:03:33 -00:00: DBG [cohttp] Send a request to https://github.com/miragebot/testdata.git/git-receive-pack.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 5] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:03:33 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:03:35 -00:00: ERR [application] error while pushing data (`Smart (`Unexpected_char ))
  • git remote (no auth, access denied)
    • pull works
    • push:
2019-04-04 12:06:37 -00:00: DBG [irmin.tree] Tree.find_tree /foo
2019-04-04 12:06:37 -00:00: DBG [irmin.sync] push
2019-04-04 12:06:37 -00:00: DBG [irmin.git] push git://github.com/miragebot/testdata.git
2019-04-04 12:06:37 -00:00: ERR [application] error while pushing data {`Sync Unexpected result: (`SmartError "ERR \n  You can't push to git://github.com/miragebot/testdata.git\n  Use https://github.com/miragebot/testdata.git")}
  • git, local where push is allowed:
    • pull works
    • push works
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.gc] Ask to try to delta-ify the object 1c32c2dffd014be4532fba3a7c1bb8e9cbff8be6.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 8] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 0] byte(s).
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Starting to encode a Git object with a buffer.
2019-04-04 12:08:32 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 12:08:32 -00:00: DBG [irmin.git] push result: XX
2019-04-04 12:08:32 -00:00: APP [application] pushed data

@hannesm
Copy link
Member
hannesm commented Apr 4, 2019

(NB, if https and no proper user + password (the above one was using a user+pass in the url which I removed from the output manually):

2019-04-04 12:13:46 -00:00: DBG [irmin.git] write_index
2019-04-04 12:13:46 -00:00: DBG [irmin.git] write_index/if bare=true head=refs/heads/master
2019-04-04 12:13:46 -00:00: DBG [irmin.sync] push
2019-04-04 12:13:46 -00:00: DBG [irmin.git] push https://github.com/miragebot/testdata.git
2019-04-04 12:13:46 -00:00: DBG [git.sync.http] Launch the GET request to https://github.com/miragebot/testdata.git/info/refs?service=git-receive-pack.
2019-04-04 12:13:46 -00:00: DBG [cohttp] Send a request to https://github.com/miragebot/testdata.git/info/refs?service=git-receive-pack.
2019-04-04 12:13:46 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 12:13:46 -00:00: ERR [application] error while pushing data (`Smart (`No_assert_predicate #predicate))

@dinosaure
Copy link
Member Author

Yes the last one bug is the big and final boss 👍

@dinosaure
Copy link
Member Author

I just want to say, all of these bugs come from only one problem: a non existing documentation about the Smart protocol

@hannesm
Copy link
Member
hannesm commented Apr 4, 2019

ok, with 067371f:

  • git protocol pull works fine!

  • git protocol and (not valid) push works
    2019-04-04 15:38:10 -00:00: ERR [application] error while pushing data {`Sync Unexpected result: (`SmartError "ERR \n You can't push to git://github.com/miragebot/testdata.git\n Use https://github.com/miragebot/testdata.git")}

  • git protocol and valid push works!

  • git protocol and non-existing repository: errors with `SmartError \"ERR access denied or repository not exported

  • https protocol and pull works fine!

  • if repository does not exist, i get:

2019-04-04 15:40:44 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:40:44 -00:00: ERR [netif] [listen] error while handling (Invalid_argument "Sync.pull_exn: (`Sync Repository not found.)"), continuing. bt: Raised at file "format.ml" (inlined), line 242, characters 35-52
  • https and push to a non-existing repository
2019-04-04 15:43:44 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:43:44 -00:00: ERR [netif] [listen] error while handling (Invalid_argument "Sync.pull_exn: (`Sync Repository not found.)"), continuing. bt: Raised at file "format.ml" (inlined), line 242, characters 35-52
  • https and unauthenticated push
2019-04-04 15:42:18 -00:00: ERR [git.sync.http] The HTTP decoder returns an error: (`No_assert_predicate #predicate).
2019-04-04 15:42:18 -00:00: ERR [application] error while pushing data (`Smart (`No_assert_predicate #predicate))
2019-04-04 15:44:26 -00:00: DBG [git.encoder] Ensure than we wrote exactly [shift = 220] byte(s).
2019-04-04 15:44:28 -00:00: ERR [application] error while pushing data (`Smart (`Unexpected_char ))

so it seems the success answer for https/smart-http needs to be parsed more politely...

@dinosaure
Copy link
Member Author

I cherry-pick commit from @clecat when it fits under the topic of this PR. I will add some regression tests to this PR. It will take a time 8000 when it's not easy to mimic a Git server but I found a way to do that properly.

@hannesm
Copy link
Member
hannesm commented Apr 9, 2019

nice tests! :)

@dinosaure
Copy link
Member Author

I need to write the last tests about @clecat fix and it's ready to merge. These tests does not cover HTTP however ... Simulate an HTTP flow is little bit annoying. Good news. this test check some assertions about git in general, mostly about the PACK file. We are more constrained about the way to generate a PACK file (which differs from git - git use a multi-thread to generate a PACK file, and, btw generation is not deterministic) .

@dinosaure
Copy link
Member Author

The last regression test fails, as expected, in master and works in this PR. Waiting CI and ready to merge.

@dinosaure dinosaure merged commit 5ca10c0 into mirage:master Apr 10, 2019
dinosaure added a commit to dinosaure/opam-repository that referenced this pull request Jul 12, 2019
CHANGES:

- Move to the last version of `decompress` (@dinosaure, mirage/ocaml-git#366)
- Check order of entries in a tree object (bug found by @samoht, fixed by @dinosaure, mirage/ocaml-git#365)
- Use `mmap` package (@dinosaure, mirage/ocaml-git#347, mirage/ocaml-git#360)
- Update README.md (@tcoopman, @dinosaure, mirage/ocaml-git#337, mirage/ocaml-git#359)
- `trim` the window used to pack (@pqwy, @dinosaure, mirage/ocaml-git#357, mirage/ocaml-git#358)
- Use lastest version of `lru.0.3.0` (@pqwy, @dinosaure, mirage/ocaml-git#352, mirage/ocaml-git#356)
- Fix smart protocol (fixed by @clecat and @dinosaure, feedbacks from @hannesm)
 * Pull-request mirage/ocaml-git#351, mirage/ocaml-git#350, mirage/ocaml-git#338
 * Issues mirage/ocaml-git#335, mirage/ocaml-git#342, mirage/ocaml-git#346

   + regression tests was added (@dinosaure)
   + semantics about negociation was explained (@clecat)
   + end-to-end tests partially done (@hannesm)

- Remove `sexplib` dependency (@samoht, mirage/ocaml-git#349)
- Fix smart protocol to accept empty response from `ls-remote` (bug found by @hannesm, fixed by @dinosaure, mirage/ocaml-git#348)
- Add `io-page-unix` as dependency to tests `git-mirage` (@dinosaure, mirage/ocaml-git#345)
- Remove deprecated `Cstruct.add_len` (replaced by `ke`) (@dinosaure, mirage/ocaml-git#345)
- Use `Uri.user_info` to be able to be authentified by a service like GitHub (@linse, review by @dinosaure, mirage/ocaml-git#341, mirage/ocaml-git#343)
- avoid clash between `digestif.c` and `digestif.ocaml` implementation (same for `checkseum`)
 * remove implementation dependencies on `git-unix` and `git-mirage` (bug found by @hannesm and @linse, fixed by @dinosaure, mirage/ocaml-git#339)

   This update should be fixed by `dune`'s variants and `>= digestif.0.7.2` and `>= checkseum.0.1.0`

- **breaking-change** add `etmp` as already-allocated buffer to encode Git object (@dinosaure, mirage/ocaml-git#336)
 * add `ke.0.3` as new dependency
- consumed inputs for every entries in a tree (bug found by @zspicko, fixed by @dinosaure, mirage/ocaml-git#334)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0