Compare commits
10 Commits
c8b84305f3
...
b55240cc47
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b55240cc47 | ||
|
|
8007bbc75e | ||
|
|
265de1a653 | ||
|
|
0101269f64 | ||
|
|
71e29dd905 | ||
|
|
b771d2fa63 | ||
|
|
21452e49da | ||
|
|
fe6daf0324 | ||
|
|
52bbb4730b | ||
|
|
456a2b4225 |
@ -12,10 +12,10 @@ diff -up at-3.1.14/atd.c.mail at-3.1.14/atd.c
|
|||||||
/* Global variables */
|
/* Global variables */
|
||||||
|
|
||||||
uid_t real_uid, effective_uid;
|
uid_t real_uid, effective_uid;
|
||||||
@@ -117,6 +121,7 @@ static time_t last_chg;
|
@@ -117,6 +121,7 @@ static int nothing_to_do = 0;
|
||||||
static int nothing_to_do;
|
|
||||||
unsigned int batch_interval;
|
unsigned int batch_interval;
|
||||||
static int run_as_daemon = 0;
|
static int run_as_daemon = 0;
|
||||||
|
static int hupped = 0;
|
||||||
+static int mail_with_hostname = 0;
|
+static int mail_with_hostname = 0;
|
||||||
|
|
||||||
static volatile sig_atomic_t term_signal = 0;
|
static volatile sig_atomic_t term_signal = 0;
|
||||||
|
|||||||
@ -1,111 +0,0 @@
|
|||||||
diff -up at-3.1.14/atd.c.timers at-3.1.14/atd.c
|
|
||||||
--- at-3.1.14/atd.c.timers 2013-12-02 11:03:01.250080057 +0100
|
|
||||||
+++ at-3.1.14/atd.c 2013-12-02 11:06:15.560243498 +0100
|
|
||||||
@@ -831,6 +831,54 @@ run_loop()
|
|
||||||
return next_job;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#ifdef HAVE_TIMER_CREATE
|
|
||||||
+timer_t timer;
|
|
||||||
+struct itimerspec timeout;
|
|
||||||
+
|
|
||||||
+void timer_setup()
|
|
||||||
+{
|
|
||||||
+ struct sigevent sev;
|
|
||||||
+
|
|
||||||
+ sev.sigev_notify = SIGEV_SIGNAL;
|
|
||||||
+ sev.sigev_signo = SIGHUP;
|
|
||||||
+ sev.sigev_value.sival_ptr = &timer;
|
|
||||||
+
|
|
||||||
+ memset(&timeout, 0, sizeof(timeout));
|
|
||||||
+
|
|
||||||
+ if (timer_create(CLOCK_REALTIME, &sev, &timer) < 0)
|
|
||||||
+ pabort("unable to create timer");
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+time_t atd_gettime()
|
|
||||||
+{
|
|
||||||
+ struct timespec curtime;
|
|
||||||
+
|
|
||||||
+ clock_gettime(CLOCK_REALTIME, &curtime);
|
|
||||||
+
|
|
||||||
+ return curtime.tv_sec;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void atd_setalarm(time_t next)
|
|
||||||
+{
|
|
||||||
+ timeout.it_value.tv_sec = next;
|
|
||||||
+ timer_settime(timer, TIMER_ABSTIME, &timeout, NULL);
|
|
||||||
+ pause();
|
|
||||||
+}
|
|
||||||
+#else
|
|
||||||
+void timer_setup()
|
|
||||||
+{
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+time_t atd_gettime()
|
|
||||||
+{
|
|
||||||
+ return time(NULL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void atd_setalarm(time_t next)
|
|
||||||
+{
|
|
||||||
+ sleep(next - atd_gettime());
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
/* Global functions */
|
|
||||||
|
|
||||||
int
|
|
||||||
@@ -936,7 +984,7 @@ main(int argc, char *argv[])
|
|
||||||
sigaction(SIGCHLD, &act, NULL);
|
|
||||||
|
|
||||||
if (!run_as_daemon) {
|
|
||||||
- now = time(NULL);
|
|
||||||
+ now = atd_gettime();
|
|
||||||
run_loop();
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
@@ -959,13 +1007,14 @@ main(int argc, char *argv[])
|
|
||||||
act.sa_handler = set_term;
|
|
||||||
sigaction(SIGINT, &act, NULL);
|
|
||||||
|
|
||||||
+ timer_setup();
|
|
||||||
daemon_setup();
|
|
||||||
|
|
||||||
do {
|
|
||||||
- now = time(NULL);
|
|
||||||
+ now = atd_gettime();
|
|
||||||
next_invocation = run_loop();
|
|
||||||
if (next_invocation > now) {
|
|
||||||
- sleep(next_invocation - now);
|
|
||||||
+ atd_setalarm(next_invocation);
|
|
||||||
}
|
|
||||||
} while (!term_signal);
|
|
||||||
daemon_cleanup();
|
|
||||||
diff -up at-3.1.14/config.h.in.timers at-3.1.14/config.h.in
|
|
||||||
--- at-3.1.14/config.h.in.timers 2013-12-02 11:00:27.000000000 +0100
|
|
||||||
+++ at-3.1.14/config.h.in 2013-12-02 11:02:06.521033976 +0100
|
|
||||||
@@ -38,6 +38,9 @@
|
|
||||||
/* Define to 1 if you have the `getloadavg' function. */
|
|
||||||
#undef HAVE_GETLOADAVG
|
|
||||||
|
|
||||||
+/* Define to 1 if you have the `timer_create' function. */
|
|
||||||
+#undef HAVE_TIMER_CREATE
|
|
||||||
+
|
|
||||||
/* Define to 1 if you have the <getopt.h> header file. */
|
|
||||||
#undef HAVE_GETOPT_H
|
|
||||||
|
|
||||||
diff -up at-3.1.14/configure.ac.timers at-3.1.14/configure.ac
|
|
||||||
--- at-3.1.14/configure.ac.timers 2013-12-02 11:00:27.000000000 +0100
|
|
||||||
+++ at-3.1.14/configure.ac 2013-12-02 11:02:45.217066560 +0100
|
|
||||||
@@ -254,6 +254,10 @@ AC_CHECK_LIB(selinux, is_selinux_enabled
|
|
||||||
AC_SUBST(SELINUXLIB)
|
|
||||||
AC_SUBST(WITH_SELINUX)
|
|
||||||
|
|
||||||
+dnl check for POSIX timer functions
|
|
||||||
+AC_SEARCH_LIBS([timer_create],[rt])
|
|
||||||
+AC_CHECK_FUNCS([timer_create])
|
|
||||||
+
|
|
||||||
AC_MSG_CHECKING(groupname to run under)
|
|
||||||
AC_ARG_WITH(daemon_groupname,
|
|
||||||
[ --with-daemon_groupname=DAEMON_GROUPNAME Groupname to run under (default daemon) ],
|
|
||||||
@ -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:
|
||||||
@ -25,58 +25,60 @@ diff -up at-3.1.18/Makefile.in.make at-3.1.18/Makefile.in
|
|||||||
+ $(CC) -c $(CFLAGS) -fPIE $(DEFS) $*.c
|
+ $(CC) -c $(CFLAGS) -fPIE $(DEFS) $*.c
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(etcdir)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(etcdir)
|
||||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(bindir)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(bindir)
|
||||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(sbindir)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(sbindir)
|
||||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(docdir)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(atdatadir)
|
||||||
- $(INSTALL) -g root -o root -m 755 -d $(IROOT)$(atdocdir)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(docdir)
|
||||||
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
|
- $(INSTALL) -g root -o root -m 755 -d $(DESTDIR)$(atdocdir)
|
||||||
- chmod 1770 $(IROOT)$(ATSPOOL_DIR) $(IROOT)$(ATJOB_DIR)
|
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(DESTDIR)$(ATSPOOL_DIR) $(DESTDIR)$(ATJOB_DIR)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(etcdir)
|
- chmod 1770 $(DESTDIR)$(ATSPOOL_DIR) $(DESTDIR)$(ATJOB_DIR)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(bindir)
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(etcdir)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(sbindir)
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(docdir)
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(sbindir)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
|
||||||
+ $(INSTALL) -m 755 -d $(IROOT)$(etcdir)/pam.d/
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(atdocdir)
|
||||||
+ $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(IROOT)$(ATSPOOL_DIR)
|
+ $(INSTALL) -m 755 -d $(DESTDIR)$(etcdir)/pam.d/
|
||||||
+ chmod 700 $(IROOT)$(ATJOB_DIR) $(IROOT)$(ATSPOOL_DIR)
|
+ $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 755 -d $(DESTDIR)$(ATSPOOL_DIR)
|
||||||
+ chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(ATJOB_DIR) $(IROOT)$(ATSPOOL_DIR)
|
+ chmod 700 $(DESTDIR)$(ATJOB_DIR) $(DESTDIR)$(ATSPOOL_DIR)
|
||||||
touch $(IROOT)$(LFILE)
|
+ chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(DESTDIR)$(ATJOB_DIR) $(DESTDIR)$(ATSPOOL_DIR)
|
||||||
chmod 600 $(IROOT)$(LFILE)
|
touch $(DESTDIR)$(LFILE)
|
||||||
chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(IROOT)$(LFILE)
|
chmod 600 $(DESTDIR)$(LFILE)
|
||||||
- test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -o root -g $(DAEMON_GROUPNAME) -m 640 at.deny $(IROOT)$(etcdir)/
|
chown $(DAEMON_USERNAME):$(DAEMON_GROUPNAME) $(DESTDIR)$(LFILE)
|
||||||
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 6755 at $(IROOT)$(bindir)
|
- test -f $(DESTDIR)$(etcdir)/at.allow || test -f $(DESTDIR)$(etcdir)/at.deny || $(INSTALL) -o root -g $(DAEMON_GROUPNAME) -m 640 at.deny $(DESTDIR)$(etcdir)/
|
||||||
+ test -f $(IROOT)$(etcdir)/at.allow || test -f $(IROOT)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(IROOT)$(etcdir)/
|
- $(INSTALL) -g $(DAEMON_GROUPNAME) -o $(DAEMON_USERNAME) -m 6755 at $(DESTDIR)$(bindir)
|
||||||
+ $(INSTALL) -o $(INSTALL_ROOT_USER) -g $(DAEMON_GROUPNAME) pam_atd $(IROOT)$(etcdir)/pam.d/atd
|
+ test -f $(DESTDIR)$(etcdir)/at.allow || test -f $(DESTDIR)$(etcdir)/at.deny || $(INSTALL) -m 600 at.deny $(DESTDIR)$(etcdir)/
|
||||||
+ $(INSTALL) -m 4755 at $(IROOT)$(bindir)
|
+ $(INSTALL) -o $(INSTALL_ROOT_USER) -g $(DAEMON_GROUPNAME) pam_atd $(DESTDIR)$(etcdir)/pam.d/atd
|
||||||
$(LN_S) -f at $(IROOT)$(bindir)/atq
|
+ $(INSTALL) -m 4755 at $(DESTDIR)$(bindir)
|
||||||
$(LN_S) -f at $(IROOT)$(bindir)/atrm
|
$(LN_S) -f at $(DESTDIR)$(bindir)/atq
|
||||||
- $(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
|
$(LN_S) -f at $(DESTDIR)$(bindir)/atrm
|
||||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man1dir)
|
- $(INSTALL) -g root -o root -m 755 batch $(DESTDIR)$(bindir)
|
||||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man5dir)
|
- $(INSTALL) -g root -o root -m 755 batch-job $(DESTDIR)$(atdatadir)
|
||||||
- $(INSTALL) -d -o root -g root -m 755 $(IROOT)$(man8dir)
|
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man1dir)
|
||||||
- $(INSTALL) -g root -o root -m 755 atd $(IROOT)$(sbindir)
|
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man5dir)
|
||||||
- $(INSTALL) -g root -o root -m 755 atrun $(IROOT)$(sbindir)
|
- $(INSTALL) -d -o root -g root -m 755 $(DESTDIR)$(man8dir)
|
||||||
- $(INSTALL) -g root -o root -m 644 at.1 $(IROOT)$(man1dir)/
|
- $(INSTALL) -g root -o root -m 755 atd $(DESTDIR)$(sbindir)
|
||||||
+ $(INSTALL) -m 755 batch $(IROOT)$(bindir)
|
- $(INSTALL) -g root -o root -m 755 atrun $(DESTDIR)$(sbindir)
|
||||||
+ $(INSTALL) -d -m 755 $(IROOT)$(man1dir)
|
- $(INSTALL) -g root -o root -m 644 at.1 $(DESTDIR)$(man1dir)/
|
||||||
+ $(INSTALL) -d -m 755 $(IROOT)$(man5dir)
|
+ $(INSTALL) -m 755 batch $(DESTDIR)$(bindir)
|
||||||
+ $(INSTALL) -d -m 755 $(IROOT)$(man8dir)
|
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
|
||||||
+ $(INSTALL) -m 755 atd $(IROOT)$(sbindir)
|
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
|
||||||
+ $(INSTALL) -m 755 atrun $(IROOT)$(sbindir)
|
+ $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
|
||||||
+ $(INSTALL) -m 644 at.1 $(IROOT)$(man1dir)/
|
+ $(INSTALL) -m 755 atd $(DESTDIR)$(sbindir)
|
||||||
cd $(IROOT)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
|
+ $(INSTALL) -m 755 atrun $(DESTDIR)$(sbindir)
|
||||||
- $(INSTALL) -g root -o root -m 644 atd.8 $(IROOT)$(man8dir)/
|
+ $(INSTALL) -m 644 at.1 $(DESTDIR)$(man1dir)/
|
||||||
+ $(INSTALL) -m 644 atd.8 $(IROOT)$(man8dir)/
|
cd $(DESTDIR)$(man1dir) && $(LN_S) -f at.1 atq.1 && $(LN_S) -f at.1 batch.1 && $(LN_S) -f at.1 atrm.1
|
||||||
|
- $(INSTALL) -g root -o root -m 644 atd.8 $(DESTDIR)$(man8dir)/
|
||||||
|
+ $(INSTALL) -m 644 atd.8 $(DESTDIR)$(man8dir)/
|
||||||
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
|
sed "s,\$${exec_prefix},$(exec_prefix),g" <atrun.8>tmpman
|
||||||
- $(INSTALL) -g root -o root -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
|
- $(INSTALL) -g root -o root -m 644 tmpman $(DESTDIR)$(man8dir)/atrun.8
|
||||||
+ $(INSTALL) -m 644 tmpman $(IROOT)$(man8dir)/atrun.8
|
+ $(INSTALL) -m 644 tmpman $(DESTDIR)$(man8dir)/atrun.8
|
||||||
rm -f tmpman
|
rm -f tmpman
|
||||||
- $(INSTALL) -g root -o root -m 644 at.allow.5 $(IROOT)$(man5dir)/
|
- $(INSTALL) -g root -o root -m 644 at.allow.5 $(DESTDIR)$(man5dir)/
|
||||||
+ $(INSTALL) -m 644 at.allow.5 $(IROOT)$(man5dir)/
|
+ $(INSTALL) -m 644 at.allow.5 $(DESTDIR)$(man5dir)/
|
||||||
cd $(IROOT)$(man5dir) && $(LN_S) -f at.allow.5 at.deny.5
|
cd $(DESTDIR)$(man5dir) && $(LN_S) -f at.allow.5 at.deny.5
|
||||||
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(IROOT)$(atdocdir)
|
- $(INSTALL) -g root -o root -m 644 $(DOCS) $(DESTDIR)$(atdocdir)
|
||||||
+ $(INSTALL) -m 644 $(DOCS) $(IROOT)$(atdocdir)
|
+ $(INSTALL) -m 644 $(DOCS) $(DESTDIR)$(atdocdir)
|
||||||
rm -f $(IROOT)$(mandir)/cat1/at.1* $(IROOT)$(mandir)/cat1/batch.1* \
|
rm -f $(DESTDIR)$(mandir)/cat1/at.1* $(DESTDIR)$(mandir)/cat1/batch.1* \
|
||||||
$(IROOT)$(mandir)/cat1/atq.1*
|
$(DESTDIR)$(mandir)/cat1/atq.1*
|
||||||
rm -f $(IROOT)$(mandir)/cat1/atd.8*
|
rm -f $(DESTDIR)$(mandir)/cat1/atd.8*
|
||||||
|
|||||||
@ -17,27 +17,4 @@ diff -up at-3.1.18/atd.c.noabort at-3.1.18/atd.c
|
|||||||
else if (pid != 0) {
|
else if (pid != 0) {
|
||||||
free(mailname);
|
free(mailname);
|
||||||
free(newname);
|
free(newname);
|
||||||
@@ -669,15 +672,19 @@ run_loop()
|
|
||||||
* up.
|
|
||||||
*/
|
|
||||||
|
|
||||||
- if (stat(".", &buf) == -1)
|
|
||||||
- perr("Cannot stat " ATJOB_DIR);
|
|
||||||
+ if (stat(".", &buf) == -1) {
|
|
||||||
+ lerr("Cannot stat " ATJOB_DIR);
|
|
||||||
+ return next_job;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (nothing_to_do && buf.st_mtime <= last_chg)
|
|
||||||
return next_job;
|
|
||||||
last_chg = buf.st_mtime;
|
|
||||||
|
|
||||||
- if ((spool = opendir(".")) == NULL)
|
|
||||||
- perr("Cannot read " ATJOB_DIR);
|
|
||||||
+ if ((spool = opendir(".")) == NULL) {
|
|
||||||
+ lerr("Cannot read " ATJOB_DIR);
|
|
||||||
+ return next_job;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
run_batch = 0;
|
|
||||||
nothing_to_do = 1;
|
|
||||||
@ -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");
|
|
||||||
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ diff -up at-3.1.20/at.c.pam at-3.1.20/at.c
|
|||||||
- seteuid(real_uid);
|
- seteuid(real_uid);
|
||||||
+ if ((seteuid(effective_uid)) < 0)
|
+ if ((seteuid(effective_uid)) < 0)
|
||||||
+ perr("Error in seteuid: %s", errno);
|
+ perr("Error in seteuid: %s", errno);
|
||||||
if ((fd = open(atfile, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, S_IRUSR)) == -1)
|
if ((fd = open(atfile, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY | O_SYNC, S_IRUSR)) == -1)
|
||||||
perr("Cannot create atjob file %.500s", atfile);
|
perr("Cannot create atjob file %.500s", atfile);
|
||||||
- seteuid(effective_uid);
|
- seteuid(effective_uid);
|
||||||
|
|
||||||
@ -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
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
77
at.spec
77
at.spec
@ -1,10 +1,10 @@
|
|||||||
Name: at
|
Name: at
|
||||||
Version: 3.1.23
|
Version: 3.2.5
|
||||||
Release: 5
|
Release: 2
|
||||||
Summary: A job manager
|
Summary: A job manager
|
||||||
License: GPLv3+, GPLv2+, ISC, MIT, Public Domain
|
License: GPL-3.0-or-later AND GPL-2.0-or-later AND ISC
|
||||||
URL: http://ftp.debian.org/debian/pool/main/a/at
|
URL: http://ftp.debian.org/debian/pool/main/a/at
|
||||||
Source0: http://ftp.debian.org/debian/pool/main/a/at/at_%{version}.orig.tar.gz
|
Source0: http://software.calhariz.com/at/at_%{version}.orig.tar.gz
|
||||||
Source1: pam_atd
|
Source1: pam_atd
|
||||||
Source2: atd.sysconf
|
Source2: atd.sysconf
|
||||||
Source3: atd.systemd
|
Source3: atd.systemd
|
||||||
@ -17,15 +17,13 @@ Patch4: at-3.1.20-shell.patch
|
|||||||
Patch5: at-3.1.18-nitpicks.patch
|
Patch5: at-3.1.18-nitpicks.patch
|
||||||
Patch6: at-3.1.14-fix_no_export.patch
|
Patch6: at-3.1.14-fix_no_export.patch
|
||||||
Patch7: at-3.1.14-mailwithhostname.patch
|
Patch7: at-3.1.14-mailwithhostname.patch
|
||||||
Patch8: at-3.1.14-usePOSIXtimers.patch
|
Patch8: at-3.1.20-aborted-jobs.patch
|
||||||
Patch9: at-3.1.20-aborted-jobs.patch
|
Patch9: at-3.1.18-noabort.patch
|
||||||
Patch10: at-3.1.18-noabort.patch
|
Patch10: at-3.1.16-fclose-error.patch
|
||||||
Patch11: at-3.1.16-fclose-error.patch
|
Patch11: at-3.1.16-clear-nonjobs.patch
|
||||||
Patch12: at-3.1.16-clear-nonjobs.patch
|
Patch12: at-3.1.20-lock-locks.patch
|
||||||
Patch13: at-3.1.18-utc-dst.patch
|
Patch13: at-3.1.23-document-n.patch
|
||||||
Patch14: at-3.1.20-lock-locks.patch
|
Patch14: at-3.1.20-log-jobs.patch
|
||||||
Patch15: at-3.1.23-document-n.patch
|
|
||||||
Patch16: at-3.1.20-log-jobs.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)
|
||||||
@ -39,9 +37,8 @@ AT and batch delay command scheduling utility and daemon.
|
|||||||
%package_help
|
%package_help
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%autosetup -n %{name}-%{version} -p1
|
||||||
cp %{SOURCE1} .
|
cp %{SOURCE1} .
|
||||||
%{lua:for i=0,16 do print(string.format("%%patch%u -p1\n", i)) end}
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoconf
|
autoconf
|
||||||
@ -60,15 +57,15 @@ make install \
|
|||||||
DAEMON_USERNAME=`id -nu`\
|
DAEMON_USERNAME=`id -nu`\
|
||||||
DAEMON_GROUPNAME=`id -ng` \
|
DAEMON_GROUPNAME=`id -ng` \
|
||||||
DESTDIR=$RPM_BUILD_ROOT\
|
DESTDIR=$RPM_BUILD_ROOT\
|
||||||
sbindir=$RPM_BUILD_ROOT%{_prefix}/sbin\
|
sbindir=%{_prefix}/sbin\
|
||||||
bindir=$RPM_BUILD_ROOT%{_bindir}\
|
bindir=%{_bindir}\
|
||||||
prefix=$RPM_BUILD_ROOT%{_prefix}\
|
prefix=%{_prefix}\
|
||||||
exec_prefix=$RPM_BUILD_ROOT%{_prefix}\
|
exec_prefix=%{_prefix}\
|
||||||
docdir=$RPM_BUILD_ROOT/usr/doc\
|
docdir=/usr/doc\
|
||||||
mandir=$RPM_BUILD_ROOT%{_mandir}\
|
mandir=%{_mandir}\
|
||||||
etcdir=$RPM_BUILD_ROOT%{_sysconfdir} \
|
etcdir=%{_sysconfdir} \
|
||||||
ATJOB_DIR=$RPM_BUILD_ROOT%{_localstatedir}/spool/at \
|
ATJOB_DIR=%{_localstatedir}/spool/at \
|
||||||
ATSPOOL_DIR=$RPM_BUILD_ROOT%{_localstatedir}/spool/at/spool \
|
ATSPOOL_DIR=%{_localstatedir}/spool/at/spool \
|
||||||
INSTALL_ROOT_USER=`id -nu` \
|
INSTALL_ROOT_USER=`id -nu` \
|
||||||
INSTALL_ROOT_GROUP=`id -nu`;
|
INSTALL_ROOT_GROUP=`id -nu`;
|
||||||
|
|
||||||
@ -125,6 +122,38 @@ chown root:root %{_localstatedir}/spool/at/.SEQ
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Apr 30 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 3.2.5-2
|
||||||
|
- Type:update
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: Modify the license to SPDX format
|
||||||
|
Delete MIT and Public Domain license because it no longer appears in the upstream source
|
||||||
|
|
||||||
|
* Tue Dec 27 2022 zhangnan <zhangnan134@huawei.com> - 3.2.5-1
|
||||||
|
- Type:enhancement
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:update to 3.2.5
|
||||||
|
|
||||||
|
* Wed Nov 23 2022 fuanan <fuanan3@h-partners.com> - 3.2.2-3
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Modify Source0
|
||||||
|
|
||||||
|
* Sat Oct 22 2022 yanglongkang<yanglongkang@h-partners.com> - 3.2.2-2
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Adding Patching Operations
|
||||||
|
provides relibility and self-healing capabilities for service
|
||||||
|
|
||||||
|
* 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.5.orig.tar.gz
Normal file
BIN
at_3.2.5.orig.tar.gz
Normal file
Binary file not shown.
@ -6,6 +6,7 @@ After=syslog.target systemd-user-sessions.service
|
|||||||
[Service]
|
[Service]
|
||||||
EnvironmentFile=/etc/sysconfig/atd
|
EnvironmentFile=/etc/sysconfig/atd
|
||||||
ExecStart=/usr/sbin/atd -f $OPTS
|
ExecStart=/usr/sbin/atd -f $OPTS
|
||||||
|
Restart=on-failure
|
||||||
IgnoreSIGPIPE=no
|
IgnoreSIGPIPE=no
|
||||||
KillMode=process
|
KillMode=process
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user