Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GNUism in $SAGE_ROOT/spkg/install #7188

Closed
sagetrac-drkirkby mannequin opened this issue Oct 11, 2009 · 10 comments
Closed

GNUism in $SAGE_ROOT/spkg/install #7188

sagetrac-drkirkby mannequin opened this issue Oct 11, 2009 · 10 comments

Comments

@sagetrac-drkirkby
Copy link
Mannequin

sagetrac-drkirkby mannequin commented Oct 11, 2009

Once one runs make it runs the script $SAGE_ROOT/spkg/install.

Unfortunately, the very first command in there, the result of ticket #6744 has a GNUism.

 echo `date -u "+%s"` > .BUILDSTART

The '%s is not part of the current POSIX standard and fails to work on both the latest version of Solaris (which is a supported operating system), and with HP-UX 11i, which is not supported
by Sage, but I think we should try to build Sage in such a way
that is should run on any decent operating system.

There are at least two ways around this issue of find the number of seconds since 1//1/1970:

http://shell.cfajohnson.com/cus-faq.html#Q6

One requires 'perl' (which is not tested for at this point), the other relies on 'awk' being POSIX complaint, which we can't assume, but is probably the safer of the two assumptions. A third way would be a way to make it work with any 'date' command using some maths with 'bc' but that looks like a lot of work, for little gain.

# The method below looks a bit odd, as one uses a
# random number generator to get the time! However,
# it will work with any 'awk' supporting the
# POSIX spec for srand().

# David Kirkby has tested this on the following operating systems.
# AIX, HP-UX, Linux, OS X and Solaris. (versions as available).

# The trick is to first seed the srand random number generator
# generator with the default value (which is the number
# of seconds since 1/1/1970) then call srand() again, to give the
# first random number, which will be the seed. Neat I think!

# See  http://shell.cfajohnson.com/cus-faq.html#Q6

if [ `uname` = "SunOS" ] ; then
  # The standard awk in Solaris is not POSIX complaint, and so will not be
  # acceptable. But Sun ship a POSIX complient version at nawk (new awk)
  nawk 'BEGIN {srand(); printf("%d\n", srand())}' > .BUILDSTART
else
  awk 'BEGIN {srand(); printf("%d\n", srand())}' > .BUILDSTART
fi

The updated install script, can be found at

http://sage.math.washington.edu/home/kirkby/Solaris-fixes/top-level-install-script/

I've tested this on

  • AIX 6.1, compliments of http://www.metamodul.com/10.html
  • HP-UX 11i (my own HP C3600)
  • Linux (sage.math)
  • Solaris 10 update 7 SPARC (t2.math)
  • OpenSolaris 2008.11 (disk.math)
  • OS X (bsd.math)

According to #6744 this needs to be manually integrated into Sage. Note I stuck a readme file in the directory highlighting the fact this needs to have execute permissions too.

Dave

CC: @embray @jdemeyer @kiwifb

Component: porting

Keywords: GNUism AIX HP-UX Solaris

Author: Frédéric Chapoton

Branch/Commit: c04ba36

Reviewer: François Bissey

Issue created by migration from https://trac.sagemath.org/ticket/7188

@sagetrac-drkirkby sagetrac-drkirkby mannequin added this to the sage-5.11 milestone Oct 11, 2009
@sagetrac-drkirkby
Copy link
Mannequin Author

sagetrac-drkirkby mannequin commented Oct 11, 2009

comment:2

I just added a new comment to the file

# We would like to thank http://www.metamodul.com/ for free
# access to the the IBM machine running AIX 6.1

That site is providing the AIX machine which allowed me to test the patch under AIX, which I would not otherwise had been able to do so easily, even though I have an old RS6000 in my garage.

@williamstein
Copy link
Contributor

comment:3

Just for the record this BUILDSTART thing was added to Sage very recently by Harald Schilly, evidently in trac #6744, and it is completely ignored at present, and used absolutely nowhere else in Sage.

@sagetrac-drkirkby
Copy link
Mannequin Author

sagetrac-drkirkby mannequin commented Oct 17, 2009

comment:4

I understand this will not work on OpenBSD, which though not supported, I am aware of a method now which should work on any OS. Apparently POSIX states the random number generator must be seeded from the time, but does not state in which way. Most OS's uses seconds since the epoch, but OpenBSD does not. A more portable solution has been posted, which should work for any OS.

I believe this issue should be resolved. If nothing else, it does not look very good to be generating unnecessary error messages on some platforms. (Solaris and AIX).

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@fchapoton
Copy link
Contributor

Changed author from David Kirkby to Frédéric Chapoton

@fchapoton
Copy link
Contributor

comment:9

here is a branch that just get rid of the unused BUILDSTART file


New commits:

c04ba36remove unused BUILDSTART

@fchapoton
Copy link
Contributor

Commit: c04ba36

@fchapoton
Copy link
Contributor

Branch: u/chapoton/7188

@kiwifb
Copy link
Member

kiwifb commented Dec 17, 2018

Reviewer: François Bissey

@kiwifb
Copy link
Member

kiwifb commented Dec 17, 2018

comment:11

Looks good to me.

@vbraun
Copy link
Member

vbraun commented Dec 23, 2018

Changed branch from u/chapoton/7188 to c04ba36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants