Does GAP's ReadLine and ReadAll have a problem on t2?

8 views
Skip to first unread message

Simon King

unread,
Sep 3, 2010, 6:21:56 PM9/3/10
to sage-solaris
Dear all,

I tried to use my group cohomology spkg on t2. It turned out that one
problem is that GAP has a problem to read the first line of a certain
file using the ReadLine command. ReadAll didn't work either.

Is that a known problem?

And is there a different GAP command that could give me the first line
of a file?

Best regards,
Simon

Dr. David Kirkby

unread,
Sep 3, 2010, 6:45:39 PM9/3/10
to sage-s...@googlegroups.com

I'm not aware of any problems. Is this an optional package? If so, can you let
me know the URL of it and I can take a look. What file is it?

Dave

Simon King

unread,
Sep 3, 2010, 7:32:58 PM9/3/10
to sage-solaris
Hi David,

On 4 Sep., 00:45, "Dr. David Kirkby" <david.kir...@onetel.net> wrote:
> I'm not aware of any problems. Is this an optional package? If so, can you let
> me know the URL of it and I can take a look. What file is it?

No, these are standard GAP commands. But currently I am a bit
confused: When I tried to call it from my package, there was an error
message mentioning "ReadLine". However, when I manually tried the
commands that (I thought) were given by my programs then everything
worked. In other words, I can not replicate it, yet.

So, I guess I have to catch some sleep and try again...

Best regards,
Simon

Simon King

unread,
Sep 3, 2010, 8:53:17 PM9/3/10
to sage-solaris
It seems that the problem is not ReadLine but Exec, or a wrong usage
of the shell.

Here is what happens.

There is a global variable exportMTXLIB in my GAP code. This is the
string
"export MTXLIB=/scratch/sking/sage-4.5.1-Solaris_10_SPARC-sun4u-
SunOS/local/pGroupCohomology/mtx_tables/; "

This string, together with the name of some executable using a
environment variable MTXLIB, is passed to GAP's Exec-command:
Exec(Concatenation(exportMTXLIB, "name_of_the_executable"));

This line in GAP fails with the message:
/bin/sh: MTXLIB=/scratch/sking/sage-4.5.1-Solaris_10_SPARC-sun4u-SunOS/
local/pGroupCohomology/mtx_tables/: is not an identifier

Now I am a bit puzzled. Why does shell execution of the string fail?
If I give that command directly in the shell, it works. And if I give
the same GAP command on sage.math, it works as well.

So, two questions:
1) Should the above export command work in t2 (as a shell command)?
2) Is there a problem with GAP's Exec-command on t2?

Best regards,
Simon

Simon King

unread,
Sep 3, 2010, 9:08:15 PM9/3/10
to sage-solaris
On 4 Sep., 02:53, Simon King <simon.k...@nuigalway.ie> wrote:
> It seems that the problem is not ReadLine but Exec, or a wrong usage
> of the shell.

I noticed that
Exec("export BLA=/home/SimonKing/; ");
fails. But
Exec("BLA=/home/SimonKing/; export BLA; ");
works.

So, probably this is what I need to do.

Cheers,
Simon

Dr. David Kirkby

unread,
Sep 4, 2010, 2:50:05 AM9/4/10
to sage-s...@googlegroups.com


Yes. Since you are using /bin/sh you need to do this. Depending on the
implementation, using the abbreviated form, will not work. Your solution is the
right one.

The Sun shell is not the only one that will fail either. It's a portability
issue in general to do this.

Dave

Reply all
Reply to author
Forward
0 new messages