# [PATCH av/i18n 1/2] tests: Symlink share and po into valgrind wrapper directory

5 messages from 2010-07-25 to 2010-07-25. Participants: Thomas Rast, Ævar Arnfjörð Bjarmason.
Thread: https://gitlist.dev/t/24507

## Thomas Rast, 2010-07-25 09:50

Subject: [PATCH av/i18n 1/2] tests: Symlink share and po into valgrind wrapper directory
Message-ID: <ba054975988a4a799bcd81a74acd865815ae9bf5.1280051448.git.trast@student.ethz.ch>
URL: https://gitlist.dev/e/ba054975988a4a799bcd81a74acd865815ae9bf5.1280051448.git.trast%40student.ethz.ch

```
This is required since with --valgrind, the $GIT_EXEC_PATH that is
used to determine the proper location of these directories points to
.../t/valgrind/bin.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/test-lib.sh |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4ae0de8..2f4bb27 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -735,6 +735,8 @@ then
 	do
 		make_valgrind_symlink $file
 	done
+	make_symlink "$TEST_DIRECTORY/../po" "$GIT_VALGRIND"/bin/po
+	make_symlink "$TEST_DIRECTORY/../share" "$GIT_VALGRIND"/bin/share
 	OLDIFS=$IFS
 	IFS=:
 	for path in $PATH
-- 
1.7.2.289.g93c76

```

## Thomas Rast, 2010-07-25 09:50

Subject: [PATCH av/i18n 2/2] Make git-sh-i18n executable
Message-ID: <d890d9ba7d967e6a191cb47194379d8f9ca5cd0d.1280051448.git.trast@student.ethz.ch>
URL: https://gitlist.dev/e/d890d9ba7d967e6a191cb47194379d8f9ca5cd0d.1280051448.git.trast%40student.ethz.ch
In-Reply-To: <ba054975988a4a799bcd81a74acd865815ae9bf5.1280051448.git.trast@student.ethz.ch>

```
git-sh-i18n was not picked up by the valgrind wrapper code because
that tests for the executable bit.  Since there does not seem to be a
particular reason why it needs to be non-executable, and this is the
path of least special-casing to fix --valgrind testing, just make it
executable.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 0 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 git-sh-i18n.sh

diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
old mode 100644
new mode 100755
-- 
1.7.2.289.g93c76

```

## Ævar Arnfjörð Bjarmason, 2010-07-25 10:19

Subject: Re: [PATCH av/i18n 2/2] Make git-sh-i18n executable
Message-ID: <AANLkTimpqw2RirLPDJkAhQIql793nwC9pc0HctIcxKKj@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTimpqw2RirLPDJkAhQIql793nwC9pc0HctIcxKKj%40mail.gmail.com
In-Reply-To: <d890d9ba7d967e6a191cb47194379d8f9ca5cd0d.1280051448.git.trast@student.ethz.ch>

```
On Sun, Jul 25, 2010 at 09:50, Thomas Rast <trast@student.ethz.ch> wrote:
> git-sh-i18n was not picked up by the valgrind wrapper code because
> that tests for the executable bit.  Since there does not seem to be a
> particular reason why it needs to be non-executable, and this is the
> path of least special-casing to fix --valgrind testing, just make it
> executable.
>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
>  0 files changed, 0 insertions(+), 0 deletions(-)
>  mode change 100644 => 100755 git-sh-i18n.sh
>
> diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
> old mode 100644
> new mode 100755
> --

Why is it including git-sh-i18n.sh? It should only be using the
generated SCRIPT_LIB git-sh-i18n file.

On my system the executable bit of git-sh-i18n.sh has no effect on the
generated git-sh-i18n file:

    $ rm git-sh-i18n; chmod +x git-sh-i18n.sh ; make ; ls -l git-sh-i18n*
        GEN git-sh-i18n
        SUBDIR git-gui
        SUBDIR gitk-git
    make[1]: Nothing to be done for `all'.
        SUBDIR perl
        SUBDIR git_remote_helpers
        SUBDIR templates
    -rw-r--r-- 1 avar avar 1965 2010-07-25 10:15 git-sh-i18n
    -rwxr-xr-x 1 avar avar 1955 2010-07-25 10:08 git-sh-i18n.sh

And this still leaves git-sh-setup without an executable bit, why
doesn't that fail under valgrind while git-sh-i18n apparently does?
Maybe something to do with it being included as
<<. "$GIT_EXEC_PATH"/git-sh-i18n>> instead of as <<. git-sh-setup>> ?

```

## Thomas Rast, 2010-07-25 13:15

Subject: Re: [PATCH av/i18n 2/2] Make git-sh-i18n executable
Message-ID: <201007251515.08916.trast@student.ethz.ch>
URL: https://gitlist.dev/e/201007251515.08916.trast%40student.ethz.ch
In-Reply-To: <AANLkTimpqw2RirLPDJkAhQIql793nwC9pc0HctIcxKKj@mail.gmail.com>

```
Ævar Arnfjörð Bjarmason wrote:
> Why is it including git-sh-i18n.sh? It should only be using the
> generated SCRIPT_LIB git-sh-i18n file.
> 
> On my system the executable bit of git-sh-i18n.sh has no effect on the
> generated git-sh-i18n file:

Hmph, you're right.  I'd have to move it into the SCRIPT_SH category
instead of SCRIPT_LIB to affect the executable bit.

Back to the drawing board I guess...

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

```

## Thomas Rast, 2010-07-25 14:55

Subject: [PATCH ab/i18n v2] tests: locate i18n lib&data correctly under --valgrind
Message-ID: <06b6dd297e87a92e1c9000f5998e7bc955933235.1280069635.git.trast@student.ethz.ch>
URL: https://gitlist.dev/e/06b6dd297e87a92e1c9000f5998e7bc955933235.1280069635.git.trast%40student.ethz.ch
In-Reply-To: <201007251515.08916.trast@student.ethz.ch>

```
The new t020[01] for gettext support did not find git-sh-i18n and the
translation data when run under --valgrind: lib-gettext.sh tried to
locate them under $GIT_EXEC_PATH, which normally is the git build
directory, but is changed by --valgrind to point to the wrappers.

Introduce a new variable $GIT_BUILD_DIR which can be used to locate
data that resides under the build directory, and use that instead.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

This approach fixes both problems in one go.

 t/lib-gettext.sh |    6 +++---
 t/test-lib.sh    |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/lib-gettext.sh b/t/lib-gettext.sh
index 831ee38..f0cdd3d 100644
--- a/t/lib-gettext.sh
+++ b/t/lib-gettext.sh
@@ -5,11 +5,11 @@
 
 . ./test-lib.sh
 
-GIT_TEXTDOMAINDIR="$GIT_EXEC_PATH/share/locale"
-GIT_PO_PATH="$GIT_EXEC_PATH/po"
+GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/share/locale"
+GIT_PO_PATH="$GIT_BUILD_DIR/po"
 export GIT_TEXTDOMAINDIR GIT_PO_PATH
 
-. "$GIT_EXEC_PATH"/git-sh-i18n
+. "$GIT_BUILD_DIR"/git-sh-i18n
 
 if test_have_prereq GETTEXT
 then
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 4ae0de8..08e5438 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -768,6 +768,7 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
 		PATH="$TEST_DIRECTORY/..:$PATH"
 	fi
 fi
+GIT_BUILD_DIR=$(pwd)/..
 GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
 unset GIT_CONFIG
 GIT_CONFIG_NOSYSTEM=1
-- 
1.7.2.289.g93c76

```
