🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #4105

Bug#1153703: `dash ./prog` tries to execute binary files as scripts

#4105
From: Josh Triplett
Date: Wed, 11 Nov 2026 07:00
34 lines
4100 bytes
Package: dash
Version: 0.5.12-12
Severity: normal
X-Debbugs-Cc: josh@joshtriplett.org

dash in Debian has a patch so that `dash -c ./prog`, after getting
ENOEXEC, will check if the file looks binary before trying to run it as
a shell script.

However, dash doesn't do the same check when handed the program like
`dash ./prog`. (bash does check this.)

/tmp/temp$ file prog
prog: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, not stripped
/tmp/temp$ uname -m
x86_64
/tmp/temp$ ./prog
-bash: ./prog: cannot execute binary file: Exec format error
(126) /tmp/temp$ bash -c ./prog
bash: line 1: ./prog: cannot execute binary file: Exec format error
(126) /tmp/temp$ bash ./prog
./prog: ./prog: cannot execute binary file
(126) /tmp/temp$ dash -c ./prog
dash: 1: ./prog: Exec format error
(126) /tmp/temp$ dash ./prog
./prog: 13: cannot open �: No such file
./prog: 14: Syntax error: word unexpected (expecting ")")

I ran into this, in particular, by cross-configuring a Linux kernel tree
for aarch64 on my x86-64 laptop, such that scripts/kconfig/conf was an
x86-64 ELF binary, and then trying to build the resulting kernel tree on
a native aarch64 system. The Makefile ended up trying to run
scripts/kconfig/conf with dash.

Working on a patch for this.

-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: arm64

Kernel: Linux 7.3.3+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages dash depends on:
ii  debianutils  5.24
ii  libc6        2.43-7

dash recommends no packages.

dash suggests no packages.

-- debconf information excluded
Technical Details
Message-ID: <NYatj-baUD-1@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.corradoroberto.it!bofh.it!news.nic.it!robomod
From: Josh Triplett <josh@joshtriplett.org>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1153703: `dash ./prog` tries to execute binary files as scripts
Date: Wed, 11 Nov 2026 08:00:01 +0100
Message-ID: <NYatj-baUD-1@gated-at.bofh.it>
X-Original-To: Debian Bug Tracking System <submit@bugs.debian.org>
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Wed Nov 11 06:57:08 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.65
Reply-To: Josh Triplett <josh@joshtriplett.org>, 1153703@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: josh@joshtriplett.org, andrewsh@debian.org
X-Debian-Pr-Message: report 1153703
X-Debian-Pr-Package: dash
X-Debian-Pr-Source: dash
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
X-Mailer: reportbug 13.2.0+nmu1
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2001976
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 34
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Date: Tue, 10 Nov 2026 22:56:04 -0800
X-Original-Message-ID: <179438016482.946513.15497968165493692944.reportbug@o>