`cp -Rp symlink-with-nohistory' fails...

Matthew Dillon dillon at apollo.backplane.com
Wed Sep 3 08:41:48 PDT 2008


:	ln -s $link $tempdir/junk || exit 1
:	mv -f $tempdir/junk $2 || {
:
:$tempdir points to somewhere under ${WRKDIR}, so it has nohistory flag set,
:so symlinks get created with nohistory flag set, then mv'ed to
:${PREFIX}/*bin.  Since ${WRKDIR} and ${PREFIX}/*bin are in different
:partitions, mv internally invokes `cp -PRp' to perform the copy
:across partitions, then fails.
:Currently there are three workarounds for this problem(known to me):
:A) run `bmake install' twice, B) set nohistory flag on ${PREFIX}/*, or
:C) patch cp to special case the history flags rather than let it
:   unconditionally refuse to chflags() on a symlink.
:
:But: why does cp refuse to set file flags on a symlink in the first place?

    It isn't possible to set the flags on a symlink. There is no 
    lchflags() system call.  I think it would be fairly easy to add
    a lchflags() though any use of such a call would not be backwards
    compatible to older systems.

    A normal chflags() call on a symlink would try to dive the link, just
    like chmod() and chown() do.

    This brings up another issue with regards to 'nohistory', that being
    the problem of programs such as cp and mv trying to copy the flag
    and resulting in files being marked nohistory that you might not
    otherwise want marked nohistory.  It could very well be that the only
    solution is to add a PFS-wide nohistory flag and not use chflags for
    that purpose.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>





More information about the Bugs mailing list