Closed Bug 245309 Opened 20 years ago Closed 20 years ago

non-POSIX conformant shell function definition in firefox startup script

Categories

(Toolkit :: Startup and Profile System, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 177996

People

(Reporter: salo, Assigned: benjamin)

Details

User-Agent:       Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.8a2) Gecko/20040601 Firefox/0.8.0+
Build Identifier: Mozilla/5.0 (X11; U; NetBSD i386; en-US; rv:1.8a2) Gecko/20040601 Firefox/0.8.0+

shell function at line 125 of "firefox" startup script has invalid definition.
"function check_running()" is not POSIX conformant syntax and will produce error
on /bin/sh which is not GNU Bash.

FIX: remove the word "function" from the function definition.

Reproducible: Always
Steps to Reproduce:
1. download
http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/contrib/latest-trunk/firefox-i386-unknown-netbsdelf2.0-gtk2.tar.bz2
2. unpack/install it
3. try to run it
4. firefox: 125: Syntax error: "(" unexpected

Actual Results:  
firefox doesn't start

Expected Results:  
firefox should start

The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition:
http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_05

The format of a function definition command is as follows:
 fname() compound-command[io-redirect ...]
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: NetBSD → All
(In reply to comment #0)
> shell function at line 125 of "firefox" startup script has invalid definition.
> "function check_running()" is not POSIX conformant syntax and will produce error
> on /bin/sh which is not GNU Bash.

You mean "Bourne shell", not "POSIX shell".
The POSIX shell in /usr/xpg4/bin/sh perfectly understands the statement.
The problem are Unix versions which use plain Bourne shells as /bin/sh (Solaris,
OSF/1 etc.) ... others like AIX etc. have a ksh88/ksh93 as /bin/sh and won't
have problems with this.
Summary: non-POSIX conformant shell function definition in firefox startup script → non-Bourne conformant shell function definition in firefox startup script
no, i really mean POSIX shell.  if you actually bothered to read the link to
IEEE Std 1003.1 i provided in my report you will notice what's written there
about function definitions in POSIX shell command language.

the fact that some shells (e.g., /bin/sh == Korn Shell) accept the syntax is
really irrelevant in this case.

anyway, i don't understand why you started this bikeshed discussion which
doesn't really lead anywhere and is completely orthogonal to the bug in question.
Summary: non-Bourne conformant shell function definition in firefox startup script → non-POSIX conformant shell function definition in firefox startup script
(In reply to comment #2)
> no, i really mean POSIX shell.  if you actually bothered to read the link to
> IEEE Std 1003.1 i provided in my report you will notice what's written there
> about function definitions in POSIX shell command language.

OK, sorry... I was too tired&&lazy to look at the link and simply assumed that
all Unices which claim that /bin/sh is POSIX-conformant use ksh for that job. I
never heared of an exception of this case... until today. My fault... ;-(

> the fact that some shells (e.g., /bin/sh == Korn Shell) accept the syntax is
> really irrelevant in this case.
> 
> anyway, i don't understand why you started this bikeshed discussion which
> doesn't really lead anywhere and is completely orthogonal to the bug in 
> question.

Uhm, I didn't want to start a flamewar... I was just thinking that ...
a) ... the bug summary was incorrect [I was wrong with that, sorry again]
  and
b) ... that there may be a slightly better solution to get rid of this kind of
bugs _forever_ via adding a configure.in-check which selects a POSIX shell (ksh,
dtksh, /usr/xpg4/bin/sh, bash, netbsd-/bin/sh ...) and sticks that into the
interpreter part of the first line.
Bug 177996 fixes this problem...
grab today's nightly, a fix had already been checked in before this bug was filed.

*** This bug has been marked as a duplicate of 177996 ***
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Anyway, having ksh as /bin/sh is not a solution. It suffers exactly the same
problem.

Even both ksh88 and ksh93 standards define functions with "function name { list; }"
and "name() { list ; }" syntax. Most of the sh/ksh implementations willingly
accept "function name() { list; }" syntax too but some strictly correct ksh (resp.
POSIX sh) implementations do not.
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.