user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
  2021-10-28 19:16 14%                 ` [PATCH] test_common: clear XDG_CACHE_HOME before lei tests Eric Wong
@ 2021-10-28 19:22  7%                   ` Thomas Weißschuh
  0 siblings, 0 replies; 2+ results
From: Thomas Weißschuh @ 2021-10-28 19:22 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On 2021-10-28 19:16+0000, Eric Wong wrote:
> Thomas Weißschuh <thomas@t-8ch.de> wrote:
> > It turned out that in my $XDG_CONFIG_HOME/lei/all_locals_ever.git/lei_ale.state
> > there were entries for the repositories in
> > $PUBLIC_INBOX_SRC/t/home2/{t1,t2}.
> > 
> > I'm not sure how those entries came to be but probably because of some
> > debugging things I did before.
> 
> The presence of t1 & t2 entries is harmless for normal lei
> operation; but they shouldn't be there...
> 
> I wonder, do you have XDG_CACHE_HOME explicitly set in your env?
> If so, that would've caused problems (fixed below).

Yes I have it set explicitly

> > IMO it would make sense to prevent p-i to read this global state during
> > unittests.
> 
> Yes, I think this was from our failure to clobber XDG_CACHE_HOME:

That works, thanks!

Tested-by: Thomas Weißschuh <thomas@t-8ch.de>

> ------------8<------------
> Subject: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
> 
> We don't want to read a users'
> $XDG_CACHE_HOME/lei/all_locals_ever.git during tests.
> 
> Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
> Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/
> ---
>  lib/PublicInbox/TestCommon.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
> index c3820d3a..052d6e45 100644
> --- a/lib/PublicInbox/TestCommon.pm
> +++ b/lib/PublicInbox/TestCommon.pm
> @@ -556,16 +556,20 @@ SKIP: {
>  	require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
>  	my $mods = $test_opt->{mods} // [ 'lei' ];
>  	require_mods(@$mods, 2);
> +
> +	# set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME
> +	require PublicInbox::Spawn;
>  	require PublicInbox::Config;
>  	require File::Path;
> +
>  	local %ENV = %ENV;
>  	delete $ENV{XDG_DATA_HOME};
>  	delete $ENV{XDG_CONFIG_HOME};
> +	delete $ENV{XDG_CACHE_HOME};
>  	$ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
>  	$ENV{GIT_COMMITTER_NAME} = 'lei user';
>  	my (undef, $fn, $lineno) = caller(0);
>  	my $t = "$fn:$lineno";
> -	require PublicInbox::Spawn;
>  	state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||
>  				eval { require Socket::MsgHdr; 1 };
>  	unless ($lei_daemon) {

^ permalink raw reply	[relevance 7%]

* [PATCH] test_common: clear XDG_CACHE_HOME before lei tests
  @ 2021-10-28 19:16 14%                 ` Eric Wong
  2021-10-28 19:22  7%                   ` Thomas Weißschuh
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-10-28 19:16 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: meta

Thomas Weißschuh <thomas@t-8ch.de> wrote:
> It turned out that in my $XDG_CONFIG_HOME/lei/all_locals_ever.git/lei_ale.state
> there were entries for the repositories in
> $PUBLIC_INBOX_SRC/t/home2/{t1,t2}.
> 
> I'm not sure how those entries came to be but probably because of some
> debugging things I did before.

The presence of t1 & t2 entries is harmless for normal lei
operation; but they shouldn't be there...

I wonder, do you have XDG_CACHE_HOME explicitly set in your env?
If so, that would've caused problems (fixed below).

> IMO it would make sense to prevent p-i to read this global state during
> unittests.

Yes, I think this was from our failure to clobber XDG_CACHE_HOME:

------------8<------------
Subject: [PATCH] test_common: clear XDG_CACHE_HOME before lei tests

We don't want to read a users'
$XDG_CACHE_HOME/lei/all_locals_ever.git during tests.

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Link: https://public-inbox.org/meta/f239abac-4aee-4573-a0d6-e533c7a32662@t-8ch.de/
---
 lib/PublicInbox/TestCommon.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index c3820d3a..052d6e45 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -556,16 +556,20 @@ SKIP: {
 	require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2);
 	my $mods = $test_opt->{mods} // [ 'lei' ];
 	require_mods(@$mods, 2);
+
+	# set PERL_INLINE_DIRECTORY before clobbering XDG_CACHE_HOME
+	require PublicInbox::Spawn;
 	require PublicInbox::Config;
 	require File::Path;
+
 	local %ENV = %ENV;
 	delete $ENV{XDG_DATA_HOME};
 	delete $ENV{XDG_CONFIG_HOME};
+	delete $ENV{XDG_CACHE_HOME};
 	$ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com';
 	$ENV{GIT_COMMITTER_NAME} = 'lei user';
 	my (undef, $fn, $lineno) = caller(0);
 	my $t = "$fn:$lineno";
-	require PublicInbox::Spawn;
 	state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') ||
 				eval { require Socket::MsgHdr; 1 };
 	unless ($lei_daemon) {

^ permalink raw reply related	[relevance 14%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-10-25 22:24     [PATCH] t/index-git-times: support non-master default branch Thomas Weißschuh
2021-10-25 22:58     ` Eric Wong
2021-10-26  5:05       ` Thomas Weißschuh
2021-10-26  5:28         ` Eric Wong
2021-10-26 18:43           ` Thomas Weißschuh
2021-10-27 21:15             ` lei-q-remote-import failures [was: [PATCH] t/index-git-times: support non-master default branch] Eric Wong
2021-10-27 21:24               ` Thomas Weißschuh
2021-10-27 23:48                 ` Eric Wong
2021-10-28 14:03                   ` Thomas Weißschuh
2021-10-28 19:16 14%                 ` [PATCH] test_common: clear XDG_CACHE_HOME before lei tests Eric Wong
2021-10-28 19:22  7%                   ` Thomas Weißschuh

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).