#3607 PR open: Update 260_EFISTUB_populate.sh

Labels: enhancement

gigawatts opened issue at 2026-05-11 01:42:

Relax-and-Recover (ReaR) Pull Request Template

Please fill in the following items before submitting a new pull request:

Pull Request Details:
  • Type: Bug Fix

  • Impact: Normal

  • Reference to related issue (URL):
    https://github.com/rear/rear/issues/3606

  • How was this pull request tested?
    Modified the local script, re-ran backup, EFI file was correctly validated

  • Description of the changes in this pull request:
    Allows several variations of the file command output for validation of EFISTUB file

codacy-production commented at 2026-05-11 01:44:

Up to standards ✅

🟢 Issues 0 issues >
> > **Results:** > `0` new issues > > [View in > Codacy](https://app.codacy.com/gh/rear/rear/pull-requests/3607/issues) >

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

lzaoral commented at 2026-05-15 07:41:

Isn't there some better way to detect EFI binaries? Using file is a Russian roulette because its output may change with every release.

gdha commented at 2026-05-15 07:45:

Isn't there some better way to detect EFI binaries? Using file is a Russian roulette because its output may change with every release.

@lzaoral Any suggestion to replace file?

jsmeix commented at 2026-05-18 12:20:

For the fun of it regarding

Isn't there some better way to detect EFI binaries?

I asked Google AI
"what is the best way to detect EFI binaries in Linux ?"
and it replied:

The best way to detect EFI (Extensible Firmware Interface)
binaries in Linux is by checking their file header structure.
EFI binaries use the Microsoft PE/COFF executable format,
not the standard Linux ELF format. 
Here are the most effective methods to detect them,
ordered from simplest to most advanced.

The file Command (Fastest):
The standard file utility reads the magic bytes
in the header and explicitly identifies EFI binaries. 
* Run:
  file path/to/binary
* Output for EFI:
  Look for PE32 or PE32+ followed by EFI application.
* Example:
  systemd-bootx64.efi: PE32+ executable (EFI application) x86-64, for MS Windows

The objdump Command (Most Detailed):
If you need to verify the exact target architecture,
objdump from the binutils package inspects
the binary format directly.
* Run:
  objdump -p path/to/binary | head -n 10
* Output for EFI:
  Look for file format pei-x86-64 (or pei-i386 / pei-aarch64).

Direct Hex Inspection (No Dependencies):
If you are writing a script and cannot rely on
external tools, read the first few bytes of the file.
EFI files begin with the DOS stub magic bytes MZ (hex: 4d 5a).
Further into the header, they contain the PE signature
PE\0\0 (hex: 50 45 00 00).
Command:
head -c 2 path/to/binary | xxd (Look for MZ).

[Export of Github issue for rear/rear.]