From nobody@FreeBSD.org  Thu Aug  5 17:49:44 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 32AB61065672
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Aug 2010 17:49:44 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 210BE8FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Aug 2010 17:49:44 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o75HnhmV083964
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 5 Aug 2010 17:49:43 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o75HnhkG083963;
	Thu, 5 Aug 2010 17:49:43 GMT
	(envelope-from nobody)
Message-Id: <201008051749.o75HnhkG083963@www.freebsd.org>
Date: Thu, 5 Aug 2010 17:49:43 GMT
From: Paul Lambert <eb30750@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: shell script runs on Linux but not on freebsd
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         149335
>Category:       misc
>Synopsis:       shell script runs on Linux but not on freebsd
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 05 17:50:09 UTC 2010
>Closed-Date:    Fri Aug 06 13:24:48 UTC 2010
>Last-Modified:  Fri Aug  6 14:50:05 UTC 2010
>Originator:     Paul Lambert
>Release:        8.,1-release
>Organization:
BRSINC
>Environment:
FreeBSD BRSINC-VM02.local 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
The script fails on these two lines so far; "stat" and "od"


# This won't work with non-GNU stat.
FILE_SIZE=`stat --format "%s" "$0"`
offset=$(($FILE_SIZE - 4))



   # XXX: put extraction in its own function
   MAGIC_NUMBER=`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`

   if [ "$MAGIC_NUMBER" != "907380241" ]; then
      echo "magic number does not match"
      #exit 1
   fi

>How-To-Repeat:


./prgm.bundle
>Fix:
The linux Bash version is 4.1.7(1) and the installed freebsd is 4.1.7(0)-release

>Release-Note:
>Audit-Trail:

From: Oliver Fromme <olli@lurza.secnetix.de>
To: eb30750@gmail.com, freebsd-bugs@FreeBSD.ORG, bug-followup@FreeBSD.ORG
Cc:  
Subject: Re: misc/149335: shell script runs on Linux but not on freebsd
Date: Fri, 6 Aug 2010 09:12:40 +0200 (CEST)

 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 02:36:49 UTC 2010     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64
  > > Description:
  > The script fails on these two lines so far; "stat" and "od"
  > 
  > # This won't work with non-GNU stat.
  > FILE_SIZE=`stat --format "%s" "$0"`
  > offset=$(($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=`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=`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
 
 -- 
 Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
 Handelsregister: Registergericht Muenchen, HRA 74606,  Geschftsfuehrung:
 secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mn-
 chen, HRB 125758,  Geschftsfhrer: Maik Bachmann, Olaf Erb, Ralf 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

From: Paul <eb30750@gmail.com>
To: "eb30750@gmail.com" <eb30750@gmail.com>,
 "freebsd-bugs@FreeBSD.ORG" <freebsd-bugs@FreeBSD.ORG>,
 "bug-followup@FreeBSD.ORG" <bug-followup@FreeBSD.ORG>
Cc:  
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.
 Thanks
 Paul
 
 Sent from my iPod
 
 On Aug 6, 2010, at 3:12 AM, Oliver Fromme <olli@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@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC=
   amd64
 >>> Description:
 >> The script fails on these two lines so far; "stat" and "od"
 >>=20
 >> # This won't work with non-GNU stat.
 >> FILE_SIZE=3D`stat --format "%s" "$0"`
 >> offset=3D$(($FILE_SIZE - 4))
 >=20
 > 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:
 >=20
 > FILE_SIZE=3D`stat -f %z "$0"`
 >=20
 > 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.
 >=20
 >>   # XXX: put extraction in its own function
 >>   MAGIC_NUMBER=3D`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`=
 
 >=20
 > 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.
 >=20
 > 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.
 >=20
 > As this is not a bug in FreeBSD, I suggest that this PR can
 > be closed.  Do you agree?
 >=20
 > Best regards
 >   Oliver
 >=20
 > --=20
 > Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
 > Handelsregister: Registergericht Muenchen, HRA 74606,  Gesch=C3=A4ftsfuehr=
 ung:
 > secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M=C3=BC=
 n-
 > chen, HRB 125758,  Gesch=C3=A4ftsf=C3=BChrer: Maik Bachmann, Olaf Erb, Ral=
 f Gebhart
 >=20
 > FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd
 >=20
 > "Unix gives you just enough rope to hang yourself --
 > and then a couple of more feet, just to be sure."
 >        -- Eric Allman
State-Changed-From-To: open->closed 
State-Changed-By: olli 
State-Changed-When: Fri Aug 6 13:23:06 UTC 2010 
State-Changed-Why:  
Not a FreeBSD bug. 
Originator agrees that this PR can be closed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=149335 

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

 What about matching the ' marks in this section?  I get a command error.
 
 >>   # XXX: put extraction in its own function
 >>   MAGIC_NUMBER=3D`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`=
 
 >=20
 >=20
 
 
 Sent from my iPod
 
 On Aug 6, 2010, at 3:12 AM, Oliver Fromme <olli@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@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC=
   amd64
 >>> Description:
 >> The script fails on these two lines so far; "stat" and "od"
 >>=20
 >> # This won't work with non-GNU stat.
 >> FILE_SIZE=3D`stat --format "%s" "$0"`
 >> offset=3D$(($FILE_SIZE - 4))
 >=20
 > 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:
 >=20
 > FILE_SIZE=3D`stat -f %z "$0"`
 >=20
 > 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.
 >=20
 >>   # XXX: put extraction in its own function
 >>   MAGIC_NUMBER=3D`od -An -t u4 -N 4 -j $MAGIC_OFFSET "$file" | tr -d ' '`=
 
 >=20
 > 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.
 >=20
 > 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.
 >=20
 > As this is not a bug in FreeBSD, I suggest that this PR can
 > be closed.  Do you agree?
 >=20
 > Best regards
 >   Oliver
 >=20
 > --=20
 > Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
 > Handelsregister: Registergericht Muenchen, HRA 74606,  Gesch=C3=A4ftsfuehr=
 ung:
 > secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht M=C3=BC=
 n-
 > chen, HRB 125758,  Gesch=C3=A4ftsf=C3=BChrer: Maik Bachmann, Olaf Erb, Ral=
 f Gebhart
 >=20
 > FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd
 >=20
 > "Unix gives you just enough rope to hang yourself --
 > and then a couple of more feet, just to be sure."
 >        -- Eric Allman
>Unformatted:
