darshan_atha has asked for the wisdom of the Perl Monks concerning the following question:

hi monks, I have written a perl script which run the perl script on some other server with system(ssh -1 host command) option but the problem is that that script works fine when run from command line and the same script is run from the html interface doest run the remote server script and i printed the return value of system function it gives 65280.
anybody can through some light on that,
thanx in advance.

Replies are listed 'Best First'.
Re: system command problem
by grantm (Parson) on Dec 02, 2002 at 07:16 UTC
    I'm looking into my crystal ball ... the clouds are clearing ... is that some sample code I see? ... no it's gone ... can I see the output of STDERR in the web server log file? ... no the clouds are coming back ... I sense an identity ... it's coming clearer now ... it's an identity crisis! ... yes I can see it all ... the user identity the script is running under is not the same one that the command line test is being run from ... I sense confusion again ... the clouds are closing in ...
Re: system command problem
by Zaxo (Archbishop) on Dec 02, 2002 at 07:21 UTC

    Let's decode the return value:
    perl -e'print 65288 >> 8, $/' prints 255, or as hotshot said, -1 which is usually a nonspecific error return.
    perl -e'print 65288 & 128, $/' prints 0, so core was not dumped.
    perl -e'print 65288 & 127, $/' prints 8, so the system call was ended with a signal. Signal 8 on my system is an FPU exception, unsurprising in an encryption program.

    Update: Oops. Misread the return, 65280 & 127 is 0, no signal involved.

    After Compline,
    Zaxo

Re: system command problem
by hotshot (Prior) on Dec 02, 2002 at 07:01 UTC
    The exit status of system() should be devided by 256. dividing 65280 by 256 gives 255 which I think it's -1, so you should check what that means, besides, you should post some more code so we can help you more.

    Hotshot
Re: system command problem
by ibanix (Hermit) on Dec 02, 2002 at 06:30 UTC
    More information needed. Your question is written badly.

    #1: What's the script do?
    #2: Can we get some code with that?
    #3: You're doing a system("ssh -l $host $command")? Does the ssh -l $host $command work outside the script?
    #4: What version of perl, and is it on Unix or Win32?
    #5: What SSH? OpenSSH? Commercial? v1 or v2?
    #6: What's the HTML interface, what's the code for it and how does it relate?
    #7: Are you trying to use one script to call another script via ssh?
    #8: Can you an exact error message? "65280" is kinda vague.


    <-> In general, we find that those who disparage a given operating system, language, or philosophy have never had to use it in practice. <->
Re: system command problem
by bluto (Curate) on Dec 02, 2002 at 13:55 UTC
    One thing to try -- use ssh's -v flag to get verbose output. Of course you'll have to capture the output...

    bluto