[2110] in Athena Bugs

home help back first fref pref prev next nref lref last post

Compress 0 length file fix

daemon@ATHENA.MIT.EDU (John Carr)
Sun Apr 23 21:00:21 1989

To: bugs@ATHENA.MIT.EDU
Cc: cfyi@ATHENA.MIT.EDU, beth@ATHENA.MIT.EDU
Date: Sun, 23 Apr 89 20:59:41 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>

When a file is written with NFS, errors may not be returned until the final
close() of the file descriptor.  compress does not check the return value
of close; it is a one line change to make it do this:

*** /mit/jfc/src/compress.c     Sun Apr 23 20:32:21 1989
--- /paris/source/4.3/ucb/compress/compress.c   Sun May 11 17:06:15 1986
***************
*** 996,1002 ****
        if ( verbose )
            fprintf( stderr, "\n" );
  #endif /* DEBUG */
!       if( ferror( stdout ) || (fclose(stdout) == EOF) )
                writeerr();
      }
  }
--- 996,1002 ----
        if ( verbose )
            fprintf( stderr, "\n" );
  #endif /* DEBUG */
!       if( ferror( stdout ) )
                writeerr();
      }
  }


I have tested this, and it does preserve the file where ordinary compress
fails:

/mit/us1 > ls
...
-rw-rw----  1 jfc      chairman     1024 Apr  3 01:55 backup.1.1.3
...
/mit/us1 > ~/src/compress -v backup.1.1.3
backup.1.1.3: backup.1.1.3.Z: Disc quota exceeded
/mit/us1 > ls 
...
-rw-rw----  1 jfc      chairman     1024 Apr  3 01:55 backup.1.1.3
...
/mit/us1 > compress backup.1.1.3
/mit/us1 > ls                   
...
-rw-rw----  1 jfc      chairman        0 Apr  3 01:55 backup.1.1.3.Z
...

I think this qualifies as an easy but important bug fix--could it make it
into 6.2?

    John Carr
    Athena User Consultant

home help back first fref pref prev next nref lref last post