NetBSD Problem Report #34968
From tron@colwyn.zhadum.org.uk Thu Nov 2 10:41:30 2006
Return-Path: <tron@colwyn.zhadum.org.uk>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 9961E63B8CA
for <gnats-bugs@gnats.NetBSD.org>; Thu, 2 Nov 2006 10:41:30 +0000 (UTC)
Message-Id: <200611021041.kA2AfSN7010900@colwyn.zhadum.org.uk>
Date: Thu, 2 Nov 2006 10:41:28 GMT
From: Matthias Scheler <tron@colwyn.zhadum.org.uk>
Reply-To: tron@colwyn.zhadum.org.uk
To: gnats-bugs@NetBSD.org
Subject: "checkperms" is broken under Mac OS X
X-Send-Pr-Version: 3.95
>Number: 34968
>Category: pkg
>Synopsis: "checkperms" is broken under Mac OS X
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: rillig
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 02 10:45:00 +0000 2006
>Closed-Date: Thu Jan 24 19:50:41 +0000 2008
>Last-Modified: Thu Jan 24 19:50:41 +0000 2008
>Originator: Matthias Scheler
>Release: Darwin 8.8.0
>Organization:
Matthias Scheler http://zhadum.org.uk/
>Environment:
System: Darwin excalibur.zhadum.org.uk 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep 8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc
Architecture: powerpc
Machine: Power Macintosh
>Description:
"checkperms" doesn't work under Mac OS X:
tron@excalibur:~>file /bin/ls
/bin/ls: Mach-O executable ppc
tron@excalibur:~>echo /bin/ls | checkperms -c
tron@excalibur:~>/bin/ls -l /bin/ls
-r-xr-xr-x 1 root wheel 32460 Feb 28 2006 /bin/ls
warning: /bin/ls: executable bit is set on non-executable file.
0 errors and 1 warnings.
>How-To-Repeat:
echo /bin/ls | checkperms -c
warning: /bin/ls: executable bit is set on non-executable file.
0 errors and 1 warnings.
>Fix:
The warning which ask users to install "chechperms" should be removed
until this tool really works on all the supported pkgsrc platforms.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->rillig
Responsible-Changed-By: rillig@netbsd.org
Responsible-Changed-When: Thu, 02 Nov 2006 19:33:09 +0000
Responsible-Changed-Why:
I'll take it.
State-Changed-From-To: open->feedback
State-Changed-By: rillig@netbsd.org
State-Changed-When: Thu, 02 Nov 2006 19:33:09 +0000
State-Changed-Why:
Do you know any pkgsrc platforms that have executable files which are
neither ELF nor AIX nor Mac OS X files? Do we still need to handle a.out?
From: Roland Illig <rillig@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/34968 CVS commit: pkgsrc/sysutils/checkperms
Date: Thu, 2 Nov 2006 19:31:11 +0000 (UTC)
Module Name: pkgsrc
Committed By: rillig
Date: Thu Nov 2 19:31:11 UTC 2006
Modified Files:
pkgsrc/sysutils/checkperms: Makefile distinfo
Log Message:
Updated checkperms to 1.4.
Changes since 1.3:
- Added support for Mac OS X and AIX binaries and libraries.
This should fix PR 34968.
To generate a diff of this commit:
cvs rdiff -r1.2 -r1.3 pkgsrc/sysutils/checkperms/Makefile \
pkgsrc/sysutils/checkperms/distinfo
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Matthias Scheler <tron@zhadum.org.uk>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/34968 ("checkperms" is broken under Mac OS X)
Date: Thu, 2 Nov 2006 19:47:37 +0000
On Thu, Nov 02, 2006 at 07:33:11PM +0000, rillig@NetBSD.org wrote:
> State-Changed-From-To: open->feedback
> State-Changed-By: rillig@netbsd.org
> State-Changed-When: Thu, 02 Nov 2006 19:33:09 +0000
> State-Changed-Why:
> Do you know any pkgsrc platforms that have executable files which are
> neither ELF nor AIX nor Mac OS X files?
Interix perhaps?
Version 1.4 of the "checkperms" package fixes the problem:
tron@excalibur:~>echo /bin/ls | checkperms -c
tron@excalibur:~>
Kind regards
--
Matthias Scheler http://zhadum.org.uk/
Responsible-Changed-From-To: rillig->tv
Responsible-Changed-By: rillig@netbsd.org
Responsible-Changed-When: Sun, 05 Nov 2006 07:48:52 +0000
Responsible-Changed-Why:
Hello Todd,
I don't know anything about Interix, so can you please have a try if the
sysutils/checkperms package is working there? Please install the package
and run:
echo /bin/ls | checkperms -c
If it does not report any warning, it's fine. Otherwise please reassign
the PR to me and tell me with what bytes the Interix binaries start,
like "\x7fELF" is for ELF binaries.
From: "Todd Vierling" <tv@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: rillig@netbsd.org, gnats-admin@netbsd.org,
tron@colwyn.zhadum.org.uk
Subject: Re: pkg/34968 ("checkperms" is broken under Mac OS X)
Date: Mon, 6 Nov 2006 11:29:54 -0500
On 11/5/06, rillig@netbsd.org <rillig@netbsd.org> wrote:
> I don't know anything about Interix, so can you please have a try if the
> sysutils/checkperms package is working there?
I haven't had a chance to test it yet, but most certainly it won't
work. Interix has ELF-like behavior, but its binaries are Windows PE
files.
Attached at bottom is an excerpt from the Interix-supplied
/usr/share/magic file, and an excerpt of hexdump on one such binary.
I would advise a very specific check for "Posix-CUI" executable files
as described below so that the extended NTFS permissions on Win32
binaries are not clobbered by checkperms. (chmod(2) will clobber any
permissions and NT ACLs and replace them with the simple POSIX
permissions, which is undesirable for non-Interix binaries.)
The quick pseudo description of how to detect these binaries is:
* first two bytes must be "MZ"
* at offset 60 (decimal) is a 32-bit little-endian number X
* at offset X must be the four bytes "PE\0\0"
* at offset X+92 (decimal) must be the little-endian 16-bit number 7
Because of hacks in the way shared library support was shoehorned into
Interix 3, the definitions for "Interix dynamic shared library" in the
magic file excerpt below are incorrect, but included here for
completeness. The pseudocode description above should correctly match
all Interix binaries and shlibs.
=====
# Various Microsoft OS. formats
#------------------------
#
# Windows NT magic numbers
#
# All NT executable and DLL files have a MS-DOS header stub
# which has the "MZ" identifiable string
#
# The offset to find the PE signature (the string "PE\0\0")
# is given at address 60.
# After the signature (4bytes long) is the PE file header.
#
# offset [ (60+offset) ]
# ------
# 0 PE signature (4 bytes)
# 4 machine type (2bytes)
# ...
# 22 characteristics (2 bytes)
# if 0x2000 bit set, then its a DLL
#
# 24 [ Start of optional headers ]
#
# 92 subsystem type
# 94 DLLCharacteristics (NT obsolete)
# - but used by Interix GNU ld to indicate shared library
#
#
#
0 string MZ
>(60) string PE Windows NT PE format (EXE),
# check if a DLL (or a .so) then
>>(60+22) short &0x2000
>>>(60+94) short 1 Interix dynamic shared library
>>>(60+94) short 0 Windows DLL
#endif
# if its not a DLL then print out image characteristics
>>(60+22) short >0
>>>(60+94) short 1 dynamically linked
>>>(60+22) short &0x2 executable
>>>(60+22) short ^0x2 incomplete executable
>>>(60+22) short ^0x200 not stripped
#endif
>>(60+4) short 0x14c Intel
>>(60+4) short 0x166 MIPS
>>(60+4) short 0x184 Alpha
>>(60+4) short 0x1F0 PowerPC
>>(60+4) short 0x290 HP-Risc
>>(60+92) short 7 Posix-CUI
>>(60+92) short 3 Windows-CUI
>>(60+92) short 2 Windows-GUI
>>(60+92) short 1 NT-native
=====
00000000 4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00
00000010 b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00000030 00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00
00000040 0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68
00000050 69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f
00000060 74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20
00000070 6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00
00000080 50 45 00 00 4c 01 0b 00 59 f4 10 42 00 00 00 00
00000090 00 00 00 00 e0 00 0f 02 0b 01 02 38 00 fa 05 00
000000a0 00 ca 08 00 00 3a 01 00 78 10 00 00 00 10 00 00
000000b0 00 10 06 00 00 00 40 00 00 10 00 00 00 02 00 00
000000c0 04 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00
000000d0 00 70 0a 00 00 04 00 00 e7 81 09 00 07 00 01 00
000000e0 00 00 40 00 00 00 01 00 00 00 10 00 00 10 00 00
000000f0 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00
--
-- Todd Vierling <tv@duh.org> <tv@pobox.com> <todd@vierling.name>
From: "Todd Vierling" <tv@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: rillig@netbsd.org, gnats-admin@netbsd.org,
tron@colwyn.zhadum.org.uk
Subject: Re: pkg/34968 ("checkperms" is broken under Mac OS X)
Date: Mon, 6 Nov 2006 11:45:24 -0500
On 11/5/06, rillig@netbsd.org <rillig@netbsd.org> wrote:
> I don't know anything about Interix, so can you please have a try if the
> sysutils/checkperms package is working there? Please install the package
> and run:
>
> echo /bin/ls | checkperms -c
>
> If it does not report any warning, it's fine. Otherwise please reassign
> the PR to me and tell me with what bytes the Interix binaries start,
> like "\x7fELF" is for ELF binaries.
OK, I built it by hand (my pkgsrc environment is being rebootstrapped)
and I noticed one more thing:
warning: /bin/ls: group-writable file.
On Interix, group writability for executables is actually normal,
because administrative permission is governed by gid 131616, not a
specific root user. pkgsrc is currently set up to use the standard
0755 permissions for binaries, but this may later change to 0775 to be
in line with the rest of the system. (It already uses 0775 for
directories per PKGDIRMODE; this at least allows the Administrators
group file delete permission.)
--
-- Todd Vierling <tv@duh.org> <tv@pobox.com> <todd@vierling.name>
State-Changed-From-To: feedback->open
State-Changed-By: rillig@netbsd.org
State-Changed-When: Fri, 17 Nov 2006 01:01:23 +0000
State-Changed-Why:
Feedback provided.
From: Roland Illig <rillig@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: PR/34968 CVS commit: pkgsrc/mk/check
Date: Fri, 17 Nov 2006 01:05:48 +0000 (UTC)
Module Name: pkgsrc
Committed By: rillig
Date: Fri Nov 17 01:05:48 UTC 2006
Modified Files:
pkgsrc/mk/check: check-perms.mk
Log Message:
On Interix, the -c option of checkperms is disabled, as checkperms does
not know about Interix yet. This is a temporary work-around for
PR 34968.
To generate a diff of this commit:
cvs rdiff -r1.4 -r1.5 pkgsrc/mk/check/check-perms.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: tv->rillig
Responsible-Changed-By: tv@netbsd.org
Responsible-Changed-When: Mon, 20 Nov 2006 15:27:09 +0000
Responsible-Changed-Why:
back to rillig
State-Changed-From-To: open->closed
State-Changed-By: tron@narn.netbsd.org
State-Changed-When: Thu, 24 Jan 2008 19:50:41 +0000
State-Changed-Why:
This has been fixed a while ago:
tron@excalibur:~>uname -a
Darwin excalibur.zhadum.org.uk 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc
tron@excalibur:~>echo /bin/ls | checkperms -c
tron@excalibur:~>
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.