Project

General

Profile

Actions

Bug #1130

closed

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

Added by qhwt+dfly over 16 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Hello.

How it fails:
$ mkdir test test2
$ chflags nohistory test
$ chflags history test2 # to make sure test2 doesn't have nohistory
$ ln -s foo test/bar # this creates a symlink with nohistory set
$ cp -Rp test/bar test2
cp: chflags: test2/bar: Function not implemented

Why does that matter:
installation of postfix fails (I know makedefs barfs first, but that's
another story, and perhaps someone else's working on it). I have my
${WRKDIR} on a HAMMER PFS with nohistory flag set. On the other hand
${PREFIX} (=/usr/pkg) has no nohistory set on it. And ${WRKDIR} and
${PREFIX} are on different partitions. I don't think this is very odd
configuration, as you want your ${WRKDIR} on a big partition but don't
want to retain the history, while you want to keep your ${PREFIX} on
a UFS filesystem to be very conservative, or at least retain history.

There's the following code in postfix-install script, which is responsible
for the installation:

compare_or_symlink() {
:

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?

Actions

Also available in: Atom PDF