Problem: undefined symbol _xdl_regexec_buf when linking with libxdiff

Open
#5 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
c
Domain
build-system

Research direction

Start in git-xdiff.h at xdl_regexec_buf and inspect its use from xdiffi.c. Reproduce the linking build, compare the symbol output with nm, and confirm that the completed change removes the undefined _xdl_regexec_buf symbol while xdiff still builds and links.

Written by the indexing model from the issue text.

Description

(referenced from xdiffi.c)

This fixes the problem, but to be honest I am not sure why, it should have picked up inlined from the header xdl_regexec_buf 🤔

diff --git a/git-xdiff.h b/git-xdiff.h
index 4091d22..673b5b6 100644
--- a/git-xdiff.h
+++ b/git-xdiff.h
@@ -64,7 +64,7 @@ inline int xdl_regexec_buf(
 # define xdl_regex_t regex_t
 # define xdl_regmatch_t regmatch_t
 
-inline int xdl_regexec_buf(
+static inline int xdl_regexec_buf(
 	const xdl_regex_t *preg, const char *buf, size_t size,
 	size_t nmatch, xdl_regmatch_t pmatch[], int eflags)
 {

When not linking but simply building xdiff, this error does not happen, but I can see that it is an undefined symbol (using nm):

                 U _xdl_regexec_buf
Dominant language
C
Stars
27
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.