Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 May 2001 13:02:01 +0100
From:      "Koster, K.J." <K.J.Koster@kpn.com>
To:        'Alfred Perlstein' <bright@rush.net>
Cc:        'FreeBSD Hackers mailing list' <freebsd-hackers@freebsd.org>
Subject:   RE: Linux getcwd problems
Message-ID:  <59063B5B4D98D311BC0D0001FA7E452205FD9C04@l04.research.kpn.com>

next in thread | raw e-mail | index | archive | help
Dear Alfred,

>
> >   http://www.freebsd.org/cgi/query-pr.cgi?pr=3D24315
> >=20
> > The summary is that getcwd(3) under Linux emulation will fail =
really
> > hard after a rmdir.
> >=20
> I've looked at your email and the PR, the problem that I have is that
> I have no clue as to what it should return.  Can you give a =
suggestion
> and possibly site a refernece?  Basically, WWLD (what would linux =
do)?
>=20
Umm. I'm confused. WLWD is give me a useful value for cwd, given that =
my cwd
actually exists.

What I see is this:

% touch build.xml
% mkdir gen
% rmdir gen
% ant
Buildfile: build.xml
=20
BUILD FAILED

java.io.FileNotFoundException: i=C9/build.xml (No such file or =
directory)
                               ^^- note this

It looks like that after a directory was removed from the cwd, the =
Linux
getcwd command returns garbage. The JDK uses getcwd routinely, to set =
the
user.dir (or some such) property. Ant uses that property to determine =
what
file to open, i.e. it opens (in a mix of C, Java and pseudocode):

  new FileInputStream(linux_getcwd() + "/build.xml")

Since getcwd() returns garbage after a directory was deleted from the =
cwd,
the above fails with the exception mentioned earlier.

I think it is safe to assume that on a Linux system, getcwd() returns
meaningful information every time, under normal circumstances. :-)

This is about as clear as I can describe the problem. Hope this helps.

>
> Instead of asking why a piece of software is using "1970s =
technology,"
> start asking why software is ignoring 30 years of accumulated wisdom.
>
Because today I know better. [Ghandi] :-)

    Kees Jan

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

 You are only young once,
       but you can stay immature all your life.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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