Page MenuHomeFreeBSD

New keyword @rmempty
AbandonedPublic

Authored by bapt on Apr 30 2020, 7:18 AM.

Details

Reviewers
None
Group Reviewers
portmgr

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit 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.)