On Sun, Jul 01, 2012 at 11:04:31AM -0400, Ted Unangst wrote: > On Sun, Jul 01, 2012 at 11:17, Tobias Stoeckmann wrote: > > Your patch breaks this compatibility for every branch except the initial > > one. GNU CVS is not consistent about its behavior in many ways. > > > >> Ha! This is the same bug I was looking into last week. I wasn't sure in > >> what circumstances adding the magic (like wtf?) is necessary. I'd say > >> this is probably ok. > > > > I disagree: > > > > $ pwd > > /home/tobias/src/lib/libssl/src/crypto > > $ cvs log mem.c > > RCS file: /cvs/src/lib/libssl/src/crypto/mem.c,v > > Working file: mem.c > > > > > > > Magic, magic everywhere! Except in this special initial branch one. ;) > > > > If there is no need to be compatible to GNU CVS as strictly as the project > > initially tried to, I'm fine with that. But as far as I know, this patch > > might break scripts and other tools that expect this weird behavior. > > I had trouble finding a decent file where there was a difference, > thanks. I guess we need an uglier patch to only skip magic if the > version is 1.1.1?
Yeah, I see what you mean. This is pretty ugly... We can incorporate a shiny new macro RCSNUM_ISDEFBRANCH to check for the special case of 1.1.1. This seems to work as expected with tagged RCS files. Does this look ok? Index: getlog.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/getlog.c,v retrieving revision 1.95 diff -u -r1.95 getlog.c --- getlog.c 30 Jul 2010 21:47:18 -0000 1.95 +++ getlog.c 2 Jul 2012 01:35:59 -0000 @@ -269,14 +269,17 @@ if (!(runflags & L_NOTAGS)) { cvs_printf("symbolic names:\n"); TAILQ_FOREACH(sym, &(cf->file_rcs->rf_symbols), rs_list) { - rev = rcsnum_alloc(); - rcsnum_cpy(sym->rs_num, rev, 0); - if (RCSNUM_ISBRANCH(sym->rs_num)) + if (RCSNUM_ISBRANCH(sym->rs_num) + && !RCSNUM_ISDEFBRANCH(sym->rs_num)) { + rev = rcsnum_alloc(); + rcsnum_cpy(sym->rs_num, rev, 0); rcsnum_addmagic(rev); - - cvs_printf("\t%s: %s\n", sym->rs_name, - rcsnum_tostr(rev, numb, sizeof(numb))); - rcsnum_free(rev); + cvs_printf("\t%s: %s\n", sym->rs_name, + rcsnum_tostr(rev, numb, sizeof(numb))); + rcsnum_free(rev); + } else + cvs_printf("\t%s: %s\n", sym->rs_name, + rcsnum_tostr(sym->rs_num, numb, sizeof(numb))); } } Index: rcs.h =================================================================== RCS file: /cvs/src/usr.bin/cvs/rcs.h,v retrieving revision 1.99 diff -u -r1.99 rcs.h --- rcs.h 3 Jun 2011 10:02:25 -0000 1.99 +++ rcs.h 2 Jul 2012 01:35:59 -0000 @@ -104,6 +104,8 @@ #define RCSNUM_ISBRANCH(n) ((n)->rn_len % 2) #define RCSNUM_ISBRANCHREV(n) (!((n)->rn_len % 2) && ((n)->rn_len >= 4)) +#define RCSNUM_ISDEFBRANCH(n) \ + (((n)->rn_len == 3) && (((n)->rn_id[0]|(n)->rn_id[1]|(n)->rn_id[2]) == 1)) /* file flags */ #define RCS_READ (1<<0)