4. FS (File System) Object Encoding
The file system encoding provides a standard, transportable encoding of file system objects from many different operating systems. The intent is to allow the moving of a structured set of files from one environment to another while preserving common elements. At the same time, files can be moved within a single environment while preserving all attributes.
The representations consist of a series of nested sections, with attributes defined at the appropriate levels. Each section begins with an open bracket "[" followed by a directive keyword and ends with a close bracket "]". Attributes are lines, beginning with a keyword. Lines which begin with a LWSP (linear white space) character are continuation lines. Any string-type directive or attribute may be a simple string not starting with a quotation mark ( " ) and not containing special characters (e.g. newline) or LWSP (space and tab). The string name begins with the first non-LWSP character on the line following the attribute or directive keyword and ends with the last non-LWSP character. Otherwise, the character string name is enclosed in quotes. The string itself contains characters in ISO-10646-UTF-1 but is quoted and escaped at octet level (as elsewhere in RFC822 [2]). The strings begin and end with a quotation mark ( " ). Octets equal to quote in the string are escaped, as are octets equal to the escape characters (" and \). The escaped octets may be part of a UTF multi-octet character. Octets that are not printable are escaped with \nnn octal representation. When an escape () occurs at the end of a line, the escape, the end of the line, and the first character of the next line, which must be one of the LWSP characters, are removed (ignored).
[ file Simple-File.Name
[ file " Long file name starting with spaces and having a couple\ [sic] of nasties in it like this newline\012near the end."
Note that in the above example, there is one space (not two) between "couple" and "[sic]". The encoder may choose to use the nnn sequence for any character that might cause trouble. Refer to section 5.1 for line length recommendations.
4.1. Sections
A section starts with an open bracket, followed by a keyword that defines the type of section.
The section keywords are:
directory
entry
file
segment
data
The encoding may start with either a file, directory or entry. A directory section may contain zero or more file, entry, and directory sections. A file section contains a data section or zero or more segment sections. A segment section contains a data section or zero or more segment sections.
4.1.1. Directory
This indicates the start of a directory. There is one parameter, the entry name of the directory: [ directory foo ... ]
4.1.2. Entry
The entry keyword represents an entry in a directory that is not a file or a sub-directory. Examples of entries are soft links in Unix, or access categories in Primos. A Primos access category might look like this:
[ entry SYS.ACAT
type ACAT
created 27 Jan 1987 15:31:04.00
acl SYADMIN:* ARIEL:DALURWX $REST:
]
4.1.3. File
The file keyword is followed by the entry name of the file. The section then continues with attributes, possibly segments, and then data.
[ file MY.FILE
created 27 Feb 1987 12:10:20.07
modified 27 Mar 1987 16:17:03.02
type DAM
[ data LZJU90
* LZJU90
...
]]
4.1.4. Segment
This is used to define segments of a file. It should only be used when encoding files that are actually segmented. The optional parameter is the number or name of the segment. When encoding Macintosh files, the two forks of the file are treated as segments: [ file A.MAC.FILE display "A Mac File" type MAC comment "I created this myself" ... [ segment resource [ data ... ... ]] [ segment data [ data ... ... ]]]
4.1.5. Data
The data section contains the encoded data of the file. The encoding method is defined in section 5. The data section must be last within the containing section.
4.2. Attributes
Attributes may occur within file, entry, directory, and segment sections. Attributes must occur before sub-sections.
The attribute directives are:
display
type
created
modified
accessed
owner
group
acl
password
block
record
application
4.2.1. Display
This indicates the display name of the object. Some systems, such as the Macintosh, use a different form of the name for matching or uniqueness.
4.2.2. Comment
This contains an arbitrary comment on the object. The Macintosh stores this attribute with the file.
4.2.3. Type
The type of an object is usually of interest only to the operating system that the object was created on.
Types are:
ACAT access category (Primos)
CAM contiguous access method (Primos)
DAM direct access method (Primos)
FIXED fixed length records (VMS)
FLAT `flat file', sequence of bytes (Unix, DOS, default)
ISAM indexed-sequential access method (VMS)
LINK soft link (Unix)
MAC Macintosh file
SAM sequential access method (Primos)
SEGSAM segmented direct access method (Primos)
SEGDAM segmented sequential access method (Primos)
TEXT lines of ISO-10646-UTF-1 text ending with CR/LF
VAR variable length records (VMS)
4.2.4. Created
Indicates the creation date of the file. Dates are in the format defined in section 4.3.
4.2.5. Modified
Indicates the date and time the file was last modified or closed after being open for write.
4.2.6. Accessed
Indicates the date and time the file was last accessed on the original file system.
4.2.7. Owner
The owner directive gives the name or numerical ID of the owner or creator of the file.
4.2.8. Group
The group directive gives the name(s) or numerical IDs of the group or groups to which the file belongs.
4.2.9. ACL
This directive specifies the access control list attribute of an object (the ACL attribute may occur more than once within an object). The list consist of a series of pairs of IDs and access codes in the format:
user-ID:access-list
There are four reserved IDs:
$OWNER the owner or creator
$GROUP a member of the group or groups
$SYSTEM a system administrator
$REST everyone else
The access list is zero or more single letters:
A add (create file)
D delete
L list (read directory)
P change protection
R read
U use
W write
X execute
* all possible access
4.2.10. Password
The password attribute gives the access password for this object. Since the content of the object follows (being the raison d'etre of the encoding), the appearance of the password in plain text is not considered a security problem. If the password is actually set by the decoder on a created object, the security (or lack) is the responsibility of the application domain controlling the decoder as is true of ACL and other protections.
4.2.11. Block
The block attribute gives the block size of the file as a decimal number of bytes.
4.2.12. Record
The record attribute gives the record size of the file as a decimal number of bytes.
4.2.13. Application
This specifies the application that the file was created with or belongs to. This is of particular interest for Macintosh files.
4.3. Date Field
Various attributes have a date and time subsequent to and associated with them.
4.3.1. Syntax
The syntax of the date field is a combination of date, time, and timezone:
DD Mon YYYY HH:MM:SS.FFFFFF [+-]HHMMSS
Date := DD Mon YYYY 1 or 2 Digits " " 3 Alpha " " 4 Digits
DD := Day e.g. "08", " 8", "8"
Mon := Month "Jan" | "Feb" | "Mar" | "Apr" |
"May" | "Jun" | "Jul" | "Aug" |
"Sep" | "Oct" | "Nov" | "Dec"
YYYY := Year
Time := HH:MM:SS.FFFFFF 2 Digits ":" 2 Digits [ ":" 2 Digits
["." 1 to 6 Digits ] ]
e.g. 00:00:00, 23:59:59.999999
HH := Hours 00 to 23
MM := Minutes 00 to 59
SS := Seconds 00 to 60 (60 only during a leap second)
FFFFF:= Fraction
Zone := [+-]HHMMSS "+" | "-" 2 Digits [ 2 Digits
[ 2 Digits ] ]
HH := Local Hour Offset
MM := Local Minutes Offset
SS := Local Seconds Offset
4.3.2. Semantics
The date information is that which the file system has stored in regard to the file system object. Date information is stored differently and with varying degrees of precision by different computer file systems. An encoder must include as much date information as it has available concerning the file system object. A decoder which receives an object encoded with a date field containing greater precision than its own must disregard the excessive information. Zone is Co-ordinated Universal Time "UTC" (formerly called "Greenwich Mean Time"). The field specifies the time zone of the file system object as an offset from Universal Time. It is expressed as a signed [+-] two, four or six digit number.
A file that was created April 15, 1993 at 8:05 p.m. in Roselle Park, New Jersey, U.S.A. might have a date field which looks like:
15 Apr 1993 20:05:22.12 -0500