I was working with the GDAL tests for the OpenFileGDB driver and got flagged for having a DOS executable in a zip. And if you just rely on the unix `file` command, that is what it appears to be - a 400 byte DOS executable:
file timestampstimestamps: DOS executable (block device driver,32-bit sector-support)
But if I was Gemini flash to evaluate it, I got a very nice explanation of what is inside of that file:
Analysis
of timestamps in
ESSENCE_NAIPF_ORI_PROV_sub93.gdb
Summary
timestamps is a 400-byte binary system file inside an
Esri File Geodatabase (.gdb) directory (specifically an
ArcGIS 9.3 File Geodatabase, GDB_Release
2.3.0). Although the Unix file utility
identifies it as a DOS block device driver, that classification is a
false positive caused by its initial bytes
(ff ff ff ff 06 00 00 00).
The file is actually an array of 100 little-endian 32-bit
signed integers (int32) (slots
0–99), where:
- 90 slots are
0xffffffff(-1, uninitialized/unused), and - 10 slots hold small non-negative integers
(
0through10), all corresponding toGDB_*system catalog tables (a00000001–a0000001c).
1. Unix
file Output and Why It Triggers a False Positive
Running file on timestamps produces:
$ file timestamps
timestamps: DOS executable (block device driver,32-bit sector-support)
$ file -i timestamps
timestamps: application/x-dosdriver; charset=binary
$ file -k timestamps
timestamps: DOS executable (block device driver,32-bit sector-support)\012- data
Tracing with file -d timestamps (file-5.46)
against magic/Magdir/msdos explains why the heuristic
matches:
- Driver chain header
(
0 ulequad&0x07a0ffffffff 0xffffffff): Bytes0..7areff ff ff ff 06 00 00 00(little-endian0x00000006ffffffff). The leading0xffffffffmatches an MS-DOS device driver's "next driver" end-of-chain sentinel, and the reserved bits checked by mask0x07a0in bytes4..5are zero. - Exclusion checks:
- Offset
4..7(06 00 00 00) is not0x14000000(skip guard for OS/2 INI files). - Offset
10..17(ff ff 00 00 00 00 ff ff) is non-zero (>10 ubequad !0, skip guard for empty-name OOXML fragments). Notice that at least 18 bytes are required to pass this check (filereportsdataon the first 8 bytes alone, and reports 400 bytes of0xffasISO-8859 text, with very long lines (400), with no line terminators).
- Offset
- Attribute word decoding at offset
4(0x0006):- Bit 15 (
0x8000) is0→ printsblock device driver. - Byte
12(0x00 < 0x2f) and offset22(0x00) fail ASCII driver-name checks, so no driver name is emitted. - Bit 1 (
0x0002) is1→ prints,32-bit sector-. - Bitmask
0x4842is non-zero (0x0006 & 0x4842 == 2) → printssupport.
- Bit 15 (
2. File Geodatabase Role & Binary Layout
Inside an Esri File Geodatabase folder, timestamps
(alongside gdb) is a required workspace-level
marker/control file needed for ArcGIS to recognize the .gdb
directory as a geodatabase rather than an ordinary folder. In GDAL's
OpenFileGDB write driver
(OGROpenFileGDBDataSource::Create()), a newly created
geodatabase initializes timestamps to 400 bytes of
0xff (100 × -1).
Raw Hex Dump (400 bytes)
00000000: ffff ffff 0600 0000 ffff ffff 0000 0000 ................
00000010: ffff ffff 0200 0000 0300 0000 0200 0000 ................
00000020: 0200 0000 ffff ffff ffff ffff ffff ffff ................
00000030: ffff ffff ffff ffff ffff ffff ffff ffff ................
00000040: ffff ffff ffff ffff ffff ffff ffff ffff ................
00000050: ffff ffff ffff ffff ffff ffff 0000 0000 ................
00000060: 0000 0000 ffff ffff ffff ffff 0800 0000 ................
00000070: 0a00 0000 ffff ffff ffff ffff ffff ffff ................
00000080..0000018f: all bytes 0xff
Mapping of
Non--1 Slots to GDB_SystemCatalog
Querying GDB_SystemCatalog
(a00000001.gdbtable, which lists 38 active tables plus
deleted row 38) maps every slot index i
directly to table ID a<i:08x>:
| Slot Index | Byte Offset | int32 Value |
Table ID | GDB_SystemCatalog Name |
FileFormat |
Present on Disk |
|---|---|---|---|---|---|---|
1 |
0x04 |
6 |
a00000001 |
GDB_SystemCatalog |
0 |
Yes (a00000001.gdbtable) |
3 |
0x0c |
0 |
a00000003 |
GDB_SpatialRefs |
0 |
Yes (a00000003.gdbtable) |
5 |
0x14 |
2 |
a00000005 |
GDB_FeatureDataset |
0 |
Yes (a00000005.gdbtable) |
6 |
0x18 |
3 |
a00000006 |
GDB_ObjectClasses |
0 |
Yes (a00000006.gdbtable) |
7 |
0x1c |
2 |
a00000007 |
GDB_FeatureClasses |
0 |
Yes (a00000007.gdbtable) |
8 |
0x20 |
2 |
a00000008 |
GDB_FieldInfo |
0 |
Yes (a00000008.gdbtable) |
23 |
0x5c |
0 |
a00000017 |
GDB_DefaultValues |
0 |
Yes (a00000017.gdbtable) |
24 |
0x60 |
0 |
a00000018 |
GDB_Subtypes |
0 |
Yes (a00000018.gdbtable) |
27 |
0x6c |
8 |
a0000001b |
GDB_CodedDomains |
2 |
No |
28 |
0x70 |
10 |
a0000001c |
GDB_UserMetadata |
0 |
Yes (a0000001c.gdbtable) |
All other slots—including 2 (GDB_DBTune),
4 (GDB_Release),
9–22, 25–26,
29–37, 38 (deleted entry for
DDE_ESSEN_NAIPF_ORI_VUE in
a00000001.gdbtable), 39 (0x27,
DDE_ESSEN_NAIPF_ORI_VUE in
a00000027.gdbtable), and
40–99—are -1
(0xffffffff).
3. Interpretation of the Values (Inferred Semantics)
Because Esri's File Geodatabase format is proprietary and GDAL
neither documents nor updates the slot contents, the exact meaning of
the integers is inferred from the dataset metadata and
cross-checking other .gdb fixtures:
- Not wall-clock timestamps: File Geodatabase
date/time column values use IEEE 754
float64days since1899-12-30; the values intimestampsare smallint32integers (0–10here, and up to4206in other GDAL.gdbtest fixtures). - Logical revision / cache-invalidation counters for system
tables: Across GDAL's
.gdbtest fixtures (both ArcGIS 9.x and 10.x), onlyGDB_*system tables (1–8,23–28in v9.x;1–7in v10.x) hold non--1values. In this dataset,GDB_UserMetadatarecords anUncompressFileGeodatabaseDataoperation on2014-09-30, and the tables showing.freelistfiles and2014-09-30mtimes (a00000001,a00000006,a00000008,a0000001c) have incremented counters (6,3,2,10), whileGDB_CodedDomainsretains8even though its table currently hasFileFormat=2(unmaterialized/empty on disk). This matches per-table logical timestamps (monotonic change counters) used to detect edits to system catalog tables without scanning them.

