[comp.unix.sysv386] Problems with getwd

sralston@srwic.uucp (Steve Ralston) (11/29/90)

I seem to have stumbled across a problem while running some RCS programs
(Revision Control System) on a system running UNIX V.4.2 OS.  The system
is a NCR PC486/Microchannel 33 MHz running a BETA version of NCR UNIX
System V, Release 4 Version 2, if that info is applicable.  These are RCS
binaries compiled on a SCO ODT system, which would have been my first guess
as root cause of the problem.

The strange thing is that all worked fine UNTIL I reinstalled the OS using
a (faster?) UFS root file system, instead of the s5 (S51K) root file system
which I had been using.  The error returned by the RCS `ci` (check-in)
program looks something like:

	ci error: can't build current directory path
	ci aborted
	ci error: can't find semaphore file RCS/,<name>,

Looking thru the RCS source code, the fatality appears to hinge on the
following snippet of C code in ci.c:

                    if (getwd(pathbuf)==NULL)
                        faterror("Can't build current directory path");

So it appears that the call to getwd() works for a S51K file system, but
does NOT work (returns NULL) for a UFS file system.  Ideas, anyone?
--
Steve Ralston						sralston@srwic.UUCP
235 N Zelta						voice: 316-686-2019
Wichita, KS 67206			..!uunet!ncrlnk!ncrwic!srwic!sralston

andyc@bucky.intel.com (Andy Crump) (12/04/90)

>>>>> On 29 Nov 90 06:58:40 GMT, sralston@srwic.uucp (Steve Ralston) said:

Steve> Looking thru the RCS source code, the fatality appears to hinge on the
Steve> following snippet of C code in ci.c:

Steve>                     if (getwd(pathbuf)==NULL)
Steve>                         faterror("Can't build current directory path");

Steve> So it appears that the call to getwd() works for a S51K file system, but
Steve> does NOT work (returns NULL) for a UFS file system.  Ideas, anyone?


Yep, you're right.  It's a bug in version 2 of SVR4.  It is being
addressed in version 3. The problem is the getwd() in
/usr/ucblib/libucb.a uses the S5 filesystem data structures rathern
than the UFS ones.  There are 2 versions of opendir/readdir, one in
libc and the other in libucb.  The return slightly different
structures.  You should be able to work around the problem if you
recompile not using /usr/ucbinclude and /usr/ucblib/libucb.a.  Using
the standard System V libraries and not the compatibility stuff should
keep you out of trouble for now.

--

    -- Andy Crump

    ...!tektronix!reed!littlei!andyc | andyc@littlei.intel.com
    ...!uunet!littlei!andyc          | andyc@littlei.uu.net

Disclaimer: Any opinions expressed here are my own and 
            not representive of Intel Corportation.