* DEC-UNIX "system" does not work on Linux?
@ 1997-11-11 5:00 Warner Bruns
1997-11-12 5:00 ` Greg Lindahl
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Warner Bruns @ 1997-11-11 5:00 UTC (permalink / raw)
Dear Netters:
I am porting a finite difference code written in Fortran to an Alpha
running Linux. Since there is no good Fortran-compiler on this machine,
i compile on a DEC-UNIX machine and transfer the executable to DEC-Linux
(thanks to this newsgroup, i know how to do this).
Everything works fine, the program runs.... except:
The program wants to start another program with system("command")
This does not work.
Even the following little test-program, if compiled on a DEC-UNIX system
and transferred to the DEC-Linux does not work as expected:
#include <stdlib.h>
#include <stdio.h>
main(){
int ierr;
ierr= system("ls -l");
printf(" ierr: %d\n", ierr);
}
On the DEC-UNIX, i see the directory listing, ierr is 0.
On the DEC-Linux, i dont see the directory, ierr is 32512.
Does anybody out there know a work around for "system()", that can be compiled
on DEC-UNIX and executed on DEC-Linux?
If that helps:
According to the DEC-UNIX man pages, system makes a fork, the child process
then exec's "/bin/sh".
This "/bin/sh" on the target DEC-Linux is a link to "bash".
Thanks for any suggestions.
Warner Bruns
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC-UNIX "system" does not work on Linux?
1997-11-11 5:00 DEC-UNIX "system" does not work on Linux? Warner Bruns
@ 1997-11-12 5:00 ` Greg Lindahl
1997-11-12 5:00 ` Warner Bruns
1997-11-12 5:00 ` Warner Bruns
2 siblings, 0 replies; 4+ messages in thread
From: Greg Lindahl @ 1997-11-12 5:00 UTC (permalink / raw)
bruns@tetibm2.ee.TU-Berlin.DE (Warner Bruns) writes:
> Everything works fine, the program runs.... except:
> The program wants to start another program with system("command")
> This does not work.
I have not tried this. Here's how you debug it, though:
strace -f ./program_name
That shows you your system calls and results. The problem ought to be
visible...
-- g
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC-UNIX "system" does not work on Linux?
1997-11-11 5:00 DEC-UNIX "system" does not work on Linux? Warner Bruns
1997-11-12 5:00 ` Greg Lindahl
1997-11-12 5:00 ` Warner Bruns
@ 1997-11-12 5:00 ` Warner Bruns
2 siblings, 0 replies; 4+ messages in thread
From: Warner Bruns @ 1997-11-12 5:00 UTC (permalink / raw)
In article <64b8qe$rc7@news2.zippo.com>, lindahl@pbm.com (Greg Lindahl) writes:
> bruns@tetibm2.ee.TU-Berlin.DE (Warner Bruns) writes:
>
> > Everything works fine, the program runs.... except:
> > The program wants to start another program with system("command")
> > This does not work.
>
> I have not tried this. Here's how you debug it, though:
>
> strace -f ./program_name
>
> That shows you your system calls and results. The problem ought to be
> visible...
>
> -- g
That was a good advice:
The system call that the program wants to execute was:
system("double.gdfidl -noQ -noroQ .....")
In the output of "strace" I identify:
[pid 3188] access("/usr/bin/sh", X_OK) = -1 ENOENT (No such file or directory)
[pid 3188] execve("/sbin/sh", ["sh", "-c", "double.gdfidl -noQ
-noroQ"...], [/* 80 vars */]) = -1 ENOENT (No such file or directory)
On DEC-UNIX, the shells "/usr/bin/sh" and "/sbin/sh" both exist.
ON DEC-Linux, the shells both don't exist.
I will ask the system administrator to make a link
from "/sbin/sh" to the Linux default shell.
I will post the outcome.
Warner Bruns
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC-UNIX "system" does not work on Linux?
1997-11-11 5:00 DEC-UNIX "system" does not work on Linux? Warner Bruns
1997-11-12 5:00 ` Greg Lindahl
@ 1997-11-12 5:00 ` Warner Bruns
1997-11-12 5:00 ` Warner Bruns
2 siblings, 0 replies; 4+ messages in thread
From: Warner Bruns @ 1997-11-12 5:00 UTC (permalink / raw)
In article <64c99q$9tf$1@news.cs.tu-berlin.de>,
bruns@tetibm2.ee.TU-Berlin.DE (Warner Bruns) writes:
> In article <64b8qe$rc7@news2.zippo.com>, lindahl@pbm.com (Greg
Lindahl) writes:
> > bruns@tetibm2.ee.TU-Berlin.DE (Warner Bruns) writes:
> >
> > > Everything works fine, the program runs.... except:
> > > The program wants to start another program with system("command")
> > > This does not work.
> >
> > I have not tried this. Here's how you debug it, though:
> >
> > strace -f ./program_name
> >
> > That shows you your system calls and results. The problem ought to be
> > visible...
> >
> > -- g
>
> That was a good advice:
> The system call that the program wants to execute was:
> system("double.gdfidl -noQ -noroQ .....")
>
> In the output of "strace" I identify:
>
> [pid 3188] access("/usr/bin/sh", X_OK) = -1 ENOENT (No such file or
directory)
> [pid 3188] execve("/sbin/sh", ["sh", "-c", "double.gdfidl -noQ
> -noroQ"...], [/* 80 vars */]) = -1 ENOENT (No such file or directory)
>
> On DEC-UNIX, the shells "/usr/bin/sh" and "/sbin/sh" both exist.
> ON DEC-Linux, the shells both don't exist.
>
> I will ask the system administrator to make a link
> from "/sbin/sh" to the Linux default shell.
>
> I will post the outcome.
>
> Warner Bruns
I did not ask the sysadmin to make a link, but edited the executable
with a hex-editor. I replaced "/sbin/sh" with "/bin/sh" (zero appended).
Now the program runs.
Thanks a lot
Warner Bruns
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1997-11-12 5:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-11-11 5:00 DEC-UNIX "system" does not work on Linux? Warner Bruns
1997-11-12 5:00 ` Greg Lindahl
1997-11-12 5:00 ` Warner Bruns
1997-11-12 5:00 ` Warner Bruns
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox