Re: Test failures in sharutils-4.13.3

Bruce Korb <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
On 03/04/13 19:53, Peter Fales wrote:
> Thanks for the patch.   That made a difference, but still doesn't seem
> quite right.   When -L is used the first archive looks like this:

There were three bugs, one inconsequential.
The first (fixed before) masked the second.  *sigh*.

> The "echo 2" line moved from a byte offset of 0 at the very beginning
> of the file to it's current location at line 14.   However, nothing has
> created that directory, so the script dies on line 14.

It belongs at the very end.  The second script must verify that it is
its turn to run.

--- sharutils-4.13.3-ori/src/shar.c     2013-01-04 22:16:01.000000000 -0800
+++ sharutils-4.13.3/src/shar.c 2013-03-07 12:41:32.436600712 -0800
@@ -965,11 +965,11 @@

   if (HAVE_OPT(QUERY_USER))
     fputs ("# The unsharer will be INTERACTIVELY queried.\n",
           output);

-  if (HAVE_OPT(SPLIT_SIZE_LIMIT))
+  if (HAVE_OPT(WHOLE_SIZE_LIMIT))
     {
       int len = snprintf (explain_text_fmt, sizeof (explain_text_fmt),
                           explain_fmt_fmt, explain_1_len, explain_2_len);
       if ((unsigned)len >= sizeof (explain_text_fmt))
         strcpy (explain_text_fmt, "#%-256s\n#%-256s\n");
@@ -1374,18 +1374,19 @@
       snprintf (scribble, scribble_size, SM_contin_in_part,
                restore, (long)part_number + 1);
       fprintf (output, echo_string_z, scribble);
     }

-  fwrite (split_file_z, sizeof (split_file_z), 1, output);
+  fwrite (split_file_z, sizeof (split_file_z) - 1, 1, output);

   if (part_number == 1)
     {
       /* Rewrite the info lines on the first header.  */

       fseek (output, archive_type_position, SEEK_SET);
       fprintf (output, explain_text_fmt, explain_1, explain_2);
+      fseek (output, 0, SEEK_END);
     }
   close_output (part_number + 1);

   /* Next! */

@@ -1561,12 +1562,13 @@
                : struct_stat.st_size);

       *size_left_p = OPT_VALUE_WHOLE_SIZE_LIMIT - current_size;
       DEBUG_PRINT (_("In shar: remaining size %s\n"), *size_left_p);

-      if (!HAVE_OPT(SPLIT_SIZE_LIMIT) && current_size > first_file_position
-          && (encoded_size > *size_left_p))
+      if (  (WHICH_OPT_WHOLE_SIZE_LIMIT != VALUE_OPT_SPLIT_SIZE_LIMIT)
+         && (current_size > first_file_position)
+         && (encoded_size > *size_left_p))
         {
           change_files (*rnameq_p, size_left_p);
           current_size = ftell (output);
           *size_left_p = OPT_VALUE_WHOLE_SIZE_LIMIT - current_size;
         }
@@ -2200,11 +2202,11 @@
       }
     }

   /* Delete the sequence file, if any.  */

-  if (HAVE_OPT(SPLIT_SIZE_LIMIT) && part_number > 1)
+  if (HAVE_OPT(WHOLE_SIZE_LIMIT) && part_number > 1)
     {
       fprintf (output, echo_string_z, SM_you_are_done);
       if (HAVE_OPT(QUIET))
        fprintf (stderr, _("Created %d files\n"), part_number);
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.