[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sort etc. should catch SIGXFSZ etc.
From: |
Paul Eggert |
Subject: |
sort etc. should catch SIGXFSZ etc. |
Date: |
Fri, 19 Jan 2007 13:17:55 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
If 'sort' runs out of disk space or CPU time, it doesn't clean up its
temporary files properly. 'ls' and 'csplit' have similar problems. I
noticed that 'sort', 'ls', and 'csplit' are not consistent about which
signals they catch; it seems to me that they should be. Which signals
to catch is a bit of a judgment call, e.g., I have a program "alarm"
such that "alarm 20 sort" runs 'sort' in an environment where it will
get SIGALRM in 20 seconds, which is a nice utility to have. So I was
fairly conservative here, and listed in "The usual suspects." a
larger signal set than one might otherwise list.
I considered putting the 'sig' array into a separate module to avoid
duplication, but it didn't quite seem worth the hassle, as its
contents aren't the same in ls.c.
2007-01-19 Paul Eggert <address@hidden>
Standardize on list of signals when an app catches signals.
* src/csplit.c (main): Also catch SIGALRM, SIGPIPE, SIGPOLL,
SIGPROF, SIGVTALRM, SIGXCPU, SIGXFSZ.
* src/ls.c (main): Likewise (except SIGPIPE was already caught).
Note that ls.c is special, as it also catches SIGTSTP.
* src/sort.c (main): Likewise. Also catch SIGQUIT.
diff --git a/src/csplit.c b/src/csplit.c
index 382fd66..a26c80d 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -1402,7 +1402,26 @@ main (int argc, char **argv)
{
int i;
- static int const sig[] = { SIGHUP, SIGINT, SIGQUIT, SIGTERM };
+ static int const sig[] =
+ {
+ /* The usual suspects. */
+ SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM,
+#ifdef SIGPOLL
+ SIGPOLL,
+#endif
+#ifdef SIGPROF
+ SIGPROF,
+#endif
+#ifdef SIGVTALRM
+ SIGVTALRM,
+#endif
+#ifdef SIGXCPU
+ SIGXCPU,
+#endif
+#ifdef SIGXFSZ
+ SIGXFSZ,
+#endif
+ };
enum { nsigs = sizeof sig / sizeof sig[0] };
#if SA_NOCLDSTOP
diff --git a/src/ls.c b/src/ls.c
index feba591..3864ed0 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1113,8 +1113,29 @@ main (int argc, char **argv)
int n_files;
/* The signals that are trapped, and the number of such signals. */
- static int const sig[] = { SIGHUP, SIGINT, SIGPIPE,
- SIGQUIT, SIGTERM, SIGTSTP };
+ static int const sig[] =
+ {
+ /* This one is handled specially. */
+ SIGTSTP,
+
+ /* The usual suspects. */
+ SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM,
+#ifdef SIGPOLL
+ SIGPOLL,
+#endif
+#ifdef SIGPROF
+ SIGPROF,
+#endif
+#ifdef SIGVTALRM
+ SIGVTALRM,
+#endif
+#ifdef SIGXCPU
+ SIGXCPU,
+#endif
+#ifdef SIGXFSZ
+ SIGXFSZ,
+#endif
+ };
enum { nsigs = sizeof sig / sizeof sig[0] };
#if ! SA_NOCLDSTOP
diff --git a/src/sort.c b/src/sort.c
index 326866f..8a22796 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2350,7 +2350,26 @@ main (int argc, char **argv)
{
size_t i;
- static int const sig[] = { SIGHUP, SIGINT, SIGPIPE, SIGTERM };
+ static int const sig[] =
+ {
+ /* The usual suspects. */
+ SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM,
+#ifdef SIGPOLL
+ SIGPOLL,
+#endif
+#ifdef SIGPROF
+ SIGPROF,
+#endif
+#ifdef SIGVTALRM
+ SIGVTALRM,
+#endif
+#ifdef SIGXCPU
+ SIGXCPU,
+#endif
+#ifdef SIGXFSZ
+ SIGXFSZ,
+#endif
+ };
enum { nsigs = sizeof sig / sizeof sig[0] };
#if SA_NOCLDSTOP
M ChangeLog
M src/csplit.c
M src/ls.c
M src/sort.c
Committed as 62efe8374443cffce754050f4d7f48bd043c31b7
- sort etc. should catch SIGXFSZ etc.,
Paul Eggert <=