Ticket #2652: man-db-2.5.7-fix_man_assertion-1.patch

File man-db-2.5.7-fix_man_assertion-1.patch, 3.9 KB (added by willimm, 15 years ago)

Fixes the assertion error when Man-DB tries to display certan man pages (ie: the man page for ifort, and forigen language man pages) that causes Man-DB to quit.

  • lib/pipeline.c

    Submited by: William Immendorf <will.immendorf@gmail.com>
    Date: 2010-05-07
    Inital Package Version: 2.5.7
    Origin: Upstream commit 1199, http://bazaar.launchpad.net/~cjwatson/man-db/trunk/revision/1199
    Upstream Status: From Upstream Bazaar
    Description: This fixes a issue in when you try to view certan man pages with man (I've seen this happen with ifort's man page, this acually 
    happend to me when I was trying to test out various forigen language man pages), man errors out with this message:
    
    man: man.c:2393: display: Assertion `decomp->ncommands == 1' failed. Aborted
    Aborted
    
    and then quits. This is a issue specific to Man-DB-2.5.7, 2.5.6 diddn't have this issue. This is a well known issue and will be fixed with the release of Man-DB-2.5.8.
    
    diff -Naur man-db-2.5.7.orig/lib/pipeline.c man-db-2.5.7/lib/pipeline.c
    old new  
    329329        return cmd;
    330330}
    331331
     332static void passthrough (void *data ATTRIBUTE_UNUSED)
     333{
     334        for (;;) {
     335                char buffer[4096];
     336                int r = read (STDIN_FILENO, buffer, 4096);
     337                if (r <= 0)
     338                        break;
     339                if (fwrite (buffer, 1, (size_t) r, stdout) < (size_t) r)
     340                        break;
     341        }
     342
     343        return;
     344}
     345
     346command *command_new_passthrough (void)
     347{
     348        return command_new_function ("cat", &passthrough, NULL, NULL);
     349}
     350
    332351command *command_dup (command *cmd)
    333352{
    334353        command *newcmd = XMALLOC (command);
     
    831850        return p;
    832851}
    833852
    834 static void passthrough (void *data ATTRIBUTE_UNUSED)
    835 {
    836         for (;;) {
    837                 char buffer[4096];
    838                 int r = read (STDIN_FILENO, buffer, 4096);
    839                 if (r <= 0)
    840                         break;
    841                 if (fwrite (buffer, 1, (size_t) r, stdout) < (size_t) r)
    842                         break;
    843         }
    844 
    845         return;
    846 }
    847 
    848853void pipeline_connect (pipeline *source, pipeline *sink, ...)
    849854{
    850855        va_list argv;
     
    876881                 * because it has nowhere to send output. Until this is
    877882                 * fixed, this kludge is necessary.
    878883                 */
    879                 if (arg->ncommands == 0) {
    880                         command *cmd = command_new_function
    881                                 ("cat", &passthrough, NULL, NULL);
    882                         pipeline_command (arg, cmd);
    883                 }
     884                if (arg->ncommands == 0)
     885                        pipeline_command (arg, command_new_passthrough ());
    884886        }
    885887        va_end (argv);
    886888}
  • lib/pipeline.h

    diff -Naur man-db-2.5.7.orig/lib/pipeline.h man-db-2.5.7/lib/pipeline.h
    old new  
    172172 */
    173173command *command_new_sequence (const char *name, ...) ATTRIBUTE_SENTINEL;
    174174
     175/* Return a new command that just passes data from its input to its output. */
     176command *command_new_passthrough (void);
     177
    175178/* Return a duplicate of a command. */
    176179command *command_dup (command *cmd);
    177180
  • man-db-2.5.7

    diff -Naur man-db-2.5.7.orig/NEWS man-db-2.5.7/NEWS
    old new  
     1man-db 2.5.8
     2============
     3
     4Major changes since man-db 2.5.7:
     5
     6        Fixes:
     7        ------
     8
     9        o Fix assertion failure on 'man -l' with an uncompressed page and
     10          any of --no-hyphenation, --no-justification, or a non-English
     11          page.
     12
    113man-db 2.5.7 (16 February 2010)
    214===============================
    315
  • man-db-2.5.7

    diff -Naur man-db-2.5.7.orig/src/man.c man-db-2.5.7/src/man.c
    old new  
    23902390#endif /* TROFF_IS_GROFF */
    23912391
    23922392                if (seq->u.sequence.ncommands) {
    2393                         assert (decomp->ncommands == 1);
    2394                         command_sequence_command (seq, decomp->commands[0]);
    2395                         decomp->commands[0] = seq;
     2393                        assert (decomp->ncommands <= 1);
     2394                        if (decomp->ncommands) {
     2395                                command_sequence_command
     2396                                        (seq, decomp->commands[0]);
     2397                                decomp->commands[0] = seq;
     2398                        } else {
     2399                                command_sequence_command
     2400                                        (seq, command_new_passthrough ());
     2401                                pipeline_command (decomp, seq);
     2402                        }
    23962403                } else
    23972404                        command_free (seq);
    23982405        }