[1767] in testers
Re: vax 7.3E: discuss.el
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Tue Aug 6 00:38:17 1991
Date: Tue, 6 Aug 91 00:38:07 -0400
From: tytso@ATHENA.MIT.EDU (Theodore Ts'o)
To: Bruce R Lewis <brlewis@ATHENA.MIT.EDU>
Cc: testers@ATHENA.MIT.EDU
In-Reply-To: Bruce R Lewis's message of Thu, 01 Aug 91 10:25:32 EDT,
Reply-To: tytso@ATHENA.MIT.EDU
Date: Thu, 01 Aug 91 10:25:32 EDT
From: Bruce R Lewis <brlewis@ATHENA.MIT.EDU>
What were you trying to do?
See a reply I just wrote with r
What's wrong:
I'm on trn 1923. The mode line says 1923/1924. I just got
zephyr notification that my trn got entered as 1924. Yet when I hit n I
get an error message in the minibuffer: waiting for (la) discuss...
No next transaction.
What should have happened:
It should find my transaction.
This was a somewhat subtle bug in the caching code that did not normally
show up using the (experimental) version of discuss.el which I normally
use; that was my fault --- I'll make a point of using the standard
version of emacs-discuss to make sure all of the potential problems are
caught. In any case, here are some patches to edsc, requiring
changes to do_mtg.c, do_trn.c, and do_cache.c. These patches should fix
the problem:
*** /tmp/,RCSt1005702 Mon Aug 5 23:56:30 1991
--- do_mtg.c Sat Aug 3 03:20:30 1991
***************
*** 53,59 ****
#ifdef EDSC_CACHE
if (curr = search_cache_meetings(&nb)) {
/*
! * The meeting isn't cached yet, lets refresh the cache
* information because we don't know if it's up to date.
*/
dsc_get_mtg_info(&nb,&m_info,&code);
--- 53,59 ----
#ifdef EDSC_CACHE
if (curr = search_cache_meetings(&nb)) {
/*
! * The meeting is already cached, but we'll refresh the cache
* information because we don't know if it's up to date.
*/
dsc_get_mtg_info(&nb,&m_info,&code);
***************
*** 67,72 ****
--- 67,74 ----
return;
}
}
+ if (curr->m_info.last != m_info.last)
+ cache_it(&nb, curr->m_info.last);
dsc_destroy_mtg_info(&curr->m_info);
curr->m_info = m_info;
curr->meeting_code = code;
*** /tmp/,RCSt1005707 Mon Aug 5 23:56:43 1991
--- do_trn.c Mon Aug 5 15:54:27 1991
***************
*** 15,20 ****
--- 15,21 ----
#include <stdio.h>
#include <sys/types.h>
#include <sys/file.h>
+ #include <sys/stat.h>
#include <signal.h>
#include <sys/wait.h>
#include <ctype.h>
***************
*** 28,33 ****
--- 29,41 ----
#endif
#include "edsc.h"
+ /*
+ * Define POSIX-style macros for systems who don't have them.
+ */
+ #ifndef S_ISREG
+ #define S_ISREG(m) ((m&S_IFMT) == S_IFREG)
+ #endif
+
do_gti(args)
char *args;
{
***************
*** 190,195 ****
--- 198,205 ----
int fd;
char *plural;
char line[255];
+ #else
+ struct stat stat_buf;
#endif
int code;
***************
*** 233,239 ****
cache_pc = 0;
cache_working = 1;
tinfo = cache_current->t_info;
! (void) unlink(output_fn);
if (link(cache_current->filename, output_fn)) {
int fd, rfd, cc;
char buf[8192];
--- 243,251 ----
cache_pc = 0;
cache_working = 1;
tinfo = cache_current->t_info;
! if ((!stat(output_fn, &stat_buf)) &&
! S_ISREG(stat_buf.st_mode))
! (void) unlink(output_fn);
if (link(cache_current->filename, output_fn)) {
int fd, rfd, cc;
char buf[8192];
***************
*** 537,542 ****
--- 549,557 ----
}
close(fd);
+ #ifdef EDSC_CACHE
+ cache_itn(&nb, new_trn_num);
+ #endif
punt:
dsc_destroy_name_blk(&nb);
}
***************
*** 748,753 ****
--- 763,772 ----
}
dsc_set_trn_flags(&nb, trn_num, flags, &code);
+
+ #ifdef EDSC_CACHE
+ cache_it(&nb, trn_num);
+ #endif
dsc_destroy_name_blk(&nb);
***************
*** 788,793 ****
--- 807,816 ----
return;
}
dsc_retrieve_trn(&nb, trn_num, &code);
+ #ifdef EDSC_CACHE
+ if (!code)
+ cache_itn(&nb, trn_num);
+ #endif
dsc_destroy_name_blk(&nb);
if (code != 0) {
printf(";%s\n", error_message(code));
***************
*** 828,833 ****
--- 851,860 ----
}
dsc_delete_trn(&nb, trn_num, &code);
+ #ifdef EDSC_CACHE
+ if (!code)
+ cache_itn(&nb, trn_num);
+ #endif
dsc_destroy_name_blk(&nb);
if (code != 0) {
printf(";%s\n", error_message(code));
*** /tmp/,RCSt1005712 Mon Aug 5 23:56:51 1991
--- do_cache.c Mon Aug 5 14:28:39 1991
***************
*** 199,205 ****
trn_nums trn_num;
name_blk nb;
int code;
- struct cache_info *entry;
/* First, we get the transaction number */
if (get_word(&cp, &trn_string, " ", &delim) < 0) {
--- 199,204 ----
***************
*** 218,232 ****
printf(";%s\n", error_message(code));
return;
}
! if (entry = cache_search(&nb, trn_num)) {
if (entry->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(&entry->t_info);
- if (entry->flags & CACHE_FLG_TEXT)
- unlink(entry->filename);
entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
entry->info_code = entry->text_code = 0;
}
- printf("()\n");
}
/*
--- 217,238 ----
printf(";%s\n", error_message(code));
return;
}
! cache_it(&nb, trn_num);
! printf("()\n");
! }
!
! cache_it(nbp, trn_num)
! name_blk *nbp;
! trn_nums trn_num;
! {
! struct cache_info *entry;
!
! if (entry = cache_search(nbp, trn_num)) {
if (entry->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(&entry->t_info);
entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
entry->info_code = entry->text_code = 0;
}
}
/*
***************
*** 239,245 ****
trn_nums trn_num;
name_blk nb;
int code;
- struct cache_info *entry, *current;
/* First, we get the transaction number */
if (get_word(&cp, &trn_string, " ", &delim) < 0) {
--- 245,250 ----
***************
*** 258,322 ****
printf(";%s\n", error_message(code));
return;
}
! if (!(current = cache_search(&nb, trn_num))) {
while (!current || !(current->flags & CACHE_FLG_INFO))
! cache_transaction(&nb, trn_num, ¤t);
}
! if (entry = cache_search(&nb, current->t_info.next)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
! if (entry = cache_search(&nb, current->t_info.prev)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
! if (entry = cache_search(&nb, current->t_info.nref)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
! if (entry = cache_search(&nb, current->t_info.pref)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
! if (entry = cache_search(&nb, current->t_info.fref)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
! if (entry = cache_search(&nb, current->t_info.lref)) {
! if (entry->flags & CACHE_FLG_INFO)
! dsc_destroy_trn_info3(&entry->t_info);
! if (entry->flags & CACHE_FLG_TEXT)
! unlink(entry->filename);
! entry->info_code = entry->text_code = 0;
! entry->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
! }
if (current->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(¤t->t_info);
- if (current->flags & CACHE_FLG_TEXT)
- unlink(current->filename);
current->info_code = current->text_code = 0;
current->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
- printf("()\n");
}
/*
--- 263,293 ----
printf(";%s\n", error_message(code));
return;
}
! cache_itn(&nb, trn_num);
! printf("()\n");
! }
!
! cache_itn(nbp, trn_num)
! name_blk *nbp;
! trn_nums trn_num;
! {
! struct cache_info *current;
!
!
! if (!(current = cache_search(nbp, trn_num))) {
while (!current || !(current->flags & CACHE_FLG_INFO))
! cache_transaction(nbp, trn_num, ¤t);
}
! cache_it(nbp, current->t_info.next);
! cache_it(nbp, current->t_info.prev);
! cache_it(nbp, current->t_info.nref);
! cache_it(nbp, current->t_info.pref);
! cache_it(nbp, current->t_info.fref);
! cache_it(nbp, current->t_info.lref);
if (current->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(¤t->t_info);
current->info_code = current->text_code = 0;
current->flags &= ~(CACHE_FLG_INFO|CACHE_FLG_TEXT);
}
/*
***************
*** 377,383 ****
trn_nums trn_num;
struct cache_info **trn_entry;
{
! struct cache_info *entry;
entry = cache_search(nbp, trn_num);
#ifdef CACHE_DEBUG
--- 348,356 ----
trn_nums trn_num;
struct cache_info **trn_entry;
{
! struct cache_info *entry, *link;
! trn_nums trn;
! cache_dir i;
entry = cache_search(nbp, trn_num);
#ifdef CACHE_DEBUG
***************
*** 394,399 ****
--- 367,381 ----
dsc_get_trn_info3(&entry->meeting->nb, entry->trn_num,
&entry->t_info, &entry->info_code);
entry->flags |= CACHE_FLG_INFO;
+ if (!entry->info_code) {
+ for (i=CACHE_DIR_NEXT; i <= CACHE_DIR_PREF; i++) {
+ if ((trn = move_trn(entry, i)) &&
+ (link = cache_search(nbp, trn)) &&
+ (link->flags & CACHE_FLG_INFO) &&
+ (move_trn(link, ((i-1)^1)+1) != trn))
+ cache_it(nbp, trn);
+ }
+ }
return (entry->flags & CACHE_FLG_TEXT);
}
if (!(entry->flags & CACHE_FLG_TEXT)) {
***************
*** 570,577 ****
void free_cache_entry(entry)
struct cache_info *entry;
{
! if (entry->flags & CACHE_FLG_TEXT)
unlink(entry->filename);
if (entry->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(&entry->t_info);
entry->flags = 0;
--- 552,560 ----
void free_cache_entry(entry)
struct cache_info *entry;
{
! if (entry->filename[0])
unlink(entry->filename);
+ entry->filename[0]='\0';
if (entry->flags & CACHE_FLG_INFO)
dsc_destroy_trn_info3(&entry->t_info);
entry->flags = 0;
***************
*** 690,696 ****
name_blk *nbp;
{
struct cache_meeting *curr;
- int code;
for (curr=cache_meetings; curr; curr = curr->next) {
if (!strcasecmp(nbp->hostname, curr->nb.hostname) &&
--- 673,678 ----