diff mbox series

[RFC,04/21] t/lib-gpg: fix setup of GNUPGHOME in MinGW

Message ID b5c116396da61f44057fbb5a8abcefe7ab1b67f4.1727881164.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Modernize the build system | expand

Commit Message

Patrick Steinhardt Oct. 2, 2024, 3:15 p.m. UTC
In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
point to a test-specific diretcory. 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.

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

Eric Sunshine Oct. 2, 2024, 9:49 p.m. UTC | #1
On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
> point to a test-specific diretcory. This is done by using "$PWD/gpghome"

s/diretcory/directory/

> 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's not clear from this description why Windows- vs. Unix-style paths
only now become a problem but have not been a problem up to this
point. Is it because PGP testing has always been disabled on Windows
until now? Or some other reason?

> Adapt the code accordingly to fix tests using this library.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
Patrick Steinhardt Oct. 7, 2024, 10:18 a.m. UTC | #2
On Wed, Oct 02, 2024 at 05:49:10PM -0400, Eric Sunshine wrote:
> On Wed, Oct 2, 2024 at 11:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> > In "t/lib-gpg.sh" we set up the "GNUPGHOME" environment variable to
> > point to a test-specific diretcory. This is done by using "$PWD/gpghome"
> 
> s/diretcory/directory/

Thanks, fixed.

> > 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's not clear from this description why Windows- vs. Unix-style paths
> only now become a problem but have not been a problem up to this
> point. Is it because PGP testing has always been disabled on Windows
> until now? Or some other reason?

I guess that nobody ever ran these tests on Windows with GnuPG
installed. It is installed in MinGW though because pacman pulls it in as
a dependency.

Anyway, I've amended the commit message accordingly.

Patrick

> > Adapt the code accordingly to fix tests using this library.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
diff mbox series

Patch

diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index add11e88fc..3845b6ac44 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 '