Re: [Dnsmasq-discuss] code style, decision

2019-09-12 Thread Kristoffel Pirard
My 5 cents:

1. It saved my team a lot of discussion when we enforced a code formatter
(e.g. clang-format).
2. 5 levels of indentation is way deeper than most humans can have in their
heads simultaneously - functions are a great tool to alleviate this.


On Thu, Sep 12, 2019 at 10:36 AM Dominik  wrote:

> If we change anything at all, we should not solely use tabspace.
>
> Imagine only when we're at level 5 in the code, this works mean 5*8=40
> (useless) indentation space before the actual code starts. This makes the
> code rather unreadable when editing with CLI tools like vim where there is
> typically less displaying slave available than in fancy IDE applications.
> Note that many editors jump back to the very beginning when there is an
> empty line.
>
> If at all, I'd vote for converting the existing tabstops to 8 spaces and
> keep the indentation step of 2 spaces per level.
>
> Best,
> Dominik
>
> >On Wed, Sep 11, 2019 at 03:09:31PM -0700, Shota Hino wrote:
> >> On Wed, Sep 11, 2019 at 2:49 PM Simon Kelley wrote:
> >> > On 11/09/2019 22:12, Shota Hino wrote:
> >> > > On Wed, Sep 11, 2019 at 2:05 PM Simon Kelley wrote:
> >> > > > On 07/09/2019 18:21, john doe wrote:
> >> > > > >   some earlier postings:
> >> > > > > >   
> >> > > > >
> >> > > > > I agree, consistent code is best, clear guideline could be
> >> > > > > usefull for new code.
> >> > > > >
> >> > > > > Simon Kelley, the belligerent dictator of the Dnsmasq project
> >> > > > > will need to way in on such changes though.
> >> > > >
> >> > > > There seems to be confusion here between code style, and code
> >> > > > representation.
> >> > > >
> >> > > > Code style, ie layout, indent width, is not negotiable.
> >> > > >
> >> > > > Code representation is the use of tab characters at 8-character
> >> > > > stops.  If your IDE or other device doesn't use 8 characher
> >> > > > stops, it will mangle code. That doesn't mean the code is badly
> >> > > > formatted, it means your display method is incompatible.
> >> > > >
> >> > > > It's quite possible to get around this by running expand on
> >> > > > every commit, so that only spaces are used in the repo. It's
> >even
> >> > > > possible to run expand on every existing file, at the expense
> >of
> >> > > > polluting the logs.  I don't think there are any other
> >downsides
> >> > > > to this.
> >> > > >
> >> > > > Or people could  configure IDEs and editors to use sane tab
> >stops.
> >> > > >
> >> > > > Cheers,
> >> > > >
> >> > > > Simon.
> >> > > >
> >> > > How do you feel about the mix usage of tab and leading white
> >spaces?
> >> > > The code is mangled because some liens use a tab and some use
> >white spaces.
> >> > > I do not think the choice of tab vs white spaces is code
> >representation.
> >> >
> >> > With tab stops set to 8, a single tab or eight spaces are just
> >alternate
> >> > representations of the same thing, surely?
> >> >
> >> >
> >> > Simon
> >> >
> >>
> >> Yes.
> >>
> >> But what I am asking in this thread is to use either tabs or white
> >spaces
> >> (not both).
> >> If only one is used, the width of tab in IDE does not matter.
> >
> >Now it waits for a decision.
> >
> >With which character should the code be indented?
> >
> >
> >Regards
> >Geert Stappers
> >
> >___
> >Dnsmasq-discuss mailing list
> >Dnsmasq-discuss@lists.thekelleys.org.uk
> >http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Starting as non-root just works

2019-05-14 Thread Kristoffel Pirard
Hi Geert,

That is terribly helpful.  Thanks a lot!

Although 'the whole world is not Linux', your explanation "Dnsmasq listens
on ports 53, 67 and 69. That requires
root privilege; Avoiding to run dnsmasq as root can be done with net
capabilities" seems a terrific candidate to go in the man page :)  Would
you like me to prepare a pull request?

Regards
Kristoffel


On Mon, May 13, 2019 at 11:35 PM Geert Stappers 
wrote:

> On Mon, May 13, 2019 at 12:51:09PM +0200, Kristoffel Pirard wrote:
> > On Mon, 13 May 2019, 12:36 Geert Stappers wrote:
> > > On 13-05-2019 11:02, Roy Marples wrote:
> > > > On 13/05/2019 09:31, Kristoffel Pirard wrote:
> > > >> The dnsmasq man page for the --user parameter says that "Dnsmasq
> must
> > > >> _normally_ be started as root".  We tested starting as non-root
> user,
> > > >> but with capabilities cap_net_bind_service, cap_net_admin,
> > > >> cap_net_raw.  It currently seems to work, but I'm debating if we
> > > >> should actually use this 'hack'.
> > > >>
> > > >> So should the ambiguous adverb 'normally' be removed from the
> > > >> documentation?  If not, what are the circumstances in which it is
> > > >> allowed to not start as root?
> > > >
> > > > The whole world is not Linux. Most other OS's don't have these caps.
> > > >
> > > >
> > > In other words:The _normally_  in  'Dnsmasq must normally be
> started
> > > as root' is correct.
> > >
> > So I should interpret it as 'unless you have a really good reason and you
> > know what you're doing'?  (Which I answer 'no' to twice)
>
>
> ] 'Dnsmasq must normally be started as root'
>
>
> Read that as "Dnsmasq listens on ports 53, 67 and 69. That requires
> root privilege."  Running a process as root does get that privilege.
> Yes we did that all the time in days before the fear.
>
> Avoiding to run Dnsmasq as root can be done with "net capabilities"
>
> > > >> We tested starting as non-root user, but with capabilities
> > > >> cap_net_bind_service, cap_net_admin, cap_net_raw.
>
> :-)
>
> > > >> It currently seems to work,
>
> I do read that as "Confirming that cap_net_*** works"
>
>
> > > >> but I'm debating if we should actually use this 'hack'.
>
>
>
>
> Groeten
> Geert Stappers
> --
> Leven en laten leven
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


Re: [Dnsmasq-discuss] Starting as non-root

2019-05-13 Thread Kristoffel Pirard
So I should interpret it as 'unless you have a really good reason and you
know what you're doing'?  (Which I answer 'no' to twice)

On Mon, 13 May 2019, 12:36 Geert Stappers,  wrote:

>
> On 13-05-2019 11:02, Roy Marples wrote:
> > On 13/05/2019 09:31, Kristoffel Pirard wrote:
> >> The dnsmasq man page for the --user parameter says that "Dnsmasq must
> >> _normally_ be started as root".  We tested starting as non-root user,
> >> but with capabilities cap_net_bind_service, cap_net_admin,
> >> cap_net_raw.  It currently seems to work, but I'm debating if we
> >> should actually use this 'hack'.
> >>
> >> So should the ambiguous adverb 'normally' be removed from the
> >> documentation?  If not, what are the circumstances in which it is
> >> allowed to not start as root?
> >
> > The whole world is not Linux. Most other OS's don't have these caps.
> >
> >
> In other words:The _normally_  in  'Dnsmasq must normally be started
> as root' is correct.
>
>
> Cheers
>
> Geert Stappers
>
>
>
>
>
>
> ___
> Dnsmasq-discuss mailing list
> Dnsmasq-discuss@lists.thekelleys.org.uk
> http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss
>
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss


[Dnsmasq-discuss] Starting as non-root

2019-05-13 Thread Kristoffel Pirard
Hi there,

The dnsmasq man page for the --user parameter says that "Dnsmasq must
_normally_ be started as root".  We tested starting as non-root user, but
with capabilities cap_net_bind_service, cap_net_admin, cap_net_raw.  It
currently seems to work, but I'm debating if we should actually use this
'hack'.

So should the ambiguous adverb 'normally' be removed from the
documentation?  If not, what are the circumstances in which it is allowed
to not start as root?

Kind regards,
Kristoffel
___
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss