[File] [PATCH luajit] Add Tarantool snap, xlog, run, index and vylog magic

Sergey Bronnikov sergeyb at tarantool.org
Thu Oct 8 07:10:15 EDT 2026


Christos, could you take a look at the patch?

On 9/30/26 09:24, Sergey Bronnikov wrote:
> From: Sergey Bronnikov<sergeyb at tarantool.org>
>
> An updated patch with enhanced checks for Tarantool formats.
>
> ---
>   magic/Magdir/tarantool         |  40 +++++++++++++++++++++++++++++++++
>   magic/Makefile.am              |   1 +
>   tests/Makefile.am              |  12 ++++++++++
>   tests/tarantool-index.result   |   1 +
>   tests/tarantool-index.testfile | Bin 0 -> 227 bytes
>   tests/tarantool-not.result     |   1 +
>   tests/tarantool-not.testfile   |   3 +++
>   tests/tarantool-run.result     |   1 +
>   tests/tarantool-run.testfile   | Bin 0 -> 133 bytes
>   tests/tarantool-snap.result    |   1 +
>   tests/tarantool-snap.testfile  | Bin 0 -> 162 bytes
>   tests/tarantool-vylog.result   |   1 +
>   tests/tarantool-vylog.testfile | Bin 0 -> 231 bytes
>   tests/tarantool-xlog.result    |   1 +
>   tests/tarantool-xlog.testfile  |   7 ++++++
>   15 files changed, 69 insertions(+)
>   create mode 100644 magic/Magdir/tarantool
>   create mode 100644 tests/tarantool-index.result
>   create mode 100644 tests/tarantool-index.testfile
>   create mode 100644 tests/tarantool-not.result
>   create mode 100644 tests/tarantool-not.testfile
>   create mode 100644 tests/tarantool-run.result
>   create mode 100644 tests/tarantool-run.testfile
>   create mode 100644 tests/tarantool-snap.result
>   create mode 100644 tests/tarantool-snap.testfile
>   create mode 100644 tests/tarantool-vylog.result
>   create mode 100644 tests/tarantool-vylog.testfile
>   create mode 100644 tests/tarantool-xlog.result
>   create mode 100644 tests/tarantool-xlog.testfile
>
> diff --git a/magic/Magdir/tarantool b/magic/Magdir/tarantool
> new file mode 100644
> index 00000000..82593f2e
> --- /dev/null
> +++ b/magic/Magdir/tarantool
> @@ -0,0 +1,40 @@
> +#------------------------------------------------------------------------------
> +# $File: tarantool,v 1.2 2026/09/29 00:00:00 christos Exp $
> +# tarantool:  file(1) magic for Tarantool database files
> +#
> +# Tarantool (https://www.tarantool.io/) has its own storage formats.
> +# Every file starts with a textual header:
> +#
> +#	<type>\n
> +#	<format version>\n
> +#	Version: <tarantool version>\n
> +#	Instance: <uuid>\n
> +#	[VClock: {...}\n]
> +#	[PrevVClock: {...}\n]
> +#	\n
> +#
> +# followed by binary data.  The type is one of SNAP (snapshot),
> +# XLOG (write-ahead log), RUN (vinyl data file), INDEX (vinyl page
> +# index) or VYLOG (vinyl log).
> +#
> +# A bare type line is not specific enough: SNAP, RUN and the other
> +# words are common, so every entry also matches the mandatory parts
> +# of the header that follow it: the format version, the "Version:"
> +# line and the "Instance:" (or "Server:" in the old format) line
> +# with the instance UUID.  The "bt" flags make the test run for both
> +# binary files (real Tarantool data) and header-only text files.
> +
> +0	regex/bt/512	SNAP\n[0-9]+\\.[0-9]+\nVersion:\ [^\n]+\n(Instance|Server):\ [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n	Tarantool snapshot
> +>5	regex/16	[0-9]+\\.[0-9]+		\b, format version %s
> +
> +0	regex/bt/512	XLOG\n[0-9]+\\.[0-9]+\nVersion:\ [^\n]+\n(Instance|Server):\ [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n	Tarantool write-ahead log
> +>5	regex/16	[0-9]+\\.[0-9]+		\b, format version %s
> +
> +0	regex/bt/512	RUN\n[0-9]+\\.[0-9]+\nVersion:\ [^\n]+\n(Instance|Server):\ [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n	Tarantool vinyl run
> +>4	regex/16	[0-9]+\\.[0-9]+		\b, format version %s
> +
> +0	regex/bt/512	INDEX\n[0-9]+\\.[0-9]+\nVersion:\ [^\n]+\n(Instance|Server):\ [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n	Tarantool vinyl index
> +>6	regex/16	[0-9]+\\.[0-9]+		\b, format version %s
> +
> +0	regex/bt/512	VYLOG\n[0-9]+\\.[0-9]+\nVersion:\ [^\n]+\n(Instance|Server):\ [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\n	Tarantool vinyl log
> +>6	regex/16	[0-9]+\\.[0-9]+		\b, format version %s
> diff --git a/magic/Makefile.am b/magic/Makefile.am
> index ff116da2..16efc5a0 100644
> --- a/magic/Makefile.am
> +++ b/magic/Makefile.am
> @@ -318,6 +318,7 @@ $(MAGIC_FRAGMENT_DIR)/symbos \
>   $(MAGIC_FRAGMENT_DIR)/sysex \
>   $(MAGIC_FRAGMENT_DIR)/sysstat \
>   $(MAGIC_FRAGMENT_DIR)/tapebackup \
> +$(MAGIC_FRAGMENT_DIR)/tarantool \
>   $(MAGIC_FRAGMENT_DIR)/tcl \
>   $(MAGIC_FRAGMENT_DIR)/teapot \
>   $(MAGIC_FRAGMENT_DIR)/terminfo \
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 32b35c1c..034c63dd 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -155,6 +155,18 @@ rpm-v3.0-src.testfile \
>   searchbug.magic \
>   searchbug.result \
>   searchbug.testfile \
> +tarantool-index.result \
> +tarantool-index.testfile \
> +tarantool-not.result \
> +tarantool-not.testfile \
> +tarantool-run.result \
> +tarantool-run.testfile \
> +tarantool-snap.result \
> +tarantool-snap.testfile \
> +tarantool-vylog.result \
> +tarantool-vylog.testfile \
> +tarantool-xlog.result \
> +tarantool-xlog.testfile \
>   uf2.result \
>   uf2.testfile \
>   utf16xmlsvg.testfile \
> diff --git a/tests/tarantool-index.result b/tests/tarantool-index.result
> new file mode 100644
> index 00000000..fff78b12
> --- /dev/null
> +++ b/tests/tarantool-index.result
> @@ -0,0 +1 @@
> +Tarantool vinyl index, format version 0.13
> diff --git a/tests/tarantool-index.testfile b/tests/tarantool-index.testfile
> new file mode 100644
> index 0000000000000000000000000000000000000000..9e9ecfbc472cf43e6533aadb6049e52a930863c3
> GIT binary patch
> literal 227
> zcmebDb8(H}GSD+L<_b$KD$dN$vr;hDv(PitHPB5 at H8U|zv#>}sO*Kg7^2{qPNz6-5
> zwNgkivox_tvPjW2OifPIH8C|b(@io-P0=+ at G)y%#O-o8kOfux+y1I*dbrHk4l>tYD
> zmoq>>BST6%<3vWLiHyw5EX=HooD(NAvL11ONWw at C5CbZv0Agccs3a3if}@3rk(q&&
> cfs>(;A+?P$f=QEwk#!;?vltuqRe`l{0V5PD4*&oF
>
> literal 0
> HcmV?d00001
>
> diff --git a/tests/tarantool-not.result b/tests/tarantool-not.result
> new file mode 100644
> index 00000000..6f505ff4
> --- /dev/null
> +++ b/tests/tarantool-not.result
> @@ -0,0 +1 @@
> +ASCII text
> diff --git a/tests/tarantool-not.testfile b/tests/tarantool-not.testfile
> new file mode 100644
> index 00000000..573eac3a
> --- /dev/null
> +++ b/tests/tarantool-not.testfile
> @@ -0,0 +1,3 @@
> +SNAP
> +0.13
> +Version: not a tarantool file
> diff --git a/tests/tarantool-run.result b/tests/tarantool-run.result
> new file mode 100644
> index 00000000..410d8592
> --- /dev/null
> +++ b/tests/tarantool-run.result
> @@ -0,0 +1 @@
> +Tarantool vinyl run, format version 0.13
> diff --git a/tests/tarantool-run.testfile b/tests/tarantool-run.testfile
> new file mode 100644
> index 0000000000000000000000000000000000000000..4435ee46d668d0dbb6e96fcea426a8d3525af4a2
> GIT binary patch
> literal 133
> zcmWFv_2V+oGc at K3OD!tS%+Iq at FxIosGt@QEO;0s5F;26vNHk3~Napg)D=taQOHQ>?
> zNHMcCu}HE=(KSp>PSiCqH8j&rGD%I*HBK~4H8f32N=r;K<l?%zi+i;g!?`0eenQI`
> fAfSnXiJ7 at kaT4Rg#72g+M#dv7An~gLYu^F at lb|HE
>
> literal 0
> HcmV?d00001
>
> diff --git a/tests/tarantool-snap.result b/tests/tarantool-snap.result
> new file mode 100644
> index 00000000..555881dc
> --- /dev/null
> +++ b/tests/tarantool-snap.result
> @@ -0,0 +1 @@
> +Tarantool snapshot, format version 0.13
> diff --git a/tests/tarantool-snap.testfile b/tests/tarantool-snap.testfile
> new file mode 100644
> index 0000000000000000000000000000000000000000..c4cc1537596418eb1aebc3dfa71112fef266275d
> GIT binary patch
> literal 162
> zcmWIca}3}z&@(jV3QH|2&dkrVQZUxD&@<FE&`nP at GciuHut+pbHAv?2%quQQ%u7zS
> zQb;s6GD}V~O4c<?N=(u<F)=jOwKPsj(={_PH#Sa6GD=N0u;2=F&dE>Cwo<6B<>I=!
> zi+i;?!?_37#NRAufPfYTCMHH^MwZi#x7IZ)pAl?o5;)5!p*a0469ePIlBKz+xg`}0
> L4HK>ktbGdrq9if1
>
> literal 0
> HcmV?d00001
>
> diff --git a/tests/tarantool-vylog.result b/tests/tarantool-vylog.result
> new file mode 100644
> index 00000000..f3f9697a
> --- /dev/null
> +++ b/tests/tarantool-vylog.result
> @@ -0,0 +1 @@
> +Tarantool vinyl log, format version 0.13
> diff --git a/tests/tarantool-vylog.testfile b/tests/tarantool-vylog.testfile
> new file mode 100644
> index 0000000000000000000000000000000000000000..b76d5bf72b85e43da0e37fef0875f9ff97c0d0e9
> GIT binary patch
> literal 231
> zcmWHG^znD+GSD+L<_b$KD$dN$vr;hDv(PitHPB5 at H8U|zv#>}sO*Kg7^2{qPNz6-5
> zwNgkivox_tvPjW2OifPIH8C|b(@io-P0=+ at G)y%#O-o8kOfuvObI!?6&bCshHndVO
> zuI1vox{G^tI>R~9j_3Bv86cpMfvHh(5<@H7StbVdiOoyXGE;L>7?zY&7No8y%`47K
> z&r3~NRh(Z`5}#j`l3KJlu{fEBiI<6!8KRN3nTd&$S%4A3V`^lCvN)O<8JU<kpsKhV
> Jt_rMu3jl3ILht|p
>
> literal 0
> HcmV?d00001
>
> diff --git a/tests/tarantool-xlog.result b/tests/tarantool-xlog.result
> new file mode 100644
> index 00000000..6afdeb6d
> --- /dev/null
> +++ b/tests/tarantool-xlog.result
> @@ -0,0 +1 @@
> +Tarantool write-ahead log, format version 0.13
> diff --git a/tests/tarantool-xlog.testfile b/tests/tarantool-xlog.testfile
> new file mode 100644
> index 00000000..2a54a86c
> --- /dev/null
> +++ b/tests/tarantool-xlog.testfile
> @@ -0,0 +1,7 @@
> +XLOG
> +0.13
> +Version: 3.8.1-0-ge643f88a5e0c
> +Instance: d6948b8d-1eca-4516-b4ed-3a1e15fbfab1
> +VClock: {1: 3}
> +
> +���
> \ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.astron.com/pipermail/file/attachments/20261008/c606f41a/attachment.htm>


More information about the File mailing list