about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-01-13 19:06:27 -1200
committerEric Wong <e@80x24.org>2021-01-15 00:19:12 +0000
commitd1b9582872d1824f166a038dcf32b6ae8c6dc735 (patch)
treeccaef6fb415731b23d83fa9e8a3526d660c5ad18 /t
parent9ecd339fc32ff9c6b8ddcc98a992f5bcc682077e (diff)
downloadpublic-inbox-d1b9582872d1824f166a038dcf32b6ae8c6dc735.tar.gz
Perl chdir() automatically does fchdir(2) if given a file
or directory handle since 5.8.8/5.10.0, so we can safely
rely on it given our 5.10.1+ requirement.

This means we no longer have to waste several milliseconds
loading the Cwd.so and making stat() calls to ensure
ENV{PWD} is correct and usable in the server.  It also lets
us work in directories that are no longer accessible via
pathname.
Diffstat (limited to 't')
-rw-r--r--t/lei.t27
1 files changed, 2 insertions, 25 deletions
diff --git a/t/lei.t b/t/lei.t
index 240735bf..2349dca4 100644
--- a/t/lei.t
+++ b/t/lei.t
@@ -208,9 +208,9 @@ if ($ENV{TEST_LEI_ONESHOT}) {
 
 SKIP: { # real socket
         require_mods(qw(Cwd), my $nr = 105);
-        my $nfd = eval { require Socket::MsgHdr; 4 } // do {
+        my $nfd = eval { require Socket::MsgHdr; 5 } // do {
                 require PublicInbox::Spawn;
-                PublicInbox::Spawn->can('send_cmd4') ? 4 : undef;
+                PublicInbox::Spawn->can('send_cmd4') ? 5 : undef;
         } //
         skip 'Socket::MsgHdr or Inline::C missing or unconfigured', $nr;
 
@@ -260,29 +260,6 @@ SKIP: { # real socket
                 like($out, qr/^usage: /, 'help output works');
                 chmod 0700, $sock or BAIL_OUT "chmod 0700: $!";
         }
-        if ('oneshot on cwd gone') {
-                my $cwd = Cwd::fastcwd() or BAIL_OUT "fastcwd: $!";
-                my $d = "$home/to-be-removed";
-                my $lei_path = 'lei';
-                # we chdir, so we need an abs_path fur run_script
-                if (($ENV{TEST_RUN_MODE}//2) != 2) {
-                        $lei_path = PublicInbox::TestCommon::key2script('lei');
-                        $lei_path = Cwd::abs_path($lei_path);
-                }
-                mkdir $d or BAIL_OUT "mkdir($d) $!";
-                chdir $d or BAIL_OUT "chdir($d) $!";
-                if (rmdir($d)) {
-                        $out = $err = '';
-                        ok(run_script([$lei_path, 'help'], undef, $opt),
-                                'cwd fail, one-shot fallback works');
-                } else {
-                        $err = "rmdir=$!";
-                }
-                chdir $cwd or BAIL_OUT "chdir($cwd) $!";
-                like($err, qr/cwd\(/, 'cwd error noted');
-                like($out, qr/^usage: /, 'help output still works');
-        }
-
         unlink $sock or BAIL_OUT "unlink($sock) $!";
         for (0..100) {
                 kill('CHLD', $new_pid) or last;