René's URL Explorer Experiment


Title: git_submodule_update does not clone and throws assertion · Issue #4149 · libgit2/libgit2 · GitHub

Open Graph Title: git_submodule_update does not clone and throws assertion · Issue #4149 · libgit2/libgit2

X Title: git_submodule_update does not clone and throws assertion · Issue #4149 · libgit2/libgit2

Description: Hi all, Libgit2 crashes (throws assertion) during the git_submodule_update function. It may very well be that I don't use it correctly, as the documentation is not entirely exact in how to clone/add a submodule and I haven't found any ex...

Open Graph Description: Hi all, Libgit2 crashes (throws assertion) during the git_submodule_update function. It may very well be that I don't use it correctly, as the documentation is not entirely exact in how to clone/ad...

X Description: Hi all, Libgit2 crashes (throws assertion) during the git_submodule_update function. It may very well be that I don't use it correctly, as the documentation is not entirely exact in how to clon...

Opengraph URL: https://github.com/libgit2/libgit2/issues/4149

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"git_submodule_update does not clone and throws assertion","articleBody":"Hi all,\r\n\r\nLibgit2 crashes (throws assertion) during the `git_submodule_update` function.\r\nIt may very well be that I don't use it correctly, as the documentation is not entirely exact in how to clone/add a submodule and I haven't found any examples either.\r\n\r\n\r\n\r\n### Reproduction steps\r\n\r\nFirst a script to setup the environment and then the actual code.\r\n\r\n#### script to setup the environment\r\nsetup script, first the submodule which should be later added and then the parent directory.\r\nThe submodule is set up in `/tmp`, because I want absolute paths.\r\n`setup.sh`:\r\n```\r\n#!/bin/bash\r\n\r\n# remove previous fixtures\r\n# commented to not delete any stuff if you just copy and pasted it.\r\n#rm -rf /tmp/sm_test\r\n#rm -rf parent\r\npushd .\r\n\r\n# setup submodule\r\nmkdir /tmp/sm_test \u0026\u0026 cd /tmp/sm_test\r\ngit init .\r\ntouch sm_file\r\ngit add sm_file\r\ngit commit -m \"initial commit in submodule\"\r\ncd ..\r\n\r\npopd\r\npushd .\r\n\r\n\r\n# setup parent repository\r\nmkdir parent \u0026\u0026 cd parent\r\ngit init .\r\ntouch parent_file\r\ngit add parent_file\r\ngit commit -m \"initial commit in parent\"\r\n\r\npopd\r\n```\r\n\r\n#### minimal code for the bug\r\n`bug.c`:\r\n```\r\n#include \u003cgit2.h\u003e\r\n\r\n#include \u003cassert.h\u003e\r\n#include \u003cstdio.h\u003e\r\n\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n  git_submodule* sm = NULL;\r\n  git_repository* parent = NULL;\r\n  int result = 0;\r\n\r\n  git_libgit2_init();\r\n  result = git_repository_open(\u0026parent, \"parent\");\r\n  assert(!result);\r\n\r\n  result = git_submodule_add_setup(\u0026sm, parent, \"file:///tmp/sm_test\", \"sm_test\", 0);\r\n  assert(!result);\r\n\r\n  result = git_submodule_update(sm, 1, NULL);\r\n  assert(!result);\r\n\r\n  result = git_submodule_add_finalize(sm);\r\n  assert(!result);\r\n  git_submodule_free(sm);\r\n  git_repository_free(parent);\r\n  git_libgit2_shutdown();\r\n  return 0;\r\n}\r\n```\r\n\r\nThen just compile and run the whole stuff:\r\n`gcc bug.c -o bug -lgit2 \u0026\u0026 ./setup.sh \u0026\u0026 ./bug`\r\n\r\n### Expected behavior\r\nThe submodule should be cloned correctly and libgit2 shouldn't crash.\r\n`parent/sm_test` should contain the cloned repository.\r\n\r\n### Actual behavior\r\nThe program crashes with the following \r\n```\r\nbug: /home/user/build/libgit2/src/object.c:122: git_object_lookup_prefix: Assertion `repo \u0026\u0026 object_out \u0026\u0026 id' failed.\r\n```\r\n(id is zero)\r\n\r\n\r\n### Version of libgit2 (release number or SHA1)\r\nHEAD is at `ba2bc4911d99e20f1060bb6767edab94fd5d97a6`\r\n\r\n\r\n### Operating system(s) tested\r\n```\r\n$ uname -a\r\nLinux arch_virt_pci_test 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016 x86_64 GNU/Linux\r\n```\r\n\r\n### Further information\r\n#### Backtrace\r\n```\r\n#0  0x00007ffff773a04f in raise () from /usr/lib/libc.so.6\r\n#1  0x00007ffff773b47a in abort () from /usr/lib/libc.so.6\r\n#2  0x00007ffff7732ea7 in __assert_fail_base () from /usr/lib/libc.so.6\r\n#3  0x00007ffff7732f52 in __assert_fail () from /usr/lib/libc.so.6\r\n#4  0x00007ffff7b1c095 in git_object_lookup_prefix (object_out=0x7fffffffdbd0, repo=0x72a0b0, id=0x0, len=40, type=GIT_OBJ_COMMIT)\r\n    at /home/andre/build/libgit2/src/object.c:122\r\n#5  0x00007ffff7b1c29e in git_object_lookup (object_out=0x7fffffffdbd0, repo=0x72a0b0, id=0x0, type=GIT_OBJ_COMMIT)\r\n    at /home/andre/build/libgit2/src/object.c:198\r\n#6  0x00007ffff7b66a22 in git_submodule_update (sm=0x72ab70, init=1, _update_options=0x0) at /home/andre/build/libgit2/src/submodule.c:1224\r\n#7  0x000000000040093c in main (argc=1, argv=0x7fffffffdd28) at bug.c:20\r\n\r\n```\r\n\r\nLinks to the corresponding lines:\r\n`git_object_lookup_prefix @ src/object.c:122`: [Link](https://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/object.c#L122)\r\n`git_object_lookup @ src/object.c:198`: [Link](https://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/object.c#L198)\r\n`git_submodule_update @ src/submodule.c:1224`: [Link](https://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/submodule.c#L1224)\r\n\r\n#### Directory contents after bug\r\n```\r\n$ ls parent/\r\nparent_file sm_test\r\n$ cat parent/.gitmodules\r\n[submodule \"sm_test\"]\r\n\tpath = sm_test\r\n\turl = file:///tmp/sm_test\r\n$ ls parent/sm_test/\r\n$ ls /tmp/sm_test/\r\nsm_file\r\n```\r\n\r\nSo, the directory is created (per add_setup), but the index is not cloned.\r\n\r\nIf you need further information, please ask.\r\n\r\nCheers,\r\nAndre","author":{"url":"https://github.com/Spotlight0xff","@type":"Person","name":"Spotlight0xff"},"datePublished":"2017-03-02T15:34:51.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/4149/libgit2/issues/4149"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:184400ef-67fe-c13f-9320-0e372b1cb383
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA5DE:1F68DB:5D6172B:7D95823:6A5DEDFE
html-safe-noncebb8b026609fcca5380eb5daf49454f6eec84d1dca3f421a2da0b1f3adc24326b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNURFOjFGNjhEQjo1RDYxNzJCOjdEOTU4MjM6NkE1REVERkUiLCJ2aXNpdG9yX2lkIjoiNTE4ODExMTIxODc3NjA3NTc3NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace8cef4be4a5e7390fb83fb64d3a7751656c1b1c50f3064022104d73d7c8c4f45
hovercard-subject-tagissue:211426581
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/libgit2/libgit2/4149/issue_layout
twitter:imagehttps://opengraph.githubassets.com/31a1c8db9a3562ab007a687e87d42c31773e0fd39e13de1023a82f3d2085befe/libgit2/libgit2/issues/4149
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/31a1c8db9a3562ab007a687e87d42c31773e0fd39e13de1023a82f3d2085befe/libgit2/libgit2/issues/4149
og:image:altHi all, Libgit2 crashes (throws assertion) during the git_submodule_update function. It may very well be that I don't use it correctly, as the documentation is not entirely exact in how to clone/ad...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSpotlight0xff
hostnamegithub.com
expected-hostnamegithub.com
None8e8f322dc74b1a8d5bafb296008dbb96bb4a0bc6ee2d6f30844ab111697c520d
turbo-cache-controlno-preview
go-importgithub.com/libgit2/libgit2 git https://github.com/libgit2/libgit2.git
octolytics-dimension-user_id394745
octolytics-dimension-user_loginlibgit2
octolytics-dimension-repository_id901662
octolytics-dimension-repository_nwolibgit2/libgit2
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id901662
octolytics-dimension-repository_network_root_nwolibgit2/libgit2
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release7ae00b343090b49d0d18b8184187f51a39ed917c
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/libgit2/libgit2/issues/4149#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flibgit2%2Flibgit2%2Fissues%2F4149
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flibgit2%2Flibgit2%2Fissues%2F4149
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=libgit2%2Flibgit2
Reloadhttps://github.com/libgit2/libgit2/issues/4149
Reloadhttps://github.com/libgit2/libgit2/issues/4149
Reloadhttps://github.com/libgit2/libgit2/issues/4149
Please reload this pagehttps://github.com/libgit2/libgit2/issues/4149
libgit2 https://github.com/libgit2
libgit2https://github.com/libgit2/libgit2
Notifications https://github.com/login?return_to=%2Flibgit2%2Flibgit2
Fork 2.6k https://github.com/login?return_to=%2Flibgit2%2Flibgit2
Star 10.5k https://github.com/login?return_to=%2Flibgit2%2Flibgit2
Code https://github.com/libgit2/libgit2
Issues 423 https://github.com/libgit2/libgit2/issues
Pull requests 108 https://github.com/libgit2/libgit2/pulls
Discussions https://github.com/libgit2/libgit2/discussions
Actions https://github.com/libgit2/libgit2/actions
Projects https://github.com/libgit2/libgit2/projects
Security and quality 9 https://github.com/libgit2/libgit2/security
Insights https://github.com/libgit2/libgit2/pulse
Code https://github.com/libgit2/libgit2
Issues https://github.com/libgit2/libgit2/issues
Pull requests https://github.com/libgit2/libgit2/pulls
Discussions https://github.com/libgit2/libgit2/discussions
Actions https://github.com/libgit2/libgit2/actions
Projects https://github.com/libgit2/libgit2/projects
Security and quality https://github.com/libgit2/libgit2/security
Insights https://github.com/libgit2/libgit2/pulse
git_submodule_update does not clone and throws assertionhttps://github.com/libgit2/libgit2/issues/4149#top
https://github.com/Spotlight0xff
Spotlight0xffhttps://github.com/Spotlight0xff
on Mar 2, 2017https://github.com/libgit2/libgit2/issues/4149#issue-211426581
Linkhttps://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/object.c#L122
Linkhttps://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/object.c#L198
Linkhttps://github.com/libgit2/libgit2/blob/ba2bc4911d99e20f1060bb6767edab94fd5d97a6/src/submodule.c#L1224
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.