Page MenuHomeFreeBSD

New keyword @rmempty
AbandonedPublic

Authored by bapt on Apr 30 2020, 7:18 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 4, 8:47 AM
Unknown Object (File)
Dec 20 2023, 7:49 AM
Unknown Object (File)
Nov 18 2023, 3:59 PM
Unknown Object (File)
Nov 18 2023, 3:58 PM
Unknown Object (File)
Nov 18 2023, 2:47 PM
Unknown Object (File)
Oct 29 2023, 12:02 PM
Unknown Object (File)
Sep 5 2023, 10:54 PM
Unknown Object (File)
Jul 28 2023, 11:35 PM
Subscribers

Details

Reviewers
None
Group Reviewers
portmgr

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 30806
Build 28529: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Apr 30 2020, 7:18 AM

isn't there a stat thing that you can use without having to open the file?

What happens if file is not a regular file, like a symlink?

In D24630#542146, @mat wrote:

isn't there a stat thing that you can use without having to open the file?

so far there is no stat, but I will add one in the futur to simplify that one. Actually there is the lfs lua package which I plan to import, but for capsicumisation I have to modify some function first. So in the meantime it does the trick.

In D24630#542147, @mat wrote:

What happens if file is not a regular file, like a symlink?

The function os.remove is equivalent of remove(3) and behave the same, so it removes the symlink: https://github.com/freebsd/pkg/blob/master/libpkg/lua_scripts.c#L166

Basically the behaviour is the same as [ -s ... ] && rm -f

In D24630#542149, @bapt wrote:
In D24630#542147, @mat wrote:

What happens if file is not a regular file, like a symlink?

The function os.remove is equivalent of remove(3) and behave the same, so it removes the symlink: https://github.com/freebsd/pkg/blob/master/libpkg/lua_scripts.c#L166

Basically the behaviour is the same as [ -s ... ] && rm -f

Wouldn't it be interesting to have this only work on a regular file, it does not make much sense if it was tried on a symlink.

(Maybe I am trying to hard to find stupid things people will do.)