When a system or hardware malfunction destroys an SCCS file, any command issues an error message. Commands also use the checksum stored in an SCCS file to determine whether the file has been corrupted since it was last accessed (possibly by having lost one or more blocks or by having been modified with ed(C)). No SCCS command processes a corrupted SCCS file except the admin command with -h or -z, as described below.
SCCS files should be audited for possible corruptions on a regular basis.
The simplest and fastest way to do an audit is to use admin -h
and specify all SCCS files. Either command works:
admin -h s.file1 s.file2 ...
admin -h directory1 directory2 ...
If the new checksum of any file is not equal to the checksum in the first line of that file, the following message is produced for that file:
corrupted file (co6)The process continues until all specified files have been examined. When examining directories (as in the second example above), the checksum process does not detect missing files. A simple way to learn whether files are missing from a directory is to execute the ls(C) command periodically, and compare the outputs. Any file whose name appeared in a previous output but not in the current one no longer exists.
When a file has been corrupted, the way to restore it
depends on the extent of the corruption.
If damage is extensive,
the best solution is to contact the local UNIX system operations
group and request that the file be restored from a backup copy.
If the damage is minor, repair through editing may be possible.
After such a repair, the admin command must be executed:
admin -z s.file
The purpose of this command is to recompute the checksum and bring it into agreement with the contents of the file. After this command is executed, any corruption that existed in the file is no longer detectable.