Commit cebf3dd2 authored by Tobias Frost's avatar Tobias Frost

Import Upstream version 3.8.7

parent 01d65c7c
3.8.6 -> 3.8.7
- Fixed --force/-f option handling together with "size" directive
(3.8.5 regression).
- Use "logrotate_tmp_t" context for SELinux tests and if this context does
not exist, skip SELinux related tests.
3.8.5 -> 3.8.6
- Fixed memory corruption caused by rotation directory which does not
exist with "sharedscripts" together with "prerotate" script.
......
......@@ -830,11 +830,12 @@ int findNeedRotating(struct logInfo *log, int logNum, int force)
return 0;
}
if (log->criterium == ROT_SIZE) {
state->doRotate = (sb.st_size >= log->threshhold);
} else if (force) {
if (force) {
/* user forced rotation of logs from command line */
state->doRotate = 1;
state->doRotate = 1;
}
else if (log->criterium == ROT_SIZE) {
state->doRotate = (sb.st_size >= log->threshhold);
} else if (mktime(&state->lastRotated) - mktime(&now) > (25 * 3600)) {
/* 25 hours allows for DST changes as well as geographical moves */
message(MESS_ERROR,
......
Summary: Rotates, compresses, removes and mails system log files
Name: logrotate
Version: 3.8.6
Version: 3.8.7
Release: 1
License: GPL+
Group: System Environment/Base
......@@ -52,6 +52,9 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644, root, root) %verify(not size md5 mtime) %config(noreplace) %{_localstatedir}/lib/logrotate.status
%changelog
* Thu Oct 10 2013 Jan Kaluza <jkaluza@redhat.com> 3.8.7-1
- new upstream version
* Wed Jul 31 2013 Jan Kaluza <jkaluza@redhat.com> 3.8.6-1
- new upstream version
......
......@@ -46,6 +46,17 @@ if [ $SELINUX_TESTS == 1 ]; then
fi
fi
fi
if [ $SELINUX_TESTS == 1 ]; then
# if logrotate_tmp_t, we can't continue with SELinux tests...
touch .selinuxtest
chcon --type=logrotate_tmp_t .selinuxtest 2>/dev/null
if [ $? != 0 ]; then
SELINUX_TESTS=0
echo "SELinux context 'logrotate_tmp_t' does not exist. SELinux tests will not be executed."
fi
rm -f .selinuxtest
fi
# -- SELINUX - END ----------------------------------
......@@ -301,22 +312,22 @@ cleanup 6
preptest test.log 6 1
preptest anothertest.log 6 1
if [ $SELINUX_TESTS == 1 ]; then
chcon --type=httpd_sys_content_t test.log
chcon --type=logrotate_tmp_t test.log
else
echo "Skipping SELinux part of test 6"
fi
$RLR test-config.6 --force
if [ $SELINUX_TESTS == 1 ]; then
ls -Z test.log.0|grep httpd_sys_content_t >/dev/null
ls -Z test.log.0|grep logrotate_tmp_t >/dev/null
if [ $? != 0 ]; then
echo "test.log.0 should have selinux context httpd_sys_content_t."
echo "test.log.0 should have selinux context logrotate_tmp_t."
exit 3
fi
ls -Z anothertest.log.0|grep httpd_sys_content_t >/dev/null
ls -Z anothertest.log.0|grep logrotate_tmp_t >/dev/null
if [ $? == 0 ]; then
echo "anothertest.log.0 should not have selinux context httpd_sys_content_t."
echo "anothertest.log.0 should not have selinux context logrotate_tmp_t."
exit 3
fi
fi
......@@ -378,7 +389,7 @@ cleanup 10
preptest test.log 10 1
if [ $SELINUX_TESTS == 1 ]; then
chcon --type=httpd_sys_content_t test.log
chcon --type=logrotate_tmp_t test.log
else
echo "Skipping SELinux part of test 10"
fi
......@@ -395,16 +406,16 @@ echo "newfile" > test.log
$RLR test-config.10 --force
if [ $SELINUX_TESTS == 1 ]; then
ls -Z test.log.2.gz|grep httpd_sys_content_t >/dev/null
ls -Z test.log.2.gz|grep logrotate_tmp_t >/dev/null
if [ $? != 0 ]; then
echo "test.log.2.gz should have selinux context httpd_sys_content_t."
echo "test.log.2.gz should have selinux context logrotate_tmp_t."
ls -Z test.log.2.gz
exit 3
fi
ls -Z test.log.1|grep httpd_sys_content_t >/dev/null
ls -Z test.log.1|grep logrotate_tmp_t >/dev/null
if [ $? != 0 ]; then
echo "test.log.1 should have selinux context httpd_sys_content_t."
echo "test.log.1 should have selinux context logrotate_tmp_t."
ls -Z test.log.1
exit 3
fi
......@@ -1154,7 +1165,7 @@ EOF
if [ $SELINUX_TESTS == 1 ]; then
chcon --type=httpd_sys_content_t test.log
chcon --type=logrotate_tmp_t test.log
else
echo "Skipping SELinux part of test 6"
fi
......@@ -1172,13 +1183,13 @@ cat > state << EOF
logrotate state -- version 2
EOF
chcon --type=httpd_sys_content_t state
chcon --type=logrotate_tmp_t state
$RLR test-config.47
ls -Z state|grep httpd_sys_content_t >/dev/null
ls -Z state|grep logrotate_tmp_t >/dev/null
if [ $? != 0 ]; then
echo "state file should have selinux context httpd_sys_content_t."
echo "state file should have selinux context logrotate_tmp_t."
exit 3
fi
......@@ -1334,4 +1345,17 @@ test.log.1 0 zero
scriptout 0 foo
EOF
cleanup 53
# ------------------------------- Test 53 ------------------------------------
# test if --force works
preptest test.log 53 1 0
$RLR test-config.53 --force
checkoutput <<EOF
test.log 0
test.log.1 0 zero
EOF
cleanup
create
&DIR&/test.log {
rotate 14
size 4096
missingok
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment