summaryrefslogtreecommitdiff
path: root/Bugs/crash1
blob: 7e6eff79425738f8af2bfbd1fa0a135dc61af042 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!./perl
# These filenames doesn't seem to matter, as long as the first one exists,
# and we have permission to create the second one.
open(OLD_FILE, "/etc/passwd");
open(NEW_FILE, ">/tmp/foobar");

# This line is unnecessary to trigger death, but it helps to show where
# we crash and burn.
$| = 1;

#  Seemingly, this loop is necessary to activate the bug.  If I just say
#     $_ = <OLD_FILE>
#  instead of the loop, everything works as expected.
while (<OLD_FILE>) {
  #  This was originally just a random typing spaz on my part, but it causes
  #  perl to crash later.
  print <NEW_FILE>;
}

print "About to die...\n";
print "dest = '$dest'\n";
print "Didn't die!\n";