Subject: kern/32161: m68k a.out emulation broken
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 11/24/2005 21:00:01
>Number:         32161
>Category:       kern
>Synopsis:       m68k a.out emulation broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov 24 21:00:01 +0000 2005
>Originator:     Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
>Release:        NetBSD 3.99.10
>Organization:
Falling Raindrops
>Environment:
	
	
System: NetBSD mara 3.99.10 NetBSD 3.99.10 (TESTER) #6: Fri Nov 4 21:12:55 CET 2005 hauke@mara:/usr/src/sys/arch/mac68k/compile/TESTER mac68k
Architecture: m68k
Machine: mac68k
>Description:

It looks like a.out compatibility is broken in -current.

I was trying to set up a chrooted netbsd-1-5 installation on mac68k with a
3.99.1[01] kernel, partly to build the distribution and partly to reproduce
PR 26896. But when I chrooted to the netbsd-1-5 partition, I saw - nothing.
The command path behaved as if empty, ls(1) did not show anything. Same if
I leave the chroot and just call a.out binaries:

[hauke@q700] ~ # sh bin/setup_build_chroot.sh
Mounting build disk...
Mounting 1.5 sources readonly...
Union-mounting sources below usr/src...
Union-mounting var/obj/netbsd-15 on top of usr/src...
chroot(8)ing to /n...
[hauke@q700] / # ls
ls: Command not found.
[hauke@q700] / # /bin/ls
[hauke@q700] / # man ls
man: Command not found.
[hauke@q700] / # /usr/bin/man ls
man: no entry for ls in the manual.
[hauke@q700] / # env MANPATH=/usr/share/man /usr/bin/man ls
env: Command not found.
[hauke@q700] / # /usr/bin/env MANPATH=/usr/share/man /usr/bin/man ls
man: no entry for ls in the manual.
[hauke@q700] / # exit
[hauke@q700] /n > ls -l
total 7016
drwxr-xr-x   2 root  wheel      512 Oct  2 23:13 altroot
drwxr-xr-x   3 root  wheel      512 Oct 12 09:36 amd
drwxr-xr-x   2 root  wheel     1024 Oct  8 13:31 bin
drwxrwxr-x   6 root  wsrc       512 Nov 12 10:36 build
drwxr-xr-x   3 root  wheel     8704 Oct  7 01:10 dev
drwxr-xr-x  17 root  wheel     2560 Oct 13 09:11 etc
drwxr-xr-x   2 root  wheel      512 Oct  2 23:13 home
drwxr-xr-x   2 root  wheel      512 Sep 12  2004 kern
-rw-r--r--   1 root  wheel     8588 Nov 14 23:47 ktrace.out
drwx-----T   2 root  wheel    18432 Nov 11 00:47 lost+found
drwxr-xr-x   2 root  wheel      512 Oct  2 23:13 mnt
drwxr-xr-x   2 root  wheel      512 Apr 25  2005 mnt2
-r--r--r--   1 root  wheel  2345334 Oct  7 05:35 netbsd
-r--r--r--   1 root  wheel  2345334 Jul 12  2004 netbsd.68030
-r--r--r--   2 root  wheel  2339669 Apr 25  2005 netbsd.old
drwxr-xr-x   2 root  wheel      512 Sep 12  2004 proc
drwxr-xr-x   3 root  wheel      512 Oct  7 01:07 root
drwxr-xr-x   2 root  wheel     1536 Oct  6 23:06 sbin
drwxr-xr-x   2 root  wheel      512 Oct  2 23:13 stand
lrwxr-xr-x   1 root  wheel       11 Oct  7 01:07 sys -> usr/src/sys
drwxrwxrwt   2 root  wheel      512 Nov 11 03:18 tmp
drwxr-xr-x  17 root  wheel      512 Oct  2 23:13 usr
drwxr-xr-x  21 root  wheel      512 Oct  2 23:13 var
[hauke@q700] /n > uname -a
NetBSD q700 3.99.11 NetBSD 3.99.11 (TESTER) #0: Sun Nov 13 11:43:41 CET
2005
hauke@q700:/var/obj/netbsd-builds/current/mac68k/obj/sys/arch/mac68k/compile/TES
TER mac68k
[hauke@q700] /n > file bin/ls
bin/ls: a.out NetBSD/m68k demand paged executable
[hauke@q700] /n > bin/ls -la
[hauke@q700] /n >

There is no coredump from any tool, and ktracing ls(1) shows that ls(1)
actually reads the directory.

The chroot (and generally, running a.out binaries) works on netbsd-2; I
haven't checked netbsd-3.

>How-To-Repeat:

Set up a -current NetBSD/mac68k system (probably any m68k will do - 
I don't know about other architectures), and run a.out binaries 
(statically linked) from old NetBSD distribution - mac68k was 
a.out before 1.6.

Watch unexpected behaviour.

>Fix:
	None, sorry.

>Unformatted: