On Fri, Feb 7, 2020 at 10:47 AM Lassi Kortela <xxxxxx@lassi.io> wrote:

So defining filesystem access procedures that are sensitive to the per process CWD makes it impossible to use those procedures effectively in a multithreaded Scheme system.

Well, only if you insist on different threads having different working directories.  In practice, I think the usual thing is either not to change the cwd at all, or to change it once and for all when the program starts up.
> The fundamental question is "what is SRFI 170 trying to achieve"? If the answer is "an interface to posix functions such as chdir, open, etc" then that is fine, but it shouldn't presume that there is a link between the posix open and the Scheme open-input-file, the posix relative paths and the Scheme relative paths, etc

The RnRS standards don't specify how the arguments to open-*-file are mapped to the kernel's interpretation of native paths, so something like this is up to the implementation.  However, the <https://bitbucket.org/cowan/r7rs-wg1-infra/src/default/PathnamesPython.md> pre-SRFI specifies a fully portable method of manipulating Posix and/or Windows pathnames.  It was easy enough to add a current-basepath parameter to use when joining paths.   I suppose a convenience path-join* procedure that uses (current-basepath) could be added, but (path-join (current-basepath) path) is easy enough.  Note that unlike in Python itself, the path objects are lists of strings rather than opaque records.

> Anyway, in Gambit there is (path-normalize path) that can be called to turn the (possibly relative) path into an absolute path (using the current-directory parameter object if the path is relative), and the absolute path can be passed to the posix open in order to avoid being dependent on the process CWD.

That's a special case of path-join.  Path-normalize means something else: it removes ".." components.

John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
I should say generally that that marriage was best auspiced, for the
achievement of happiness, which contemplated a relation between a man and a
woman in which the independence was equal, the dependence mutual, and the
obligations reciprocal.  --Louis Anspacher (1944)