File: smoke

package info (click to toggle)
dash 0.5.12-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,936 kB
  • sloc: ansic: 13,402; sh: 1,409; makefile: 76; perl: 38
file content (49 lines) | stat: -rwxr-xr-x 1,238 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/perl

use strict;
use warnings;

use Cwd qw(getcwd realpath);
use File::Temp qw();
use Test::More;

my $srcdir = getcwd;

ok(-x '/bin/sh', '/bin/sh must be executable');
ok(-x '/bin/dash', '/bin/dash must be executable');
ok(-x '/bin/bash', '/bin/bash must be executable');
diag(qx(ls -l /bin/sh));
diag(qx(ls -l /bin/sh.distrib));
diag(qx(ls -l /bin/dash));
diag(qx(ls -l /bin/bash));

like(qx(dpkg -L dash),
     qr{^/bin/sh$}m,
     'dash must contain a /bin/sh symlink, for debootstrap');

is(qx(echo hello), "hello\n");

my $diverter = qx(dpkg-divert --listpackage /bin/sh);

if ($diverter eq "dash\n") {
    like(realpath('/bin/sh'), qr{^(?:/usr)?/bin/dash},
         '/bin/sh diverted by dash');
}
elsif ($diverter eq "bash\n") {
    like(realpath('/bin/sh'), qr{^(?:/usr)?/bin/dash},
         '/bin/sh diverted by dash pretending to be bash');
}
else {
    is($diverter, "LOCAL\n", '/bin/sh diverted locally');
}

my $tmpdir = File::Temp->newdir();
chdir $tmpdir;
is(system("apt-get download dash"), 0);
is(system("dpkg-deb -X *.deb ."), 0);
diag(qx(find . -ls));
chdir $srcdir;
like(readlink("$tmpdir/bin/sh"), qr{^(?:/bin/)?[bd]ash$},
     'dash_*.deb must contain a /bin/sh symlink for debootstrap');

done_testing;