Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: use File::Temp to create temporary directory #343

Merged
merged 2 commits into from
Aug 18, 2024

Conversation

auerswal
Copy link
Collaborator

Before, ci/test-11-unpriv.pl used a hard-coded file name of /tmp/fping.copy to create an unprivileged copy of fping. This file was not deleted after it was no longer used.

Now, the unprivileged fping copy is created in a temporary directory that is deleted after all tests from the file.

This addresses GH issue #339.

@coveralls
Copy link

coveralls commented Aug 11, 2024

Coverage Status

coverage: 87.526%. remained the same
when pulling 1cdc418 on auerswal:ci_tmp_dir
into 096a75f on schweikert:develop.

@gsnw-sebast
Copy link
Collaborator

Considering system independence, I would suggest using File::Copy instead of system()

use File::Copy;

copy("datafile.dat", "datafile.bak") or die "copy failed: $!";

The chmod function should also be available directly in perl (https://perldoc.perl.org/functions/chmod)

Before, ci/test-11-unpriv.pl used a hard-coded file name of
/tmp/fping.copy to create an unprivileged copy of fping.  This
file was not deleted after it was no longer used.

Now, the unprivileged fping copy is created in a temporary
directory that is deleted after all tests from the file.

This addresses GH issue schweikert#339.
Before, ci/test-11-unpriv.pl used Perl's "system" function
to execute a Unix command line to copy a file and change the
permissions of the copy.

Now, the Perl functions "copy" (from File::Copy) and "chmod"
are used instead.
@auerswal auerswal marked this pull request as ready for review August 17, 2024 17:13
@gsnw-sebast
Copy link
Collaborator

You can merge, everything looks good

@auerswal
Copy link
Collaborator Author

Thanks for the review. I'll go ahead and merge this now.

@auerswal auerswal merged commit 54f452c into schweikert:develop Aug 18, 2024
9 checks passed
@auerswal auerswal deleted the ci_tmp_dir branch August 18, 2024 15:02
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.

Test ci/test-11-unpriv.pl uses hard-coded copy destination and does not clean up afterwards
3 participants