HFS Release Notes
First created on: 6/22/92 7:44:55 PM

----------------------------------------------------------•----------------------------------------------------------

6/22/92 7:45:06 PM

File: FileMgrPatches.a,58     
Owner: Chris Derossi     
Project: MainProj∫OS∫HFS∫

Radar bug: #100889,1032495

> Release notes for this change:

Retrospect Remote and QuicKeys both patch low-level Event Manager traps to get time. If
their trap patches happen to execute when the System (like the Process Manager) is
calling the Event Manager, then the Macintosh is in “System Mode” when they run. If their
patches execute at other times, the Mac is not in System Mode.

If their patches open files while the Mac is in System Mode, then the file they opened is
marked as “Opened by the System”. This is done so the system can know which files it
opened versus which files were opened by applications. (There are many reasons for this.
For example, when an application quits, the Process Manager closes all files that were
opened by that application and left open.)

There is a system patch to _Close which prevents files “Opened by the System” from being
closed by processes other than the system (like applications). In other words, our patch
to _Close prevents files that the system wants open from being closed by an application.
The only problem is that under System 7.0 and 7.0.1, our patch to _Close had a bug and
didn’t work. This meant that anyone could close a file that was opened by the system.

We fixed the patch to _Close so that applications could no longer close System-opened
files.

Both QuicKeys and Retrospect Remote rely on being able to open and close files. All of
their file operations happen during trap patches to the Event Manager. These patches are
executed in System Mode sometimes and not in System mode at other times depending on the
other things the Mac is doing. If a file is opened when the Mac is in System mode, and
closed when the Mac is not in System mode, then the close fails, leaving the file open.
This is why QuicKeys and Retrospect Remote are broken.

Since the patch to _Close has been broken since 7.0, and everyone is living with it that
way, I disabled it for Cube-E. Conceptually it’s a good idea to prevent non-System
processes from closing files opened by the System, but I don’t know of any dependencies
on that behavior. So the bottom line is that anyone can once again close files that were
opened by the System and QuicKeys and Retrospect Remote work again.

> What was tested:

I have a reproducable case of the QuicKeys failure that now works correctly. I didn’t do
any real testing of Retrospect because the bug is random, depending on exactly when the
trap patches fire. However, the frequent occurance of files being left open hasn’t
happened in several days. (It used to happen nightly).
----------------------------------------------------------•----------------------------------------------------------
