previous next top complete contents complete index framed top this page unframed
When it encounters a dollar sign in a file name, MAINSAIL considers that the environment variable name continues to the end of the file name, or until the next / character, unless the environment variable name is enclosed in curly braces, as permitted by the C shell. If an environment variable is enclosed in curly braces, the curly braces are removed after the environment variable is replaced. For example, if the environment variable $foo is defined to be bar, then ${foo}baz would be translated to barbaz.
MAINSAIL calls the system function getenv to look up UNIX environment variables.
After environment variables are expanded, if the first part of the resulting file name is ~ or ~user, it is replaced with the name of the specified user's home directory. If no user name is specified after ~, the name of the current user's home directory is assumed.
Any substitutions that are made are reflected in the file record's name field, and in the names of files written to TTY when the MAINEX FILEINFO subcommand is in effect.
File names containing dollar signs may appear in bootstrap files
produced by CONF or in command files so that a MAINSAIL bootstrap
can be made
in such a way that it does not need to be reinstalled if moved to
another directory;
only the appropriate environment variables need to be changed.
4.2. File Deletion
On UNIX, when an existing file is opened for create access, the old
version of the file is immediately truncated to
length zero whether or not it is
currently open. Any program that has the file currently open will
therefore start reading data from the new (zero-length) version of the
file without receiving any warning that the data it was reading have
disappeared.
4.3. MAINEDIT and Links
When MAINEDIT deletes an existing file and replaces it with a new
version, it does not break links; i.e., every file to which the
updated file was a link is also updated.
4.4. Protection Mode of Files
The disk MODULE preserves
the protection mode of a file when replacing
an existing file. If the file does not exist, then MAINSAIL attempts to
use the protection of the parent directory. If this information is not
ascertainable, then the following default protection modes
are used:
| File Type | Owner | Group | Other |
|---|---|---|---|
| textFile | rw- | r-- | r-- |
| dataFile | rwx | r-x | r-x |
If the current umask value
(as set by the shell command umask) is
nonzero, the protection specified by MAINSAIL may not be the same
as the protection actually given to the file. See the UNIX
documentation on umask for details.
4.5. Disk Full
If a write to a file fails because space on the device is exhausted,
the resulting error message is not fatal. The user may free up
space on the device (e.g., with the MAINSAIL utility MODULE
DELFIL) and
continue; the write
operation is reattempted.
4.6. Removing NFS Automounter File Name Prefix That Can Make Full
Path Names Invalid
On systems running the NFS automounter,
calls to $fileInfo to find the full path name
of a file often produce a name prefixed by a string like /tmp_mnt.
This prefix is called the “automounter file name prefix”.
Unfortunately, because of the way the automounter works,
file names with an
automounter
file name prefix may become invalid shortly after they are obtained.
If your site runs the automounter, and if you have mounted your file systems in such a way that removing the automounter file name prefix from a file name results in a name that can still be used to access the file, then you can use the MAINSAIL fix for this problem, as described below. For example, if every remote directory /abc is mapped to /tmp_mnt/abc, then you can use this fix; if, however, some directory /abc is mapped to a different name (like /tmp_mnt/def), then you cannot use the fix.
The fix consists in setting the global symbol fullPathNamePrefixToRemove in a MAINEX subcommand file that is read as MAINSAIL is initializing itself (setting the global symbol later has no effect). The value of the symbol is the prefix to remove (e.g., /tmp_mnt); MAINSAIL strips this prefix off any full path name it obtains that begins with the prefix followed by a slash.
You can add the following MAINEX subcommand to the $MAINEX group of your v1630.prm file, or you can make the command take effect sitewide by adding it to site.cmd on the MAINSAIL directory:
GLOBALSYMBOL fullPathNamePrefixToRemove /tmp_mnt
You can also hardwire this subcommand by building it into a bootstrap
with CONF, although that is a less flexible mechanism.
Building the subcommand into the bootstrap in this manner is not
advised if the bootstrap will later be shipped to other sites that
do not follow the automounter mapping rule described above.
4.7. Limit on Number of Open Files
The number of files a MAINSAIL process can have open at one time
depends on the flavor of UNIX; consult the operating system
documentation for your platform for details.
MAINSAIL System-Specific User's Guides, Chapter 4