git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 003/160] gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 14, 2010, 21:42 UTC
Message-ID
<AANLkTim-j6TLwz0PugZvaEf1x3hW=76vT1gALC=w3DOu@mail.gmail.com>
In-Reply-To
<20101114212757.GD10150@burratino>
On Sun, Nov 14, 2010 at 22:27, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 24 quoted lines
> Ævar Arnfjörð Bjarmason wrote:
>
>> Thanks for the suggestion. I'll put it in envsubst/ then.
>>
>> Any idea about the issue of it being linked to too many things?
>
> Maybe http://thread.gmane.org/gmane.comp.version-control.git/160842
> is related?
>
>> tried to add another entry to this section:
>>
>>     git-%$X: %.o $(GITLIBS)
>>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter
>> %.o,$^) $(LIBS)
>>
>>     git-imap-send$X: imap-send.o $(GITLIBS)
>>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
>>             $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
>>
>> But it wasn't actually used. But then again I don't know Makefile
>> hacking that much.
>
> If you send output from "make envsubst" from your attempt with V=1,
> I can try to debug it.
This is how it currently gets compiled:
    $ rm git-sh-i18n--envsubst sh-i18n--envsubst.o; make -j 5 all V=1
    gcc -o sh-i18n--envsubst.o -c   -g -O2 -Wall -I.  -DHAVE_PATHS_H
-DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS
sh-i18n--envsubst.c
    gcc  -g -O2 -Wall -I.  -DHAVE_PATHS_H
-DSHA1_HEADER='<openssl/sha.h>'  -DNO_STRLCPY -DNO_MKSTEMPS -o
git-sh-i18n--envsubst   sh-i18n--envsubst.o libgit.a xdiff/lib.a  -lz
-lcrypto -lpthread

I tried to remove some of those library includes. But it'll complain. However if I do:

    diff --git a/sh-i18n--envsubst.c b/sh-i18n--envsubst.c
    index 8db71b1..7d4c870 100644
    --- a/sh-i18n--envsubst.c
    +++ b/sh-i18n--envsubst.c
    @@ -215 +215 @@ string_list_append (string_list_ty *slp, const char *s)
    -      slp->item = (const char **) xrealloc (slp->item, nbytes);
    +      slp->item = (const char **) realloc (slp->item, nbytes);
    @@ -293 +293 @@ note_variable (const char *var_ptr, size_t var_len)
    -  char *string = xmalloc (var_len + 1);
    +  char *string = malloc (var_len + 1);
    @@ -368 +368 @@ subst_from_stdin ()
    -                     buffer = xrealloc (buffer, bufmax);
    +                     buffer = realloc (buffer, bufmax);
    @@ -402 +402 @@ subst_from_stdin ()
    -                     buffer = xrealloc (buffer, bufmax);
    +                     buffer = realloc (buffer, bufmax);

It'll compile stand-alone with no library includes at all. Maybe I should just modify it to have basic versions of those two x* functions so we can compile it completely stand-alone.

Previous: Jonathan NiederNext: Jonathan Nieder
Message 9 of 12 in “[PULL] ab/i18n rebased on ab/i18n-prereqs”
  1. 000/160 [PULL] ab/i18n rebased on ab/i18n-prereqsÆvar Arnfjörð Bjarmason, Nov 14, 2010
  2. 002/160 Makefile: Set NO_GETTEXT=YesPlease on Windows & MinGWÆvar Arnfjörð Bjarmason, Nov 14, 2010
  3. Erik Faye-LundNov 15, 2010
  4. 003/160 gettext: fix bug in git-sh-i18n's eval_gettext() by using envsubst(1)Ævar Arnfjörð Bjarmason, Nov 14, 2010
  5. Jonathan NiederNov 14, 2010
  6. Junio C HamanoNov 14, 2010
  7. Ævar Arnfjörð BjarmasonNov 14, 2010
  8. Jonathan NiederNov 14, 2010
  9. Ævar Arnfjörð BjarmasonNov 14, 2010
  10. Jonathan NiederNov 14, 2010
  11. Ævar Arnfjörð BjarmasonNov 14, 2010
  12. Ævar Arnfjörð BjarmasonNov 16, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.