lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Jan 22, 2020 9:56 PM Sean Conner wrote:

> It was thus said that the Great Jeff Pohlmeyer once stated:

> > Why call it "setwd" instead of the more conventional "chdir" ?

> To make it consistent with getwd().

I figured that, but I would still prefer chdir().


> If info() is called on a symlink, does it return info about the link
> itself, or the file the link points to?

> What happens when a system doesn't support it?

As POSIX suggests, "The lstat() function shall be equivalent to
stat(), except when path refers to a symbolic link."


> > If timestamp() is called on a nonexistent file, will it attempt create
> > the file? (a la "touch")

>  No.  The underlying POSIX call, utime(), does not create the file.

That's what I would expect. Just wanted to clarify.


> > It would also be nice to have a small subset of permission functions,
> > maybe just whether a file can be read, written, or created.

>   If you can't read a file, you can't read a file.  I know there are times
> when checking first is preferred, but just the act of trying to open a file
> will tell you what you need to know (and there's a race between time of
> check and time of use (TOCTOU).

That makes sense. It could get messy anyway since there are so many
levels of access control (File permissions, extended attributes,
read-only mounts/media, etc.)

 - Jeff