aboutsummaryrefslogtreecommitdiff
path: root/lang/perl/patches/710-threads_join-skip_ps_on_busybox.patch
blob: e60ee8cc1f10808f0a54a55e8160f0b206b54f21 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
perl: Skip $0 test on busybox

This test requires a ps which provides the -f option, as well as suitable output.
We can't provide either with busybox. Just skip it for now.

Signed-off-by: Marcel Denia <naoir@gmx.net>

--- a/dist/threads/t/join.t
+++ b/dist/threads/t/join.t
@@ -110,36 +110,41 @@ sub skip {
 
 # We parse ps output so this is OS-dependent.
 if ($^O eq 'linux') {
-    # First modify $0 in a subthread.
-    #print "# mainthread: \$0 = $0\n";
-    threads->create(sub{ #print "# subthread: \$0 = $0\n";
-                        $0 = "foobar";
-                        #print "# subthread: \$0 = $0\n"
-                 })->join;
-    #print "# mainthread: \$0 = $0\n";
-    #print "# pid = $$\n";
-    if (open PS, "ps -f |") { # Note: must work in (all) systems.
-        my ($sawpid, $sawexe);
-        while (<PS>) {
-            chomp;
-            #print "# [$_]\n";
-            if (/^\s*\S+\s+$$\s/) {
-                $sawpid++;
-                if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
-                    $sawexe++;
-                }
-                last;
-            }
-        }
-        close PS or die;
-        if ($sawpid) {
-            ok($sawpid && $sawexe, 'altering $0 is effective');
-        } else {
-            skip("\$0 check: did not see pid $$ in 'ps -f |'");
-        }
-    } else {
-        skip("\$0 check: opening 'ps -f |' failed: $!");
-    }
+	if (readlink('/bin/ps') ne 'busybox') {
+		# First modify $0 in a subthread.
+		#print "# mainthread: \$0 = $0\n";
+		threads->create(sub{ #print "# subthread: \$0 = $0\n";
+							$0 = "foobar";
+							#print "# subthread: \$0 = $0\n"
+					})->join;
+		#print "# mainthread: \$0 = $0\n";
+		#print "# pid = $$\n";
+		if (open PS, "ps -f |") { # Note: must work in (all) systems.
+			my ($sawpid, $sawexe);
+			while (<PS>) {
+				chomp;
+				#print "# [$_]\n";
+				if (/^\s*\S+\s+$$\s/) {
+					$sawpid++;
+					if (/\sfoobar\s*$/) { # Linux 2.2 leaves extra trailing spaces.
+						$sawexe++;
+					}
+					last;
+				}
+			}
+			close PS or die;
+			if ($sawpid) {
+				ok($sawpid && $sawexe, 'altering $0 is effective');
+			} else {
+				skip("\$0 check: did not see pid $$ in 'ps -f |'");
+			}
+		} else {
+			skip("\$0 check: opening 'ps -f |' failed: $!");
+		}
+	}
+	else {
+		skip("\$0 check: incompatible with busybox");
+	}
 } else {
     skip("\$0 check: only on Linux");
 }