Your message dated Tue, 23 Dec 2008 11:32:04 +0000
with message-id <[email protected]>
and subject line Bug#503968: fixed in trn 3.6-19
has caused the Debian Bug report #503968,
regarding trn replaces local KILL files unsafely
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
503968: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=503968
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: trn
Version: 3.6-18.1
Tags: patch

Trn's technique for rewriting a local KILL file (kfile.c::rewrite_kfile()) 
is as follows:

 * unlink old KILL file (still open)
 * open new KILL file
 * read lines from old KILL file, writing into new KILL file
 * close both files

This is unsafe, in that any crash between the first and last steps will 
lose the contents of the file.

The attached patch fixes this problem by writing the KILL file under a new 
name, and then renaming it into place (atomically if possible).  I've only 
minimally tested it so far.

[ I actually noticed this because I was running trn on a system where 
  unlinked files aren't readable at all, so all my lovely rules got eaten, 
  but I appreciate that such systems aren't relevant to Debian. ]

-- 
Ben Harris, University of Cambridge Computing Service.
--- kfile.c.orig	1994-11-19 06:01:19.000000000 +0000
+++ kfile.c	2008-10-29 22:27:40.000000000 +0000
@@ -339,6 +339,7 @@
 ART_NUM thru;
 {
     bool no_kills = 0, has_star_commands = FALSE;
+    char *oldkf, *newkf;
 
     if (localkfp) {
 	fseek(localkfp,0L,0);		/* rewind current file */
@@ -352,12 +353,16 @@
 	    no_kills = 1;
     }
     strcpy(buf,filexp(getval("KILLLOCAL",killlocal)));
+    oldkf = savestr(buf);
+    strcat(buf, ".tmp");
+    newkf = savestr(buf);
     if (!localkfp)
-	makedir(buf,MD_FILE);
-    UNLINK(buf);			/* to prevent file reuse */
-    if (no_kills)
+	makedir(newkf,MD_FILE);
+    if (no_kills) {
+        UNLINK(buf);
 	open_kfile(KF_LOCAL);		/* close file and reset open flag */
-    else if (newkfp = fopen(buf,"w")) {
+    }
+    else if (newkfp = fopen(newkf,"w")) {
 	fprintf(newkfp,"THRU %ld\n",(long)thru);
 	while (localkfp && fgets(buf,LBUFLEN,localkfp) != Nullch) {
 	    if (strnEQ(buf,"THRU",4))
@@ -381,12 +386,21 @@
 	/* Append all the still-valid thread commands */
 	hashwalk(msgid_hash, write_thread_commands, 0);
 	fclose(newkfp);
+#ifdef HAS_RENAME
+	rename(newkf, oldkf);
+#else
+	UNLINK(oldkf);
+	safelink(newkf, oldkf);
+        UNLINK(newkf);
+#endif
 	open_kfile(KF_LOCAL);		/* and reopen local file */
     }
     else
-	printf(cantcreate,buf) FLUSH;
+	printf(cantcreate,newkf) FLUSH;
     localkf_changes = 0;
     has_normal_kills = FALSE;
+    free(newkf);
+    free(oldkf);
 }
 
 /* edit KILL file for newsgroup */

--- End Message ---
--- Begin Message ---
Source: trn
Source-Version: 3.6-19

We believe that the bug you reported is fixed in the latest version of
trn, which is due to be installed in the Debian FTP archive:

trn_3.6-19.dsc
  to pool/non-free/t/trn/trn_3.6-19.dsc
trn_3.6-19.tar.gz
  to pool/non-free/t/trn/trn_3.6-19.tar.gz
trn_3.6-19_i386.deb
  to pool/non-free/t/trn/trn_3.6-19_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthew Vernon <[email protected]> (supplier of updated trn package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 23 Dec 2008 11:20:54 +0000
Source: trn
Binary: trn
Architecture: source i386
Version: 3.6-19
Distribution: unstable
Urgency: low
Maintainer: Matthew Vernon <[email protected]>
Changed-By: Matthew Vernon <[email protected]>
Description: 
 trn        - Threaded USENET news reader, based on rn
Closes: 142731 486630 503968 503971
Changes: 
 trn (3.6-19) unstable; urgency=low
 .
   * copyright file fixes: standardise to license; remove parsedate.c
     copyright section, as this is regenerated at each build (closes: #142731)
   * Apply (corrected) patch from Ben Harris to make editor the default
     editor, in line with policy (closes: #503971)
   * Apply patch from Ben Harris <[email protected]> to replace KILL files
     more safely (closes: #503968)
   * Apply patch from Jonathan Amery <[email protected]> to
     make trn deal better with overlong References: lines (closes: #486630)
Files: 
 b8b3a8f679760ca9dcb6a67bdd56e8d8 605 non-free/news optional trn_3.6-19.dsc
 c86664f24a328a20046fee11bef8d9df 353998 non-free/news optional 
trn_3.6-19.tar.gz
 019e4240b6f47b57e27de95381f585d3 214892 non-free/news optional 
trn_3.6-19_i386.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iQCVAwUBSVDKjrDSad4X89TRAQKUBQQAj83dBtsnfPdTazyeLnf+ux2UHDZUbgMu
thOgZoc7NzdDTeUn/jeOkG9z80qeIOUjqXf1zA9j7h0V8S7efhYGtTObp9H2RbTW
x/0NfkFBGbmOB2IERDxvYG2yIoCnZz0r59lFWgoj7Ma6hWV6hSF7nK/n59vKNPDL
qIL4AgUXACc=
=ebQQ
-----END PGP SIGNATURE-----



--- End Message ---

Reply via email to