Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Oct 1997 18:07:49 -0700 (PDT)
From:      mika@cs.caltech.edu
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   bin/4700: /usr/bin/rdist handles hard links incorrectly when rdisting from a different directory
Message-ID:  <199710060107.SAA21699@hub.freebsd.org>
Resent-Message-ID: <199710060110.SAA21896@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4700
>Category:       bin
>Synopsis:       /usr/bin/rdist handles hard links incorrectly when rdisting from a different directory
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct  5 18:10:01 PDT 1997
>Last-Modified:
>Originator:     Mika Nystrom
>Organization:
California Institute of Technology, Department of Computer Science
>Release:        FreeBSD-CURRENT 3.0, at most a few days old
>Environment:
FreeBSD obelix.cs.caltech.edu 3.0-CURRENT FreeBSD 3.0-CURRENT #0: Wed Oct  1 20:09:28 PDT 1997     mika@obelix.cs.caltech.edu:/usr/src/sys/compile/P6SERVER_2CPU_256MB  i386

>Description:
If a directory that is being rdisted contains links (hard or symbolic),
rdist translates the source of the link (as it would any file) using
the "install" keyworkd in the Distfile.  However, it leaves the link
target the same as on the server system.  For symbolic links, this
is arguably the Right Thing To Do, but it is clearly Wrong for hard 
links.  This breaks:

/usr/cit_install/root/bin -> ${TEMPCLIENTS}
        install /bin;

(We want the flexibility of running different releases on the server
and clients.)

We need to use:

/bin -> ${TEMPCLIENTS}
        install /bin;

which is non-optimal.

>How-To-Repeat:
Should be obvious from the description.
>Fix:
The fix we are using is to make sure the absolute pathnames are the
same on server and client.  

A better fix would be to fix rdist; I don't know the structure
of the code well enough to say exactly how, but I can point to 
where the problem is:

It involves (I think) /usr/src/usr.bin/rdist/server.c:

     34 #ifndef lint
     35 static char sccsid[] = "@(#)server.c    8.1 (Berkeley) 6/9/93";
     36 #endif /* not lint */

    451         if (stb.st_nlink > 1) {
    452                 struct linkbuf *lp;
    453 
    454                 if ((lp = savelink(&stb)) != NULL) {
    455                         /* install link */
    456                         if (*lp->target == 0)
    457                         (void) snprintf(buf, sizeof(buf), "k%o %s %s\n",
 opts,
    458                                 lp->pathname, rname);
    459                         else
    460                         (void) snprintf(buf, sizeof(buf), "k%o %s/%s %s\
n",
    461                             opts, lp->target, lp->pathname, rname);
    462                         if (debug)
    463                                 printf("buf = %s", buf);
    464                         (void) write(rem, buf, strlen(buf));
    465                         (void) response();
    466                         return;
    467                 }
    468         }

(The "k" command causes the server to execute hardlink() on the
arguments.)

The arguments need to be fixed so that both are translated in accordance
with the rules used to translate pathnames of files.

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710060107.SAA21699>