unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* t/lei-daemon.t failure when PERL_INLINE_DIRECTORY is set
@ 2021-04-20 20:33 Konstantin Ryabitsev
  2021-04-20 20:38 ` Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Ryabitsev @ 2021-04-20 20:33 UTC (permalink / raw)
  To: meta

While playing with libgit2/Gcf2, I've discovered that t/lei-daemon.t will fail
when PERL_INLINE_DIRECTORY is set:

	t/lei-daemon.t ............... 18/?
	#   Failed test 'connect error noted'
	#   at t/lei-daemon.t line 80.
	#                   ''
	#     doesn't match '(?^:\bconnect\()'
	# Looks like you failed 1 test of 34.
	t/lei-daemon.t ............... Dubious, test returned 1 (wstat 256, 0x100)

I'll be happy to help troubleshoot things, since I don't know how easy it
would be to reproduce this.

-K

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: t/lei-daemon.t failure when PERL_INLINE_DIRECTORY is set
  2021-04-20 20:33 t/lei-daemon.t failure when PERL_INLINE_DIRECTORY is set Konstantin Ryabitsev
@ 2021-04-20 20:38 ` Eric Wong
  2021-04-20 21:37   ` Konstantin Ryabitsev
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2021-04-20 20:38 UTC (permalink / raw)
  To: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> While playing with libgit2/Gcf2, I've discovered that t/lei-daemon.t will fail
> when PERL_INLINE_DIRECTORY is set:
> 
> 	t/lei-daemon.t ............... 18/?
> 	#   Failed test 'connect error noted'
> 	#   at t/lei-daemon.t line 80.
> 	#                   ''
> 	#     doesn't match '(?^:\bconnect\()'
> 	# Looks like you failed 1 test of 34.
> 	t/lei-daemon.t ............... Dubious, test returned 1 (wstat 256, 0x100)
> 
> I'll be happy to help troubleshoot things, since I don't know how easy it
> would be to reproduce this.

I can't seem to reproduce it on my end with CentOS 7 and
libgit2-devel 0.26.8.  Try setting TEST_LEI_ERR_LOUD=1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: t/lei-daemon.t failure when PERL_INLINE_DIRECTORY is set
  2021-04-20 20:38 ` Eric Wong
@ 2021-04-20 21:37   ` Konstantin Ryabitsev
  2021-04-20 22:06     ` [PATCH] t/lei-daemon: skip inaccessible socket test as root Eric Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Ryabitsev @ 2021-04-20 21:37 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On Tue, Apr 20, 2021 at 08:38:54PM +0000, Eric Wong wrote:
> > 	t/lei-daemon.t ............... 18/?
> > 	#   Failed test 'connect error noted'
> > 	#   at t/lei-daemon.t line 80.
> > 	#                   ''
> > 	#     doesn't match '(?^:\bconnect\()'
> > 	# Looks like you failed 1 test of 34.
> > 	t/lei-daemon.t ............... Dubious, test returned 1 (wstat 256, 0x100)
> > 
> > I'll be happy to help troubleshoot things, since I don't know how easy it
> > would be to reproduce this.
> 
> I can't seem to reproduce it on my end with CentOS 7 and
> libgit2-devel 0.26.8.  Try setting TEST_LEI_ERR_LOUD=1

While poking around, I've discovered that it only fails when "make test" runs
as root (don't judge -- this is in a throwaway lab VM):

	t/lei-daemon.t ............... 1/? # lei_err=/tmp/pi-lei-daemon-6667-ojwj/lei-daemon/xdg_run/lei/errors.log from previous run
	# phail

	#   Failed test 'connect error noted'
	#   at t/lei-daemon.t line 80.
	#                   ''
	#     doesn't match '(?^:\bconnect\()'
	# Looks like you failed 1 test of 34.
	t/lei-daemon.t ............... Dubious, test returned 1 (wstat 256, 0x100)
	Failed 1/34 subtests

When I run as a non-root user, it passes:

	t/lei-daemon.t ............... 1/? # lei_err=/tmp/pi-lei-daemon-11879-P3hC/lei-daemon/xdg_run/lei/errors.log from previous run
	# phail
	# lei_err=connect(/tmp/pi-lei-daemon-11879-P3hC/lei-daemon/xdg_run/lei/5.seq.sock): Permission denied at /home/mricon/public-inbox/blib/lib/PublicInbox/LEI.pm line 1073.
	# lei-daemon could not start, exited with $?=3328
	# connect(/tmp/pi-lei-daemon-11879-P3hC/lei-daemon/xdg_run/lei/5.seq.sock): Permission denied (after attempted daemon start)
	# Falling back to (slow) one-shot mode
	t/lei-daemon.t ............... ok

Hope that helps.

-K

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] t/lei-daemon: skip inaccessible socket test as root
  2021-04-20 21:37   ` Konstantin Ryabitsev
@ 2021-04-20 22:06     ` Eric Wong
  2021-04-21 15:03       ` Konstantin Ryabitsev
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2021-04-20 22:06 UTC (permalink / raw)
  To: meta

Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> While poking around, I've discovered that it only fails when "make test" runs
> as root (don't judge -- this is in a throwaway lab VM):

> Hope that helps.

Yes :)

----------8<--------
Subject: [PATCH] t/lei-daemon: skip inaccessible socket test as root

"chmod 0000" on a Unix socket can't stop root from connecting to it;
so just skip the test for rare cases when testing as root.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://public-inbox.org/meta/20210420213712.qfpftr2r543cqg7l@nitro.local/
---
 t/lei-daemon.t | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/lei-daemon.t b/t/lei-daemon.t
index 35e059b9..84e2791d 100644
--- a/t/lei-daemon.t
+++ b/t/lei-daemon.t
@@ -74,7 +74,8 @@ test_lei({ daemon_only => 1 }, sub {
 	chomp $lei_out;
 	is($lei_out, $new_pid, 'PID unchanged after -0/-CHLD');
 
-	if ('socket inaccessible') {
+	SKIP: { # socket inaccessible
+		skip "cannot test connect EPERM as root", 3 if $> == 0;
 		chmod 0000, $sock or BAIL_OUT "chmod 0000: $!";
 		lei_ok('help', \'connect fail, one-shot fallback works');
 		like($lei_err, qr/\bconnect\(/, 'connect error noted');

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] t/lei-daemon: skip inaccessible socket test as root
  2021-04-20 22:06     ` [PATCH] t/lei-daemon: skip inaccessible socket test as root Eric Wong
@ 2021-04-21 15:03       ` Konstantin Ryabitsev
  0 siblings, 0 replies; 5+ messages in thread
From: Konstantin Ryabitsev @ 2021-04-21 15:03 UTC (permalink / raw)
  To: Eric Wong; +Cc: meta

On Tue, Apr 20, 2021 at 10:06:08PM +0000, Eric Wong wrote:
> Konstantin Ryabitsev <konstantin@linuxfoundation.org> wrote:
> > While poking around, I've discovered that it only fails when "make test" runs
> > as root (don't judge -- this is in a throwaway lab VM):
> 
> > Hope that helps.
> 
> Yes :)

I can confirm that the error is gone now. Thanks!

-K

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-21 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 20:33 t/lei-daemon.t failure when PERL_INLINE_DIRECTORY is set Konstantin Ryabitsev
2021-04-20 20:38 ` Eric Wong
2021-04-20 21:37   ` Konstantin Ryabitsev
2021-04-20 22:06     ` [PATCH] t/lei-daemon: skip inaccessible socket test as root Eric Wong
2021-04-21 15:03       ` Konstantin Ryabitsev

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).