update version to 3.2.2

This commit is contained in:
yang_zhuang_zhuang 2021-12-25 16:45:17 +08:00
parent c8b84305f3
commit 456a2b4225
9 changed files with 149 additions and 47 deletions

View File

@ -17,7 +17,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
y.tab.c y.tab.h: parsetime.y y.tab.c y.tab.h: parsetime.y
$(YACC) -d parsetime.y $(YACC) -d parsetime.y
@@ -89,38 +89,41 @@ atrun: atrun.in @@ -92,40 +92,41 @@ atrun: atrun.in
configure configure
.c.o: .c.o:
@ -28,6 +28,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir) - $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir) - $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir) - $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdatadir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir) - $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir) - $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR) - $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
@ -52,6 +53,7 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
$(LN_S) -f at $(IROOT)$(bindir)/atq $(LN_S) -f at $(IROOT)$(bindir)/atq
$(LN_S) -f at $(IROOT)$(bindir)/atrm $(LN_S) -f at $(IROOT)$(bindir)/atrm
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir) - $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
- $(INSTALL) -g root -o root -m 755 batch-job $(IROOT)$(atdatadir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir) - $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir) - $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir) - $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)

View File

@ -1,24 +0,0 @@
diff -up at-3.1.18/parsetime.y.dst at-3.1.18/parsetime.y
--- at-3.1.18/parsetime.y.dst 2015-12-06 16:45:10.000000000 +0100
+++ at-3.1.18/parsetime.y 2015-07-01 13:53:14.088881926 +0200
@@ -476,8 +476,8 @@ parsetime(time_t currtime, int argc, cha
exectm = *localtime(&currtime);
currtime -= exectm.tm_sec;
exectm.tm_sec = 0;
- exectm.tm_isdst = -1;
memcpy(&currtm,&exectm,sizeof(currtm));
+ exectm.tm_isdst = -1;
time_only = 0;
yearspec = 0;
@@ -503,8 +503,8 @@ parsetime(time_t currtime, int argc, cha
return 0;
if (isgmt) {
exectime -= timezone;
- if (currtm.tm_isdst && !exectm.tm_isdst)
- exectime -= 3600;
+ if (exectm.tm_isdst)
+ exectime += 3600;
}
if (exectime < currtime)
panic("refusing to create job destined in the past");

View File

@ -77,32 +77,35 @@ diff -up at-3.1.20/atd.c.lock-locks at-3.1.20/atd.c
unlink(newname); unlink(newname);
free(newname); free(newname);
@@ -723,16 +732,18 @@ run_loop() @@ -732,16 +732,18 @@ run_loop()
/* Skip lock files */ /* Skip lock files */
if (queue == '=') { if (queue == '=') {
- /* FIXME: calhariz */ - /* FIXME: calhariz */
- /* I think the following code is broken, but commenting - /* I think the following code is broken, but commenting it
- may haven unknow side effects. Make a release and see - may cause unknow side effects. Make a release and see
- in the wild how it works. For more information see: - in the wild how it works. For more information see:
- https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818508/* - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818508 */
- -
- /* if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) { */ - /* if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) { */
- /* /\* Remove stale lockfile FIXME: lock the lockfile, if you fail, it's still in use. *\/ */ - /* /\* Remove stale lockfile FIXME: lock the lockfile, if you fail, it's still in use. *\/ */
- /* unlink(dirent->d_name); */ - /* unlink(dirent->d_name); */
- /* } */ - /* } */
+ if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) { + if ((buf.st_nlink == 1) && (run_time + CHECK_INTERVAL <= now)) {
+ int fd; + int fd;
+ +
+ fd = open(dirent->d_name, O_RDONLY); + fd = open(dirent->d_name, O_RDONLY);
+ if (fd != -1) { + if (fd != -1) {
+ if (flock(fd, LOCK_EX | LOCK_NB) == 0) { + if (flock(fd, LOCK_EX | LOCK_NB) == 0) {
+ unlink(dirent->d_name); + unlink(dirent->d_name);
+ syslog(LOG_NOTICE, "removing stale lock file %s\n", dirent->d_name); + syslog(LOG_NOTICE, "removing stale lock file %s\n", dirent->d_name);
+ } + }
+ (void)close(fd); + (void)close(fd);
+ } + }
+ } + }
continue; continue;
} }
/* Skip any other file types which may have been invented in /* Skip any other file types which may have been invented in
--
1.8.3.1

View File

@ -176,13 +176,13 @@ diff -up at-3.1.20/atd.c.pam at-3.1.20/atd.c
/* Set up things for the child; we want standard input from the /* Set up things for the child; we want standard input from the
* input file, and standard output and error sent to our output file. * input file, and standard output and error sent to our output file.
*/ */
@@ -492,8 +489,6 @@ run_file(const char *filename, uid_t uid @@ -489,8 +489,6 @@ run_file(const char *filename, uid_t uid, gid_t gid)
close(fd_in); close(fd_in);
close(fd_out); close(fd_out);
- PRIV_START - PRIV_START
- -
nice((tolower((int) queue) - 'a' + 1) * 2); nice((tolower((int) queue) - 'a') * 2);
#ifdef WITH_SELINUX #ifdef WITH_SELINUX
@@ -514,9 +509,9 @@ run_file(const char *filename, uid_t uid @@ -514,9 +509,9 @@ run_file(const char *filename, uid_t uid

View File

@ -26,7 +26,7 @@ diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
/* Install the signal handler for SIGINT; terminate after removing the /* Install the signal handler for SIGINT; terminate after removing the
* spool file if necessary * spool file if necessary
@@ -465,6 +468,9 @@ writefile(time_t runtimer, char queue) @@ -483,6 +483,9 @@ writefile(time_t runtimer, char queue)
fprintf(fp, " || {\n\t echo 'Execution directory " fprintf(fp, " || {\n\t echo 'Execution directory "
"inaccessible' >&2\n\t exit 1\n}\n"); "inaccessible' >&2\n\t exit 1\n}\n");
@ -35,7 +35,7 @@ diff -up at-3.1.20/at.c.shell at-3.1.20/at.c
+ +
istty = isatty(fileno(stdin)); istty = isatty(fileno(stdin));
if (istty) { if (istty) {
fprintf(stderr, "at> "); runtime = localtime(&runtimer);
@@ -480,7 +486,7 @@ writefile(time_t runtimer, char queue) @@ -480,7 +486,7 @@ writefile(time_t runtimer, char queue)
if (istty) { if (istty) {
fprintf(stderr, "<EOT>\n"); fprintf(stderr, "<EOT>\n");

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

18
at.spec
View File

@ -1,6 +1,6 @@
Name: at Name: at
Version: 3.1.23 Version: 3.2.2
Release: 5 Release: 1
Summary: A job manager Summary: A job manager
License: GPLv3+, GPLv2+, ISC, MIT, Public Domain License: GPLv3+, GPLv2+, ISC, MIT, Public Domain
URL: http://ftp.debian.org/debian/pool/main/a/at URL: http://ftp.debian.org/debian/pool/main/a/at
@ -22,10 +22,10 @@ Patch9: at-3.1.20-aborted-jobs.patch
Patch10: at-3.1.18-noabort.patch Patch10: at-3.1.18-noabort.patch
Patch11: at-3.1.16-fclose-error.patch Patch11: at-3.1.16-fclose-error.patch
Patch12: at-3.1.16-clear-nonjobs.patch Patch12: at-3.1.16-clear-nonjobs.patch
Patch13: at-3.1.18-utc-dst.patch Patch13: at-3.1.20-lock-locks.patch
Patch14: at-3.1.20-lock-locks.patch Patch14: at-3.1.23-document-n.patch
Patch15: at-3.1.23-document-n.patch Patch15: at-3.1.20-log-jobs.patch
Patch16: at-3.1.20-log-jobs.patch Patch16: at-3.1.23-coverity-fix.patch
BuildRequires: gcc flex flex-static bison pam-devel smtpdaemon libffi BuildRequires: gcc flex flex-static bison pam-devel smtpdaemon libffi
BuildRequires: autoconf libselinux-devel >= 1.27.9 perl(Test::Harness) perl(Test::More) BuildRequires: autoconf libselinux-devel >= 1.27.9 perl(Test::Harness) perl(Test::More)
@ -125,6 +125,12 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
%{_mandir}/man*/* %{_mandir}/man*/*
%changelog %changelog
* Sat Dec 25 2021 yangzhuangzhuang<yangzhuangzhuang1@huawei.com> - 3.2.2-1
- Type:update
- ID:NA
- SUG:NA
- DESC:update version to 3.2.2
* Thu Jan 16 2020 chengquan<chengquan3@huawei.com> - 3.1.23-5 * Thu Jan 16 2020 chengquan<chengquan3@huawei.com> - 3.1.23-5
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA

Binary file not shown.

BIN
at_3.2.2.orig.tar.gz Normal file

Binary file not shown.