[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[issue #2723] 'diff' output, and handling chdir() in multi-threaded applications

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-03-02 23:51:36 CET

http://subversion.tigris.org/issues/show_bug.cgi?id=2723

When our 'diff' implementation operates on WC paths, it references the
files being diff'ed using relative paths when it's provided with a
relative path to the file, and absolute paths when it's provided with
an absolute path (regardless of the path's relation to the CWD).
Examples:

  Index: foo.c

...vs:

  Index: /path/to/foo.c

I'd like to be able to provide some control over the appearance of the
paths used in the diff output to Subclipse and other consumers of our
client APIs. Currently, the only way I can see to provide this
control for relative paths is to chdir() to the appropriate directory
before running 'diff'. (I have a patch implementing this which works
fine.)

However, I'm unclear on the impact of this type of chdir() in a
(single process) multi-threaded application. Will each thread get its
own working directory, or will that chdir() impact the CWD for all
threads (thus creating a race condition)? The man page for chdir()
implies that the CWD is per-process, I think meaning that it'd be up
to the threading model in use (e.g. is each thread a light-weight
process?). Especially for a Java virtual machine, I don't really want
to rely on the threading model...

If use of chdir() is unsafe for multi-threaded applications, would
anyone mind if I added an API to allow control over the file
references in Subversion's 'diff' output? If not, how should this new
API inter-op with URLs?

Thanks, Dan

  • application/pgp-signature attachment: stored
Received on Fri Mar 2 23:56:04 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.