diff mbox series

[04/10] t/lib-gpg: fix setup of GNUPGHOME in MinGW

Message ID f5700647839a21b5aed0d2dc45e65bed36ddd392.1728906490.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Platform compatibility fixes | expand

Commit Message

Patrick Steinhardt Oct. 14, 2024, 12:21 p.m. UTC
In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
point to a test-specific directory. This is done by using "$PWD/gpghome"
as value, where "$PWD" is the current test's trash directory.

This is broken for MinGW though because "$PWD" will use Windows-style
paths that contain drive letters. What we really want in this context is
a Unix-style path, which we can get by using `$(pwd)` instead. It is
somewhat puzzling that nobody ever hit this issue, but it may easily be
that nobody ever tests on Windows with GnuPG installed, which would make
us skip those tests.

Adapt the code accordingly to fix tests using this library.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/lib-gpg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Taylor Blau Oct. 14, 2024, 10:07 p.m. UTC | #1
On Mon, Oct 14, 2024 at 02:21:20PM +0200, Patrick Steinhardt wrote:
> In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
> point to a test-specific directory. This is done by using "$PWD/gpghome"
> as value, where "$PWD" is the current test's trash directory.
>
> This is broken for MinGW though because "$PWD" will use Windows-style
> paths that contain drive letters. What we really want in this context is
> a Unix-style path, which we can get by using `$(pwd)` instead. It is
> somewhat puzzling that nobody ever hit this issue, but it may easily be
> that nobody ever tests on Windows with GnuPG installed, which would make
> us skip those tests.

Heh. I am sure that the story of finding such a failure was probably an
interesting one as a result ;-).

> Adapt the code accordingly to fix tests using this library.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  t/lib-gpg.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
> index add11e88fc0..3845b6ac449 100644
> --- a/t/lib-gpg.sh
> +++ b/t/lib-gpg.sh
> @@ -6,7 +6,7 @@
>  #   executed in an eval'ed subshell that changes the working directory to a
>  #   temporary one.
>
> -GNUPGHOME="$PWD/gpghome"
> +GNUPGHOME="$(pwd)/gpghome"

Makes sense. Thanks for finding and fixing.

Thanks,
Taylor
diff mbox series

Patch

diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index add11e88fc0..3845b6ac449 100644
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -6,7 +6,7 @@ 
 #   executed in an eval'ed subshell that changes the working directory to a
 #   temporary one.
 
-GNUPGHOME="$PWD/gpghome"
+GNUPGHOME="$(pwd)/gpghome"
 export GNUPGHOME
 
 test_lazy_prereq GPG '