Page MenuHomeFreeBSD

net/vnstat: Update to 1.17
AbandonedPublic

Authored by diizzy on Feb 11 2018, 12:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 23 2024, 11:17 PM
Unknown Object (File)
Apr 16 2024, 2:43 PM
Unknown Object (File)
Apr 11 2024, 6:28 PM
Unknown Object (File)
Apr 10 2024, 3:39 PM
Unknown Object (File)
Feb 21 2024, 5:24 PM
Unknown Object (File)
Feb 13 2024, 11:59 AM
Unknown Object (File)
Feb 8 2024, 4:32 PM
Unknown Object (File)
Feb 2 2024, 3:55 PM
Subscribers

Details

Reviewers
feld
Summary

Update vnstat to 1.17
Drop individual directories for pid and log file
Don't pass path to pid file twice (cmd argument and config file)

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dor added inline comments.
vnstat/Makefile
56

Creation of this directory is handled in the startprecmd. I'm guessing it was handled there as the user might change it and then you'd end up with a random empty directory hanging around.

vnstat/files/vnstat.in
64–65

Looks like this might chown the /var/run directory. I don't think this is what you actually wanted.
I'm guessing you'd want something like the following to create a writable file for the pidfile:

if [ ! -e ${vnstat_pidfile} ]; then
    install -o ${vnstat_user} -g ${vnstat_group} /dev/null ${vnstat_pidfile};
fi
vnstat/files/vnstat.in
64–65

Yes, in its current state it's incorrect and not what I intended. Having a look at it again, since we're using directory root do we even need to use install at all for the pid file? Can't we just remove at altogether?

vnstat/files/vnstat.in
64–65

/var/run won't be writable by $vnstat_user, so you have to do something to put a writable file in place. Using install seems to be a common pattern for doing that.

vnstat/files/vnstat.in
64–65

Indeed but vnstat doesn't set up that before switching to its own user?

vnstat/files/vnstat.in
64–65

The $vnstat_user is used by rc.subr(8) (check run_rc_command function and man page) to start the daemon as the specified user, so I don't believe that vnstatd will be starting as root and dropping to $vnstat_user, it will just be run as $vnstat_user immediately (via su(1)), and be unable to write out its PID unless a suitable file is already present.

vnstat/files/vnstat.in
64–65

Well, that doesn't really work to answer my own question.
What you suggested seems to be the best way of handling it.

diizzy edited the summary of this revision. (Show Details)

Drop individual directories for pid and log file, thanks David O'Rourke for suggestions and reviewing.

Remove directory dir in Makefile as it's handled by the in the startprecmd

vnstat/Makefile
43–44
do-install-GUI-on:
55–56

remove echo.

56–58

Remove @ from here.

vnstat/Makefile
43–44

To be clear replace the if statement with do-install-GUI-on: ?

55–56

Remove the line completely or what do you mean?
The handbook lists ECHO_MSG examples so I'm not sure what you're trying to point out.
https://www.freebsd.org/doc/en/books/porters-handbook/makefile-masterdir.html (for instance)

As a side note, you may want to pass the rc file through devel/rclint to make sure it conforms to our coding style. (and through devel/hs-ShellCheck to make sure there are no lingering bugs.)

vnstat/Makefile
43–44

yes.

55–56

I mean remove the ECHO_MSG, almost nobody builds ports manually nowadays, I've been meaning to go trough the tree and remove those.
I'll look at the handbook and clean things up.

Fix issues pointed out by mat@

rclint output: ERROR:root:[0]: No description included
shellcheck doesn't output any errors except "Double quote to prevent globbing and word splitting." which seems harmless

diizzy marked 13 inline comments as done.Mar 6 2018, 1:03 PM
vnstat/Makefile
36

Why +=?

38–41

Remove.

More fixes that mat@ pointed out

vnstat/Makefile
39–41

There is no need for all those \/ here, using / would be enough. Also, it would be better to do it all in one command, no need to run sed three times on the same file.

vnstat/Makefile
39–41

I'm not very skilled at regexps so if you have a better way please provide one.

vnstat/Makefile
39–41

Like I said, replace all the \/ with /. Then make it only one sed command, not three something like this:

${REINPLACE_CMD} -e "foo" \
                 -e "bar" \
                 the/file

Superseded by commit r485333