Page MenuHome GnuPG

Comments in gpg.conf file print in reverse order
Closed, ResolvedPublic

Description

Release: gog 1.3.6-cvs

Environment

Slackware 9.1 Kernel 2.6.4

Description

When multiple comment lines are in gpg.conf, they print in reverse order in sigs and key exports.

How To Repeat

  1. add cute comment in gpg.conf comment "comment 1" comment "comment 2" comment "comment 3"

    #export a key, or create a signature #output from key export, for example

    -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.3.6-cvs (GNU/Linux) Comment: comment 3 Comment: comment 2 Comment: comment 1

Fix

#it's my belief that the function add_to_strlist is adding
#items in reverse order by setting sl->next to the first
#item in list. Each time this function is called from
#g10.c, the previous head item in list becomes sl->next
#and the new *string becomes the head item.

#from util.c
STRLIST
add_to_strlist( STRLIST *list, const char *string )
{

STRLIST sl;
 
sl = m_alloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
sl->next = *list;
*list = sl;
return sl;

}

#perhaps you could try something like:

sl = m_alloc( sizeof *sl + strlen(string));
sl->flags = 0;
strcpy(sl->d, string);
list->next = *sl; /* this would add the next item next in the current list */
return list; /* not sure if even needed anymore */

#I am not sure about what other modules utilize this
#function, so I hesitate to implement without your review.

Regards

Event Timeline

I never intended multiple comments to be in any particular
order, but it's easy enough to maintain the order given.
This will be in the next devel release.