View Issue Details

IDProjectCategoryView StatusLast Update
0000593fileGeneralpublic2024-12-19 15:03
Reporterjamesodhunt Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version5.45 
Summary0000593: Recognise perf(1) perf.data
DescriptionFile doesn't currently recognise the data file format created by the perf(1) Linux performance analysis tool (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf).

The minimal attached patch adds basic support.



Steps To Reproduce```bash
$ file /tmp/perf.data
/tmp/perf.data: data
```

With the patch applied:

```bash
$ file /tmp/perf.data
/tmp/perf.data: perf(1) data
```
TagsNo tags attached.

Activities

jamesodhunt

2024-12-19 15:03

reporter  

0001-Add-perf-1-magic-detection.patch (1,481 bytes)   
From fa30244911274bb9f191883fa0e989f6dd608a9b Mon Sep 17 00:00:00 2001
From: "James O. D. Hunt" <jamesodhunt@gmail.com>
Date: Thu, 19 Dec 2024 14:54:38 +0000
Subject: [PATCH] Add perf(1) magic detection

Add detection for `perf(1)` (Performance analysis tools for Linux).

Signed-off-by: James O. D. Hunt <jamesodhunt@gmail.com>
---
 magic/Magdir/perf | 10 ++++++++++
 magic/Makefile.am |  1 +
 2 files changed, 11 insertions(+)
 create mode 100644 magic/Magdir/perf

diff --git a/magic/Magdir/perf b/magic/Magdir/perf
new file mode 100644
index 00000000..be897008
--- /dev/null
+++ b/magic/Magdir/perf
@@ -0,0 +1,10 @@
+#------------------------------------------------------------------------------
+# perf:  file(1) magic for perf(1) (Performance analysis tools) command
+#
+# For file format details, see:
+#
+# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/perf.data-file-format.txt
+
+# The file is normally called 'perf.data' but can take any name,
+# so only check the eye catcher value.
+0	string		PERFILE2	perf(1) data
diff --git a/magic/Makefile.am b/magic/Makefile.am
index e0f90343..2020a82c 100644
--- a/magic/Makefile.am
+++ b/magic/Makefile.am
@@ -242,6 +242,7 @@ $(MAGIC_FRAGMENT_DIR)/pci_ids \
 $(MAGIC_FRAGMENT_DIR)/pcjr \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
+$(MAGIC_FRAGMENT_DIR)/perf \
 $(MAGIC_FRAGMENT_DIR)/perl \
 $(MAGIC_FRAGMENT_DIR)/pgf \
 $(MAGIC_FRAGMENT_DIR)/pgp \
-- 
2.47.1

Issue History

Date Modified Username Field Change
2024-12-19 15:03 jamesodhunt New Issue
2024-12-19 15:03 jamesodhunt File Added: 0001-Add-perf-1-magic-detection.patch