misc/149335: shell script runs on Linux but not on freebsd

Paul eb30750 at gmail.com
Fri Aug 6 12:50:03 UTC 2010

The following reply was made to PR misc/149335; it has been noted by GNATS.

From: Paul <eb30750 at gmail.com>
To: "eb30750 at gmail.com" <eb30750 at gmail.com>,
 "freebsd-bugs at FreeBSD.ORG" <freebsd-bugs at FreeBSD.ORG>,
 "bug-followup at FreeBSD.ORG" <bug-followup at FreeBSD.ORG>
Subject: Re: misc/149335: shell script runs on Linux but not on freebsd
Date: Fri, 6 Aug 2010 08:15:37 -0400

 Yes it can be closed.  The bundle file is for installing VMware-Player.  Tho=
 ugh not officially supported it appears others have installed this,  I will t=
 ry your suggestions and research this further.
 Sent from my iPod
 On Aug 6, 2010, at 3:12 AM, Oliver Fromme <olli at lurza.secnetix.de> wrote:
 > Paul Lambert wrote:
 >>> Number:         149335
 >>> Category:       misc
 >>> Synopsis:       shell script runs on Linux but not on freebsd
 >> [...]
 >>> Environment:
 >> FreeBSD BRSINC-VM02.local 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 0=
 2:36:49 UTC 2010     root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC=
 >>> Description:
 >> The script fails on these two lines so far; "stat" and "od"
 >> # This won't work with non-GNU stat.
 >> FILE_SIZE=3D`stat --format "%s" "$0"`
 >> offset=3D$(($FILE_SIZE - 4))
 > As the comment suggests, that command is non-portable and
 > works with GNU stat (linux) only.  This is not a standard.
 > The equivalent BSD command line would be:
 > FILE_SIZE=3D`stat -f %z "$0"`
 > I wonder why the script even needs to find out its own size,
 > and then read binary data from itself?!?  Is this some kind
 > of "copy protection" or similar tricks?  If so, I suspect
 > that it is highly non-portable and will be difficult to get
 > to run on anything else than linux.
 >>   # XXX: put extraction in its own function
 >>   MAGIC_NUMBER=3D`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`=
 > This command works fine on FreeBSD 8.1.  If it doesn't work
 > in the context of the script, I suspect that it is caused
 > by preceding problems that set one of the variables to a
 > wrong value.
 > As a work-around, you might try running the script with
 > /compat/linux/bin/sh instead of /bin/sh.  You need to
 > enable Linux compatibility ("kldload linux") and install
 > ports/emulators/linux_base-f10 if you don't have it already.
 > As this is not a bug in FreeBSD, I suggest that this PR can
 > be closed.  Do you agree?
 > Best regards
 >   Oliver
 > --=20
 > Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
 > Handelsregister: Registergericht Muenchen, HRA 74606,  Gesch=C3=A4ftsfuehr=
 > secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M=C3=BC=
 > chen, HRB 125758,  Gesch=C3=A4ftsf=C3=BChrer: Maik Bachmann, Olaf Erb, Ral=
 f Gebhart
 > FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd
 > "Unix gives you just enough rope to hang yourself --
 > and then a couple of more feet, just to be sure."
 >        -- Eric Allman

More information about the freebsd-bugs mailing list