Skip to content

system(.., ignore.stderr = TRUE) problem on Solaris (PR#547)

2 messages · Martin Maechler, Brian Ripley

#
(i.e. my version Solaris, see below...)

Note that system() is not only implemented quite system-dependently
(which you'd very much expect!) but also Unix and Windows have quite
different arguments apart from the first two.

Hence all the following is ``Unix-only'' :


A user stumbled across this when using read.table.url(.) on a platform
where no "wget" is installed: 

The data is read ok, but an ugly message appears *before* the command is
completed :
	  -------------------
	  sh: wget: not found
	  -------------------
which made the user believe that the data wasn't read properly.

The problem is easily tracked to the system(..) call in download.file()
{which does not (yet) have the "ignore.stderr = TRUE" setting, btw}
and found that on our Solaris environment, 
the ignore.stderr argument does not seem to have any effect, i.e.

  > system("bla", ignore.stderr = TRUE)

gives the same as  system("bla"), namely
  
  sh: bla: not found
 
On my Linux environment,  ignore.stderr works as advertized.

Further note that  help(system)  should probably also say something about which
shell may or may not be used (I think we decided that we want it to be `sh'
on Unix).


--please do not edit the information below-- {did anyway ;=)}

Version:
 platform = sparc-sun-solaris2.5.1
 arch = sparc
 os = solaris2.5.1
 system = sparc, solaris2.5.1

 --- either R-devel of today, or also 1.0.1 ---

 year = 2000
 month = May
 day = 18
 language = R

Search Path:
 .GlobalEnv, package:SfS, Autoloads, package:base



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Fri, 19 May 2000 maechler@stat.math.ethz.ch wrote:

            
Under sh you cannot redirect the output from a command until the command
is running.  That is, you are not redirecting the error messages from sh,
only from the command.  Unless the command runs, ignore.stderr has no
effect.
Depends how you read the advertising.
Yes, and you almost certainly got bash *not* sh on your Linux, and that
behaves differently.  I think you will find that a closer sh clone (such as
ash) does show the error message.  That some Linux systems claim to have sh
and do not is a major compatibility problem in writing shell scripts and
Makefiles, as we keep finding.

BTW, Solaris will use ksh not sh for the shell if it needs to be POSIX
compatible. And ksh behaves like bash in this respect.


I believe that to define this portably we are going to have to do something
a lot more complicated than accept what the system() call gives us. Are you
volunteering, Martin?