Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

32 changed files with 386 additions and 69 deletions

View File

@ -1 +0,0 @@
a1734aa9da9188aecd8f96d59551f191ddac545a SOURCES/at_3.1.20.orig.tar.gz

12
.gitignore vendored
View File

@ -1 +1,11 @@
SOURCES/at_3.1.20.orig.tar.gz
at_3.1.10.tar.gz
test.pl
at_3.1.11.orig.tar.gz
at_3.1.12.orig.tar.gz
/at_3.1.13.orig.tar.gz
/at_3.1.14.orig.tar.gz
/at_3.1.16.orig.tar.gz
/at_3.1.18.orig.tar.gz
/at_3.1.20.orig.tar.gz
/at_3.1.23.orig.tar.gz
/at_3.1.23.orig.tar.gz.asc

View File

@ -1,22 +0,0 @@
diff -up at-3.1.20/atd.8.in.document-n at-3.1.20/atd.8.in
--- at-3.1.20/atd.8.in.document-n 2015-08-22 00:09:22.000000000 +0200
+++ at-3.1.20/atd.8.in 2017-09-14 14:17:04.922086349 +0200
@@ -9,6 +9,7 @@ atd \- run jobs queued for later executi
.IR batch_interval ]
.RB [ -d ]
.RB [ -f ]
+.RB [ -n ]
.RB [ -s ]
.SH DESCRIPTION
.B atd
@@ -40,6 +41,10 @@ Run
.BR atd
in the foreground.
.TP 8
+.B -n
+Append the hostname of the system to the subject of the e-mails sent by
+.BR atd .
+.TP 8
.B -s
Process the at/batch queue only once.
This is primarily of use for compatibility with old versions of

View File

@ -0,0 +1,22 @@
diff -up at-3.1.23/atd.8.in.document-n at-3.1.23/atd.8.in
--- at-3.1.23/atd.8.in.document-n 2018-08-27 14:49:09.824182482 +0200
+++ at-3.1.23/atd.8.in 2018-08-27 14:50:34.625518639 +0200
@@ -9,6 +9,7 @@ atd \- run jobs queued for later executi
.IR batch_interval ]
.RB [ \-d ]
.RB [ \-f ]
+.RB [ \-n ]
.RB [ \-s ]
.SH DESCRIPTION
.B atd
@@ -44,6 +45,10 @@ in the foreground.
Process the at/batch queue only once.
This is primarily of use for compatibility with old versions of
.BR at ;
+.B \-n
+Append the hostname of the system to the subject of the e-mails sent by
+.BR atd .
+.TP 8
.B "atd \-s"
is equivalent to the old
.B atrun

View File

@ -0,0 +1,115 @@
From 4be4813262b3b57a95a5f3ce909d30741aa3ac72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Fri, 9 Apr 2021 16:47:33 +0200
Subject: [PATCH] Address issues raised by static analysis
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan Staněk <jstanek@redhat.com>
---
at.c | 22 ++++++++++++++++++----
daemon.c | 21 ++++++++++++++-------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/at.c b/at.c
index df55dc9..0c74e2e 100644
--- a/at.c
+++ b/at.c
@@ -545,17 +545,27 @@ writefile(time_t runtimer, char queue)
return;
}
- if (fstat(fd, &statbuf) == -1)
+ if (fstat(fd, &statbuf) == -1) {
+ close(fd);
return;
+ }
if ((statbuf.st_uid != 0) || !S_ISREG(statbuf.st_mode) ||
- (statbuf.st_mode & (S_IWGRP | S_IWOTH)))
+ (statbuf.st_mode & (S_IWGRP | S_IWOTH))) {
+ close(fd);
return;
+ }
fp = fdopen(fd, "r");
- if (fp == NULL)
+ if (fp == NULL) {
+ close(fd);
return;
- if (fscanf(fp, "%d", &pid) != 1)
+ }
+ if (fscanf(fp, "%d", &pid) != 1) {
+ fclose(fp);
return;
+ } else {
+ fclose(fp);
+ }
kill_errno = 0;
@@ -640,6 +650,8 @@ list_jobs(void)
else
printf("%ld\t%s %c\n", jobno, timestr, queue);
}
+ closedir(spool);
+
PRIV_END
}
@@ -722,6 +734,8 @@ process_jobs(int argc, char **argv, int what)
putchar(ch);
}
done = 1;
+ fclose(fp);
+ fp = NULL;
}
else {
perr("Cannot open %.500s", dirent->d_name);
diff --git a/daemon.c b/daemon.c
index 4003b56..bc8191e 100644
--- a/daemon.c
+++ b/daemon.c
@@ -122,18 +122,23 @@ daemon_setup()
/* Set up standard daemon environment */
pid_t pid;
mode_t old_umask;
- int fd;
+ int fd, devnull;
FILE *fp;
if (!daemon_debug) {
- close(0);
- close(1);
- close(2);
- if ((open("/dev/null", O_RDWR) != 0) ||
- (open("/dev/null", O_RDWR) != 1) ||
- (open("/dev/null", O_RDWR) != 2)) {
+ devnull = open("/dev/null", O_RDWR);
+ if (devnull == -1) {
perr("Error redirecting I/O");
}
+
+ if ((dup2(devnull, 0) == -1) ||
+ (dup2(devnull, 1) == -1) ||
+ (dup2(devnull, 2) == -1)) {
+ close(devnull);
+ perr("Error redirecting I/O");
+ } else {
+ close(devnull);
+ }
}
if (daemon_foreground)
@@ -208,6 +213,8 @@ daemon_setup()
fcntl(fd, F_SETFD, FD_CLOEXEC);
PRIV_END
+ /* See the above comment. */
+ /* coverity[leaked_storage: FALSE] */
return;
}
--
2.31.1

View File

@ -2,12 +2,11 @@
Summary: Job spooling tools
Name: at
Version: 3.1.20
Release: 12%{?dist}
Version: 3.1.23
Release: 11%{?dist}
# http://packages.debian.org/changelogs/pool/main/a/at/current/copyright
# + install-sh is MIT license with changes under Public Domain
License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain
Group: System Environment/Daemons
URL: http://ftp.debian.org/debian/pool/main/a/at
Source: http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz
@ -16,23 +15,24 @@ Source1: pam_atd
Source3: atd.sysconf
Source5: atd.systemd
Patch0: at-aarch64.patch
Patch1: at-3.1.18-make.patch
Patch2: at-3.1.20-pam.patch
Patch4: at-3.1.14-opt_V.patch
Patch5: at-3.1.20-shell.patch
Patch6: at-3.1.18-nitpicks.patch
Patch8: at-3.1.14-fix_no_export.patch
Patch9: at-3.1.14-mailwithhostname.patch
Patch10: at-3.1.14-usePOSIXtimers.patch
Patch12: at-3.1.20-aborted-jobs.patch
Patch13: at-3.1.18-noabort.patch
Patch14: at-3.1.16-fclose-error.patch
Patch15: at-3.1.16-clear-nonjobs.patch
Patch16: at-3.1.18-utc-dst.patch
Patch17: at-3.1.20-lock-locks.patch
Patch18: at-3.1.20-document-n.patch
Patch19: at-3.1.20-log-jobs.patch
Patch: at-aarch64.patch
Patch: at-3.1.18-make.patch
Patch: at-3.1.20-pam.patch
Patch: at-3.1.14-opt_V.patch
Patch: at-3.1.20-shell.patch
Patch: at-3.1.18-nitpicks.patch
Patch: at-3.1.14-fix_no_export.patch
Patch: at-3.1.14-mailwithhostname.patch
Patch: at-3.1.14-usePOSIXtimers.patch
Patch: at-3.1.20-aborted-jobs.patch
Patch: at-3.1.18-noabort.patch
Patch: at-3.1.16-fclose-error.patch
Patch: at-3.1.16-clear-nonjobs.patch
Patch: at-3.1.18-utc-dst.patch
Patch: at-3.1.20-lock-locks.patch
Patch: at-3.1.23-document-n.patch
Patch: at-3.1.20-log-jobs.patch
Patch: at-3.2.23-coverity-fix.patch
BuildRequires: gcc
BuildRequires: flex flex-static bison autoconf
@ -46,6 +46,7 @@ BuildRequires: pam-devel
Conflicts: crontabs <= 1.5
# No, I'm not kidding
BuildRequires: smtpdaemon
BuildRequires: make
Requires(post): systemd-units
Requires(preun): systemd-units
@ -66,28 +67,12 @@ need to be repeated at the same time every day/week, etc. you should
use crontab instead.
%prep
%setup -q
%autosetup -N
cp %{SOURCE1} .
%patch0 -p1 -b .arm
%patch1 -p1 -b .make
%patch2 -p1 -b .pam
%patch4 -p1 -b .opt_V
%patch5 -p1 -b .shell
%patch6 -p1 -b .nit
%patch8 -p1 -b .export
%patch9 -p1 -b .mail
%patch10 -p1 -b .posix
%patch12 -p1 -b .aborted
%patch13 -p1 -b .noabort
%patch14 -p1 -b .fclose
%patch15 -p1 -b .clear-nojobs
%patch16 -p1 -b .dst
%patch17 -p1 -b .lock-locks
%patch18 -p1 -b .document-n
%patch19 -p1 -b .log-jobs
%autopatch -p1
%build
# patch9 touches configure.in
# at-3.1.14-usePOSIXtimers.patch touches configure.in
autoconf
# uselles files
rm -f lex.yy.* y.tab.*
@ -96,9 +81,7 @@ rm -f lex.yy.* y.tab.*
--with-daemon_username=root \
--with-daemon_groupname=root \
--with-selinux \
%if %{with pam}
--with-pam
%endif
%{?with_pam:--with-pam}
make
@ -183,9 +166,44 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%attr(0644,root,root) /%{_unitdir}/atd.service
%changelog
* Mon Apr 04 2022 Jan Staněk <jstanek@redhat.com> - 3.1.20-12
* Fri Apr 01 2022 Jan Staněk <jstanek@redhat.com> - 3.1.23-10
- Add preceding newline to delimiter in at-3.1.20-shell.patch
Resolves: rhbz#2070450
Resolves: rhbz#2070858
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065
* Fri Apr 23 2021 Jan Staněk <jstanek@redhat.com> - 3.1.23-8
- Patch issues found by coverity. Resolves: rhbz#1938678
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 3.1.23-7
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.23-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.23-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.23-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.23-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.23-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Aug 27 2018 Tomáš Mráz <tmraz@redhat.com> - 3.1.23-1
- new upstream release
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.20-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed May 23 2018 Tomáš Mráz <tmraz@redhat.com> - 3.1.20-11
- log the jobs being run

View File

@ -1,11 +1,13 @@
[Unit]
Description=Job spooling tools
Description=Deferred execution scheduler
Documentation=man:atd(8)
After=syslog.target systemd-user-sessions.service
[Service]
EnvironmentFile=/etc/sysconfig/atd
ExecStart=/usr/sbin/atd -f $OPTS
IgnoreSIGPIPE=no
KillMode=process
[Install]
WantedBy=multi-user.target

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (at_3.1.23.orig.tar.gz) = ee5cf5abf32cf1e89746e427d1cc20005ef49fad47db55512c90042a77e86b2c15f5de029c79573bc86ce4aead6ed2d561b89812510aadbc5763f9288b467cfd
SHA512 (at_3.1.23.orig.tar.gz.asc) = ccc32753d31cccd6257c25acfda3f407c3cab52ca9b6c120eca852207cb00e143daa78b81bc65cc2703c5f94cf5d7fae08d301cfc57541e1ebd31df6ae2121bb

1
tests/at Submodule

@ -0,0 +1 @@
Subproject commit 30cccc88a2064eb05018a09d65164a26972cd5b5

61
tests/initscript/Makefile Normal file
View File

@ -0,0 +1,61 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/at/Sanity/initscript
# Description: Initscript sanity
# Author: Radek Biba <rbiba@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/at/Sanity/initscript
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
$(METADATA): Makefile
@echo "Owner: Radek Biba <rbiba@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Initscript sanity" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "Releases: -RHEL3 -RHEL4 -RHELServer5 -RHELClient5 -RedHatEnterpriseLinux3 -RedHatEnterpriseLinux4 -RedHatEnterpriseLinuxClient5 -RedHatEnterpriseLinuxServer5" >> $(METADATA)
@echo "RunFor: at" >> $(METADATA)
@echo "Requires: at" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

3
tests/initscript/PURPOSE Normal file
View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/at/Sanity/initscript
Description: Initscript sanity
Author: Radek Biba <rbiba@redhat.com>

87
tests/initscript/runtest.sh Executable file
View File

@ -0,0 +1,87 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/at/Sanity/initscript
# Description: Initscript sanity
# Author: Radek Biba <rbiba@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/share/rhts-library/rhtslib.sh
PACKAGE="at"
SERVICE="atd"
rlJournalStart
rlPhaseStartSetup "Prepare"
rlServiceStop $SERVICE
rlPhaseEnd
if rlIsRHEL "<7"; then
rlPhaseStartTest "Mandatory actions"
for ACTION in "start" "stop" "restart" "force-reload" "status" ; do
rlRun "grep -i \"usage.*$ACTION\" /etc/init.d/$SERVICE"
done
rlPhaseEnd
fi
rlPhaseStartTest "Start"
rlRun "service $SERVICE start" 0
rlRun "service $SERVICE status" 0
rlRun "service $SERVICE start" 0
rlRun "service $SERVICE status" 0
rlRun "service $SERVICE restart" 0
rlRun "service $SERVICE status" 0
rlRun "service $SERVICE force-reload" 0
rlRun "service $SERVICE status" 0
rlRun "service $SERVICE try-restart" 0
rlRun "service $SERVICE status" 0
rlPhaseEnd
rlPhaseStartTest "Stop"
rlRun "service $SERVICE stop" 0
rlRun "service $SERVICE status" 3
rlRun "service $SERVICE stop" 0
rlRun "service $SERVICE status" 3
rlRun "service $SERVICE try-restart" 0
rlRun "service $SERVICE status" 3
rlPhaseEnd
rlPhaseStartTest "Dead service"
rlRun "touch /var/lock/subsys/$SERVICE"
rlRun "service $SERVICE status" $(
if rlIsRHEL "<7"; then
echo 2;
else
echo 3;
fi
)
rlRun "service $SERVICE start" 0
rlRun "service $SERVICE status" 0
rlPhaseEnd
rlPhaseStartTest "Invalid arguments"
rlRun "service $SERVICE" 2
rlRun "service $SERVICE fubar" 2
rlPhaseEnd
rlPhaseStartCleanup "Restore"
rlServiceRestore $SERVICE
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

13
tests/tests.yml Normal file
View File

@ -0,0 +1,13 @@
---
# This first play always runs on the local staging system
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
- container
- atomic
tests:
- initscript
required_packages:
- at # Required to run initscript