a2ps-patches
[Top][All Lists]
Advanced

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

Re: -S option segfaults


From: Akim Demaille
Subject: Re: -S option segfaults
Date: 03 Sep 2002 18:49:44 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Honest Recruiter)

| Fix the bug 143127 in Debian bug tracking system :
| http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=143127
| 
| PS :  Akim, is it the good patch format to this ML ??
|       To make it, I used "cvs diff -u ChangeLog lib/psstat.c", but the 
ChangeLog      
| diff is not as your.
|       In your patches, you do not have lines "======", "RCS file .....", etc 
in 
| ChangeLog entry.

I'm using Alexandre Oliva's cvsutils.  I'm using cvsdiff.

| 
| Index: ChangeLog
| ===================================================================
| RCS file: /cvsroot/a2ps/a2ps/ChangeLog,v
| retrieving revision 1.4.2.11
| diff -u -r1.4.2.11 ChangeLog
| --- ChangeLog 3 Sep 2002 14:06:29 -0000       1.4.2.11
| +++ ChangeLog 3 Sep 2002 16:16:53 -0000
| @@ -1,3 +1,8 @@
| +2002-09-03  Franck Lombardi  <address@hidden>
| +
| +     * lib/psstat.c: Fixed a segfaults when the -S option is used
| +     Reported by Daniel Jonsson.
| +
|  2002-09-03  Akim Demaille  <address@hidden>
|  
|       * mbrtowc.m4, mbstate_t.m4, prereq.m4: New.
| Index: lib/psstat.c
| ===================================================================
| RCS file: /cvsroot/a2ps/a2ps/lib/Attic/psstat.c,v
| retrieving revision 1.1.1.1
| diff -u -r1.1.1.1 psstat.c
| --- lib/psstat.c      4 Mar 2002 18:46:25 -0000       1.1.1.1
| +++ lib/psstat.c      3 Sep 2002 16:16:53 -0000
| @@ -83,8 +83,8 @@
|               const char * key, const char * value, int def)
|  {
|    NEW (dict_entry, item);
| -  item->key = xstrdup (key);
| -  item->value = xstrdup (value);
| +  item->key = key ? xstrdup (key) : NULL;

Huh?  An empty key must never happen!

| +  item->value = value ? xstrdup (value) : NULL;
|    item->def = def;
|    hash_insert (table, item);
|  }
| @@ -266,7 +266,8 @@
|  
|    /* Each Pagedevice */
|    for (entry = entries ; *entry ; entry++)
| -    output (job->divertion, "\
| +    if ((*entry)->value)
| +      output (job->divertion, "\
|  %%%%BeginFeature: *%s %c%s\n\
|    (<<) cvx exec /%s (%s) cvx exec (>>) cvx exec setpagedevice\n\
|  %%%%EndFeature\n",

Actually, if I understand correctly the documentation:

 - Option: -S KEY[:VALUE]
 - Option: --setpagedevice=KEY[:VALUE]
     Pass a page device definition to the generated PostScript output.
     If no VALUE is given, KEY is removed from the definitions.  Note
     that several `--setpagedevice' can be accumulated.

     For example, command

          ubu $ a2ps -SDuplex:true -STumble:true NEWS
          [NEWS (plain): 15 pages on 8 sheets]
          [Total: 15 pages on 8 sheets] sent to the default printer

     prints file `report.pre' in duplex (two sides) tumble (suitable for
     landscape documents).  This is also valid for delegated files:
          a2ps -SDuplex:true -STumble:true a2ps.texi

     Page device operators are implementation dependent but they are
     standardized.  *Note Page Device Options::, for details.

when -S dummy is given, you should *remove* the definition, not create
a new one with an empty content.



As far as I can see, this is not very clear in 4.13, since it does try
to issue a definition to nothing.  Drop this:  I suggest this patch
instead.  The definitive fix will be for 4.50.


Index: lib/options.c
===================================================================
RCS file: /cvsroot/a2ps/a2ps/lib/options.c,v
retrieving revision 1.1.1.1
diff -u -u -r1.1.1.1 options.c
--- lib/options.c 4 Mar 2002 18:46:25 -0000 1.1.1.1
+++ lib/options.c 3 Sep 2002 16:51:03 -0000
@@ -461,23 +461,17 @@
        {
          char *value;
          value = optarg + strcspn (optarg, " \t:=");
-         /* If `-SFeature:' then remove Feature,
-            If `-SFeature', pass the empty value to libppd,
-            it may decide the right thing to do,
+         /* If `-SFeature:' or `-SFeature' then remove Feature,
             otherwise (-SFeature:value) pass to libppd */
          if (*value)
            {
              *value = '\0';
              value ++;
-             if (*value)
-               setpagedevice (job, optarg, value);
-             else
-               delpagedevice (job, optarg);
            }
+         if (*value)
+           setpagedevice (job, optarg, value);
          else
-           {
-             setpagedevice (job, optarg, NULL);
-           }
+           delpagedevice (job, optarg);
        }
       break;
 


Please, install.




reply via email to

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