Skip to content

base.t, file.t: unlink temporary files created during testing#7

Merged
toddr merged 1 commit into
Dual-Life:masterfrom
jkeenan:cleanup-tempfiles-20210823
Aug 24, 2021
Merged

base.t, file.t: unlink temporary files created during testing#7
toddr merged 1 commit into
Dual-Life:masterfrom
jkeenan:cleanup-tempfiles-20210823

Conversation

@jkeenan
Copy link
Copy Markdown

@jkeenan jkeenan commented Aug 24, 2021

I run the Perl 5 core distribution's test suite dozens of times each week. If a test file within the core distribution's test suite creates a temporary file but fails to remove it before the test program completes, then I accumulate a large number of such tempfiles on my machine's /tmp.

The Digest distribution on CPAN ships with the core. Two of its test files create tempfiles but fail to remove them. Consequently, I accumulate a large number of files with identical content. Examples:

$ ls -ltr /tmp | tail -n 3
-rw-------  1 jkeenan  wheel         5 Aug 24 02:09 9Oq34QLwyH
-rw-------  1 jkeenan  wheel       301 Aug 24 02:09 lCcOQJNXNf
-rw-r--r--  1 root     wheel         0 Aug 24 02:14 zpool-io.tmp

$ head 9Oq34QLwyH lCcOQJNXNf 
==> 9Oq34QLwyH <==
foo

==> lCcOQJNXNf <==
abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc

$ find . -type f -size 301c 2>/dev/null | wc -l
     113
$ find . -type f -size 5c 2>/dev/null | wc -l
     106

This pull request unlinks the temporary files once they're no longer needed. Please review and issue a new CPAN release so that we can synch this into core.

Thank you very much.
Jim Keenan

@jkeenan jkeenan requested a review from toddr August 24, 2021 02:23
@toddr
Copy link
Copy Markdown
Collaborator

toddr commented Aug 24, 2021

looks great. thanks Jim!

@toddr toddr merged commit 37fdefe into Dual-Life:master Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants