zsh-users
 help / color / mirror / code / Atom feed
* sh/bash incompatibility - noticeable with Netscape
@ 1997-04-02  0:56 Chris Laas
  1997-04-02  1:12 ` Clint Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Laas @ 1997-04-02  0:56 UTC (permalink / raw)
  To: zsh-users

Since I started using zsh, I've been getting errors with running helper
apps under Netscape, and I finally investigated the cause.  I have
/bin/sh symbolically linked to zsh (instead of the default bash on
Slackware Linux) and it consistently fails with a parse error whenever
a helper app is run from Netscape.  By linking /bin/sh to /bin/echo, I
discovered that Netscape runs a line of the form:

/bin/sh -c "((helper-app); rm /var/tmp/MO0123456789.foo)&"

where helper-app is the text in the Helpers tab of the General Options
dialog, and the temp file is the downloaded file.

This line runs fine with bash, but zsh parses the leading (( as an
arithmetic expression opening, and fails.  There is no way I can figure
out to convince Netscape to put a space between the two leading
open-parens.

So, what it boils down to is, could we have a fix to the parsing code
to recognize this condition (possibly only when zsh is in
sh-compatibility mode)?

--Chris

-- 
Such has been the patient sufferance of these colonies; and such is
now the necessity which constrains them to alter their former systems
of government.
    -- Thomas Jefferson, Prologue, "Declaration of Independence"
______________________________________________________________________
Chris Laas:  Unix, C++, Perl, Tcl/Tk / mailto:chrisl@cybercom.net
Limit[tech->Inf](words/acronyms)==0 / http://www.cybercom.net/~chrisl/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh/bash incompatibility - noticeable with Netscape
  1997-04-02  0:56 sh/bash incompatibility - noticeable with Netscape Chris Laas
@ 1997-04-02  1:12 ` Clint Adams
  1997-04-02 16:25   ` Chet Ramey
  0 siblings, 1 reply; 3+ messages in thread
From: Clint Adams @ 1997-04-02  1:12 UTC (permalink / raw)
  To: chrisl; +Cc: zsh-users

> This line runs fine with bash, but zsh parses the leading (( as an
> arithmetic expression opening, and fails.  There is no way I can figure
> out to convince Netscape to put a space between the two leading
> open-parens.

This only works with bash 1.x.  bash 2.0 will properly choke in the same way
as zsh.

Better to fix the bug in Netscape (and harass them about fixing it)

This is a slightly modified excerpt of the Debian netscape installer script
(for perl)

undef $/;
open(NETSCAPE,"</tmp/netscape.orig") || die "ERROR: Could not read netscape exec
utable -- $!\n";
$netscape = <NETSCAPE>;
close(NETSCAPE);

$netscape =~ s/\(\(\0cat %s \| \0\);/\( \0cat %s \| \0 ;/;

$outfile='/tmp/netscape.patched';
open(NETSCAPE,">$outfile") || die "ERROR: Could not write '$outfile' -- $!\n";
print NETSCAPE $netscape;
close(NETSCAPE);
chmod 0755,$outfile;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sh/bash incompatibility - noticeable with Netscape
  1997-04-02  1:12 ` Clint Adams
@ 1997-04-02 16:25   ` Chet Ramey
  0 siblings, 0 replies; 3+ messages in thread
From: Chet Ramey @ 1997-04-02 16:25 UTC (permalink / raw)
  To: zsh-users; +Cc: schizo, chrisl

> > This line runs fine with bash, but zsh parses the leading (( as an
> > arithmetic expression opening, and fails.  There is no way I can figure
> > out to convince Netscape to put a space between the two leading
> > open-parens.
> 
> This only works with bash 1.x.  bash 2.0 will properly choke in the same way
> as zsh.

...and yet bash-2.01 will have a fix.  I fixed the bash parsing code
so that it requires an arithmetic command to begin with `((', end
with `))', and have an equal number of open and close parens.  If it
does not end with `))', it is treated as a nested subshell.  A non-
balancing number of open and close parens is treated as a syntax error.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-04-02 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-02  0:56 sh/bash incompatibility - noticeable with Netscape Chris Laas
1997-04-02  1:12 ` Clint Adams
1997-04-02 16:25   ` Chet Ramey

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).