Gonzalo Tornaria wrote:
> On Sat, Nov 7, 2009 at 6:48 AM, Dr. David Kirkby
> <david.kir...@onetel.net> wrote:
>> "cp -L$OPT devel/sage-main "$TMP"/devel/sage-main"
> 
> Maybe this is done to handle the case where "sage-main" is a symlink
> to an actual directory. The option -L means to copy symlinks as real
> files. Otherwise, the symlink may be copied (when using -a, at least
> --- unspecified by posix when using -Rp).
> 
> As a matter of fact, using "cp -Lra" does NOT work as claimed above,
> because the -a option implies -P which overrides the -L option. Using
> "cp -raL" would copy symlinks, though.
> 
> The actual meaning of "-a" in gnu cp is really "-dRp", not just "-Rp".
> The "-d" option should be replaced with "-P" posix option (preserve
> symlinks), except the "-d" also preserves hard links. I don't think
> posix has an option to preserve hard links.
> 
> For the line with -L, if the only motivation is to follow the symlink
> in case sage-main itself is a symlink, the correct option is -H rather
> than -L, but it may be possible to use (instead of -H or -L):
> 
>     cp -$OPT devel/sage-main/ "$TMP"/devel/sage-main"
> 
> the extra "/" at the end of the source operand makes it to expand the
> symlink, if any.
> 
> Maybe somebody (wstein?) can comment on why the -L was added to the script?


That would be very useful if William commented here.

> ----
> 
> WRT -d option (preserve symlinks + hardlinks). It's clearly necessary
> to preserve symbolic links. For instance, dynamic libraries use
> symlinks.
> 
> Is it really necessary for sage-bdist to preserve hardlinks?
> 
> [ ... checking a bdist tarball of 4.1.1 ... ]
> 
> there is exactly one hardlink in this bdist tarball:
> "local/bin/python" is a hardlink to "local/bin/python2.6".
> 
> IOW, using -P instead of -d would produce a tarball with two copies of
> the python binary. Shouldn't this be handled with a symbolic link
> instead?

I would have thought so too. But I'm puzzled, as python-2.6.2.p4/spkg-install 
creates a symbolic link. It has the line:

ln -s python2.6 python


I see that local/bin/python and local/bin/python2.6 are hard links, as they 
have 
the same inode.


drkir...@kestrel:~/sage-4.2/local/bin$ ls -i python
       8980 python
drkir...@kestrel:~/sage-4.2/local/bin$ ls -i python2.6
       8980 python2.6

But how did you find out these two were hard links? I'm not aware of any way to 
find if A is a hard link of B, unless one finds the inodes and compares them, 
which would be next to impossible where there are a lot of files. I assume 
there 
is some way you do this.

> -------------------------------------
> 
> My suggestion would be:
> 
> a. fix installation of python so that a symlink is used instead of a hard link

Do you know where this bit of code is? As I say, from what I can see, the link 
should be created as a symbolic link, not a hard link.

> b. use -PRp as options for cp (this is posix!)
> c. for the sage-main directory, use the trailing / trick so the -L /
> -H option is not necessary (double check this with whoever wrote the
> sage-bdist script to use -L option)
> d. for systems where -P is not supported, figure out a way to copy
> preserving symlinks.
> 
> [a. is not critical, but as long as it's not done, sage-bdist should
> keep using -a or -d on gnu systems, to avoid bloat in the bdist
> tarfile]

Though the bloat will already exist on OS X, as OS X uses -pR, and no -a.

> Gonzalo
> PS: I've attached a shell script which exhibits the different
> behaviours of cp with different options. You can try something like
> that in HP-UX to see if there is a way to preserve symbolic links in a
> copy.

You have a far better understanding of this than me. If I gave you an account 
on 
the HP-UX box, could you try this out? (If so, let me know a username). But do 
not waste much time over it. Clearly the use of this non-POSIX option '-a' 
needs 
to be removed asap, as it stops a binary being created on Solaris. I'm 
reluctant 
to put tests in the script to handle Solaris differently to linux, when POSIX 
options should be suitable for either. If its possible to do something which 
works on all platforms (HP-UX etc), so much the better. But that is hardly that 
important.


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to