bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What signal should timeout send when it gets a SIGTERM?


From: Jim Meyering
Subject: Re: What signal should timeout send when it gets a SIGTERM?
Date: Wed, 17 Mar 2010 18:30:08 +0100

Jim Meyering wrote:

> Pádraig Brady wrote:
>> On 16/03/10 07:10, Jim Meyering wrote:
>>> Pádraig Brady wrote:
>>>> address@hidden --kill-delay
>>>
>>> The long option name makes it sound like this
>>> is merely specifying the delay, when in fact it is
>>> enabling new behavior as well.  Did you consider say,
>>> "--kill-after=DELAY" ?
>>>
>>> Whatever its name, saying what happens *without* the option
>>> might clarify:
>>>
>>>     Without this option, if the selected signal proves not to be fatal,
>>>     @command{timeout} does not kill the @var{command}.
>>
>> That's better. I'll push the attached patch today sometime.
>>
>>>> +          alarm(kill_delay);
>>>
>>> We need one of those pesky space-before paren things ;-)
>>> There's also one missing on a sigemptyset use.
>>
>> Grr :)
>>
>> There are a few of those:
>> for c in *.c;
>>   do echo "*******$c*******"
>>   cpp -fpreprocessed $c 2>/dev/null | grep '[a-zA-Z0-9]('
>> done
>
> Good catches.  That sounds like a good syntax-check addition,
> as long as cpp -fpreprocessed works.

Filtering out lines ending in \n\
and the few remaining false positives wasn't too bad.
I've just fixed everything reported by this:

  $ for c in *.c; do  cpp -fpreprocessed $c 2>/dev/null \
    | grep '[a-zA-Z0-9](' \
    | grep -vE '(\\n\\$|%s\(to %s|delimit-method|(date|group|character)\(s\))' \
    | grep . && echo "*******$c*******"; done

I'll repost when I've massaged the above into a syntax-check rule.

>From 46e01372773a9ca265009ca085a28aea313a3d73 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 17 Mar 2010 18:27:52 +0100
Subject: [PATCH] maint: add a space before open-paren, where lacking

* src/copy.c (copy_reg): Likewise.
* src/cut.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/getlimits.c (print_int): Likewise.
* src/join.c (join): Likewise.
* src/pwd.c (logical_getcwd): Likewise.
* src/sort.c (specify_nmerge, mergefps, avoid_trashing_input): Likewise.
(merge): Likewise.
* src/uptime.c (usage): Likewise.
---
 src/copy.c      |    2 +-
 src/cut.c       |    2 +-
 src/dd.c        |    2 +-
 src/getlimits.c |    4 ++--
 src/join.c      |    2 +-
 src/pwd.c       |    2 +-
 src/sort.c      |   22 +++++++++++-----------
 src/uptime.c    |    4 ++--
 8 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/copy.c b/src/copy.c
index 8399b71..29f37c9 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -837,7 +837,7 @@ copy_reg (char const *src_name, char const *dst_name,
     {
       bool access_changed = false;

-      if (!(sb.st_mode & S_IWUSR) && geteuid() != 0)
+      if (!(sb.st_mode & S_IWUSR) && geteuid () != 0)
         access_changed = fchmod_or_lchmod (dest_desc, dst_name, 0600) == 0;

       if (!copy_attr_by_fd (src_name, source_desc, dst_name, dest_desc, x)
diff --git a/src/cut.c b/src/cut.c
index 96692dd..087981c 100644
--- a/src/cut.c
+++ b/src/cut.c
@@ -756,7 +756,7 @@ main (int argc, char **argv)
   int optc;
   bool ok;
   bool delim_specified = false;
-  char *spec_list_string IF_LINT(= NULL);
+  char *spec_list_string IF_LINT (= NULL);

   initialize_main (&argc, &argv);
   set_program_name (argv[0]);
diff --git a/src/dd.c b/src/dd.c
index 36a5bc0..3f54cc7 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -1875,7 +1875,7 @@ main (int argc, char **argv)

   offset = lseek (STDIN_FILENO, 0, SEEK_CUR);
   input_seekable = (0 <= offset);
-  input_offset = MAX(0, offset);
+  input_offset = MAX (0, offset);
   input_seek_errno = errno;

   if (output_file == NULL)
diff --git a/src/getlimits.c b/src/getlimits.c
index bf11811..48d07b5 100644
--- a/src/getlimits.c
+++ b/src/getlimits.c
@@ -139,14 +139,14 @@ main (int argc, char **argv)
                       usage, AUTHORS, (char const *) NULL);

 #define print_int(TYPE)                                                  \
-  snprintf (limit, sizeof(limit), "%"PRIuMAX, (uintmax_t)TYPE##_MAX);    \
+  snprintf (limit, sizeof limit, "%"PRIuMAX, (uintmax_t)TYPE##_MAX);    \
   printf (#TYPE"_MAX=%s\n", limit);                                      \
   oflow = decimal_ascii_add (limit, "1");                                \
   printf (#TYPE"_OFLOW=%s\n", oflow);                                    \
   free (oflow);                                                          \
   if (TYPE##_MIN)                                                        \
     {                                                                    \
-      snprintf (limit, sizeof(limit), "%"PRIdMAX, (intmax_t)TYPE##_MIN); \
+      snprintf (limit, sizeof limit, "%"PRIdMAX, (intmax_t)TYPE##_MIN); \
       printf (#TYPE"_MIN=%s\n", limit);                                  \
       oflow = decimal_ascii_add (limit, "-1");                           \
       printf (#TYPE"_UFLOW=%s\n", oflow);                                \
diff --git a/src/join.c b/src/join.c
index 3ecd66e..c977116 100644
--- a/src/join.c
+++ b/src/join.c
@@ -625,7 +625,7 @@ join (FILE *fp1, FILE *fp2)

   if (join_header_lines && seq1.count && seq2.count)
     {
-      prjoin(seq1.lines[0], seq2.lines[0]);
+      prjoin (seq1.lines[0], seq2.lines[0]);
       prevline[0] = NULL;
       prevline[1] = NULL;
       advance_seq (fp1, &seq1, true, 1);
diff --git a/src/pwd.c b/src/pwd.c
index b012a6e..c6bd2e7 100644
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -315,7 +315,7 @@ logical_getcwd (void)
     }

   /* System call validation.  */
-  if (stat (wd, &st1) == 0 && stat (".", &st2) == 0 && SAME_INODE(st1, st2))
+  if (stat (wd, &st1) == 0 && stat (".", &st2) == 0 && SAME_INODE (st1, st2))
     return wd;
   return NULL;
 }
diff --git a/src/sort.c b/src/sort.c
index 5a937dd..d619c60 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1240,10 +1240,10 @@ specify_nmerge (int oi, char c, char const *s)
           if (nmerge < 2)
             {
               error (0, 0, _("invalid --%s argument %s"),
-                     long_options[oi].name, quote(s));
+                     long_options[oi].name, quote (s));
               error (SORT_FAILURE, 0,
                      _("minimum --%s argument is %s"),
-                     long_options[oi].name, quote("2"));
+                     long_options[oi].name, quote ("2"));
             }
           else if (max_nmerge < nmerge)
             {
@@ -1258,7 +1258,7 @@ specify_nmerge (int oi, char c, char const *s)
     {
       char max_nmerge_buf[INT_BUFSIZE_BOUND (unsigned int)];
       error (0, 0, _("--%s argument %s too large"),
-             long_options[oi].name, quote(s));
+             long_options[oi].name, quote (s));
       error (SORT_FAILURE, 0,
              _("maximum --%s argument with current rlimit is %s"),
              long_options[oi].name,
@@ -2586,11 +2586,11 @@ mergefps (struct sortfile *files, size_t ntemps, size_t 
nfiles,
     }

   xfclose (ofp, output_file);
-  free(fps);
-  free(buffer);
-  free(ord);
-  free(base);
-  free(cur);
+  free (fps);
+  free (buffer);
+  free (ord);
+  free (base);
+  free (cur);
 }

 /* Merge lines from FILES onto OFP.  NTEMPS is the number of temporary
@@ -2789,8 +2789,8 @@ avoid_trashing_input (struct sortfile *files, size_t 
ntemps,
               files[i].pid = pid;

               if (i + num_merged < nfiles)
-                memmove(&files[i + 1], &files[i + num_merged],
-                        num_merged * sizeof *files);
+                memmove (&files[i + 1], &files[i + num_merged],
+                         num_merged * sizeof *files);
               ntemps += 1;
               nfiles -= num_merged - 1;;
               i += num_merged;
@@ -2864,7 +2864,7 @@ merge (struct sortfile *files, size_t ntemps, size_t 
nfiles,

       /* Put the remaining input files into the last NMERGE-sized output
          window, so they will be merged in the next pass.  */
-      memmove(&files[out], &files[in], (nfiles - in) * sizeof *files);
+      memmove (&files[out], &files[in], (nfiles - in) * sizeof *files);
       ntemps += out;
       nfiles -= in - out;
     }
diff --git a/src/uptime.c b/src/uptime.c
index 20949fc..bf4323c 100644
--- a/src/uptime.c
+++ b/src/uptime.c
@@ -208,11 +208,11 @@ in the run queue over the last 1, 5 and 15 minutes."));
          but such a test is hard to write.  For the moment then, we
          have a hack which depends on the preprocessor used at compile
          time to tell us what the running kernel is.  Ugh.  */
-      printf(_("  \
+      printf (_("  \
 Processes in\n\
 an uninterruptible sleep state also contribute to the load average.\n"));
 #else
-      printf(_("\n"));
+      printf (_("\n"));
 #endif
       printf (_("\
 If FILE is not specified, use %s.  %s as FILE is common.\n\
--
1.7.0.2.451.g960ec




reply via email to

[Prev in Thread] Current Thread [Next in Thread]