> From: Lassi Kortela <xxxxxx@lassi.io> > Date: Wednesday, April 29, 2020 8:25 AM > >> I'm not sure about changing working-directory to >> current-directory, the underlying POSIX procedure wide call getcwd >> uses both.... Using both could be better, but if not that, I'd prefer >> keeping working-directory. > > My argument is that all the other process/thread state stuff is called > "current". The working directory is the only one that is called a > "working" anything. (Does this imply everything else is "lazy"? :) > > Current-working would be two words for the same thing. "Working" in Unix > doesn't refer to any other concept and is just a synonym for "current" > AFAIK. The only other thing I can think of is "working set" and that's > about CPU caches IIRC. The working set can also refer to the set of pages that need to be kept in main memory, or in the bad old days you'd thrash your hard disk(s), for UNIX your swap partition(s). Back when memory was dear, drawing horizontal lines at the bottom of your screen to signal if your process was running, paging, or for Lisp Machines, GCing was comforting and/or annoying feedback. I agree with dropping "working" from the SFRI. > From: Lassi Kortela <xxxxxx@lassi.io> > Date: Wednesday, April 29, 2020 9:12 AM > >> 1) Controlling the posix working directory and umask (that apply to the OS process) >> 2) The mapping of these concepts to Scheme threads >> >> So for the first there could be the procedures >> >> (posix-current-directory [ <dir> ]) that calls getcwd() or chdir() >> (posix-current-file-permission-mask [ <mask> ]) that calls umask() >> >> And for the second there could be the SRFI 39 parameters >> >> (current-directory [ <dir> ]) that reads or assigns the parameter >> (current-file-permission-mask [ <mask> ]) that reads or assigns the parameter > > I like the symmetry. As do I, and I thank Mr. Feeley for making this crystal clear, and agree with his point about current-file-permission-mask being both clear, and not onerous since it's not used very often. > Perhaps `posix-` should be `os-` since the current directory works using > Windows API as well and there's nothing intrinsically POSIX specific > about it. For the umask, there's a stronger case for `posix-`. The vaguer the name, the more likely it can fit into situations we haven't thought of, or maybe someday new systems. So "os-" beats "posix-", unless something is uniquely POSIX. Which John just reminded us does not include umasks for Windows, thanks to MS-DOS' r/w permission bit. Still, I continue to quibble about removing the "set-" uniformity of the API. Am I correct in understanding the motivation to do this is a Scheme implementation performance hack of using parameter objects...?? Another option is removing "set-" as much as possible from the API, but there's no obvious way to do that for set-file-mode/-owner/-group, because you *get* those values using a single call to file-info, which calls POSIX stat and returns a record mirroring stat's struct. > If `current-file-permission-mask` is designed with the option of being > portable to non-Unix platforms, then `<mask>` should probably be an > opaque object instead of an integer. That may be too fancy... perhaps we > should simply specify that it has OS-dependent meaning, and on POSIX > systems, an exact integer must be treated as a umask. Making it OS-dependent is the best, and it sounds like the restriction you're advocating for exact integers is fairly safe and future proof. The original UNIX permission mask is *not* a model to emulate, unless you're directly copying it for backwards compatibility. >> Where current-directory would be initialized to >> (posix-current-directory) and current-file-permission-mask would be >> initialized to 0. > > The OS kernel inescapably applies the process umask on top of the Scheme > per-thread umask. I don't think the process umask can be overridden (in > the way that the process working directory can be overridden by using an > absolute pathname instead of a relative one). It can be changed, including "widened" to be less restrictive, but not as trivially as supplying an absolute instead of relative pathname arg. > How do we communicate to users of SRFI 170 that the process umask is the > law and the per-thread umask is just something extra? The Scheme > implementation could zero out the process umask at the start, but it > doesn't help that much since users can change it back at any time... Not the law if the thread changes the per process umask, rather, a hierarchy. We could "make it the law" as I previously proposed by not letting it be widened, or maybe that would be better put in a security SRFI, to possibly include things like OpenBSD's pledge, as in "I pledge not to do X, Y, and Z in the future". > Initializing the Scheme umask to 0 as you suggest would make it so that > only the process umask is in effect by default. That seems reasonable. That works, but makes accidents more likely in the per thread code. > [...] - Harold