[60] in The Cryptographic File System users list
Annoying CFS bug fixed
daemon@ATHENA.MIT.EDU (Sean Sheedy)
Sat Apr 25 16:18:11 1998
From owner-cfs-users@research.att.com Sat Apr 25 20:18:10 1998
Return-Path: <owner-cfs-users@research.att.com>
Delivered-To: cfs-mtg@bloom-picayune.mit.edu
Received: (qmail 3352 invoked from network); 25 Apr 1998 20:18:09 -0000
Received: from unknown (HELO ns.research.att.com) (192.20.225.4)
by bloom-picayune.mit.edu with SMTP; 25 Apr 1998 20:18:09 -0000
Received: from research.att.com ([135.207.30.100]) by ns; Sat Apr 25 16:15:55 EDT 1998
Received: from amontillado.research.att.com ([135.207.24.32]) by research-clone; Sat Apr 25 16:06:39 EDT 1998
Received: from nsa.research.att.com (majordomo@nsa.research.att.com [135.207.24.155])
by amontillado.research.att.com (8.8.7/8.8.7) with ESMTP id QAA16496;
Sat, 25 Apr 1998 16:06:31 -0400 (EDT)
Received: (from majordomo@localhost) by nsa.research.att.com (8.7.3/8.7.3) id QAA22038 for cfs-users-list; Sat, 25 Apr 1998 16:02:57 -0400 (EDT)
X-Authentication-Warning: nsa.research.att.com: majordomo set sender to owner-cfs-users@nsa.research.att.com using -f
Received: from research.att.com (research-clone.research.att.com [135.207.30.100]) by nsa.research.att.com (8.7.3/8.7.3) with SMTP id QAA22034 for <cfs-users@nsa.research.att.com>; Sat, 25 Apr 1998 16:02:54 -0400 (EDT)
Received: from firefly.rain.com ([206.103.35.40]) by research-clone; Sat Apr 25 16:04:53 EDT 1998
Received: from firefly.rain.com (localhost [127.0.0.1]) by firefly.rain.com (8.7.5/8.7.3) with ESMTP id NAA00789 for <cfs-users@research.att.com>; Sat, 25 Apr 1998 13:04:44 -0700
Message-ID: <354241DB.18207160@firefly.rain.com>
Date: Sat, 25 Apr 1998 13:04:44 -0700
From: Sean Sheedy <seans@easystreet.com>
X-Mailer: Mozilla 4.04 [en] (X11; U; Linux 2.0.29 i586)
MIME-Version: 1.0
To: cfs-users@research.att.com
Subject: Annoying CFS bug fixed
Content-Type: multipart/mixed; boundary="------------4C30061D7C28F1CC08D9FFB3"
Sender: owner-cfs-users@research.att.com
Precedence: bulk
This is a multi-part message in MIME format.
--------------4C30061D7C28F1CC08D9FFB3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
The current version of CFS has a bug where the modification time is
changed on the file even if it is opened only for read. I've attached a
patch to fix this bug. Also, this patch has a change to avoid an
unnecessary truncate when the file isn't actually shrinking.
Sean
--
Sean Sheedy seans@easystreet.com
Every decent man is ashamed of the government he lives under.
-- H.L. Mencken
--------------4C30061D7C28F1CC08D9FFB3
Content-Type: text/plain; charset=us-ascii; name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff"
*** cfs_fh.c 1998/01/02 07:12:25 1.1
--- cfs_fh.c 1998/03/14 00:18:10
***************
*** 547,553 ****
openfd=NULL;
}
! if (mode==0) { mode=CFS_WRITE; }
/* Phil Karn's hack for R/O file systems */
if ((fd=open(f->name,mode,0))<0 && errno == EROFS) {
mode = CFS_READ; /* Force read and try again */
--- 547,554 ----
openfd=NULL;
}
! /* ### This looks badly wrong */
! /* if (mode==0) { mode=CFS_WRITE; } */
/* Phil Karn's hack for R/O file systems */
if ((fd=open(f->name,mode,0))<0 && errno == EROFS) {
mode = CFS_READ; /* Force read and try again */
***************
*** 669,678 ****
if (utimes(f->name,tv)<0)
return -1;
}
! if (((int)a->size) >= 0)
! if (truncate(f->name,vtod(a->size)))
! if (errno != EISDIR)
! return 0;
/* printf("fhsetattr: atime=%x,%x mtime=%x,%x\n",
a->atime.seconds, a->atime.useconds,
a->mtime.seconds, a->mtime.useconds); */
--- 670,683 ----
if (utimes(f->name,tv)<0)
return -1;
}
! if (((int)a->size) >= 0) {
! struct stat sbuf;
!
! if (stat(f->name, &sbuf) == 0 && a->size < sbuf.st_size)
! if (truncate(f->name,vtod(a->size)))
! if (errno != EISDIR)
! return 0;
! }
/* printf("fhsetattr: atime=%x,%x mtime=%x,%x\n",
a->atime.seconds, a->atime.useconds,
a->mtime.seconds, a->mtime.useconds); */
--------------4C30061D7C28F1CC08D9FFB3--