From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?G=C3=A1bor?= Boskovits Subject: bug#37388: can lead to syntactically invalid configs Date: Thu, 12 Sep 2019 14:49:10 +0200 Message-ID: References: <87d0g6q752.fsf@inria.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000001aab6e05925a91a7" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56266) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i8OY0-0008DT-0S for bug-guix@gnu.org; Thu, 12 Sep 2019 08:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i8OXy-0004TU-PS for bug-guix@gnu.org; Thu, 12 Sep 2019 08:50:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:34337) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i8OXy-0004TN-Mx for bug-guix@gnu.org; Thu, 12 Sep 2019 08:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i8OXy-0002Ba-I9 for bug-guix@gnu.org; Thu, 12 Sep 2019 08:50:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87d0g6q752.fsf@inria.fr> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 37388@debbugs.gnu.org --0000000000001aab6e05925a91a7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Ludovic Court=C3=A8s ezt =C3=ADrta (id=C5=91pont: 2019. szep= t. 12., Cs, 9:58): > Hello Guix! > > It=E2=80=99s nice that we have but I noticed that, = unlike > most or all other configuration records that we have, it=E2=80=99s possib= le to > create an record that leads to a syntactically > invalid nginx config file. > > For example, if you have a location block like this: > > (nginx-location-configuration > (uri "/manual/") > (body (list "alias /srv/guix-manual"))) > > Guix will silently create an invalid nginx config file, which you=E2=80= =99ll > only notice once you=E2=80=99ve reconfigured and nginx fails to start. > > See why? That=E2=80=99s because we=E2=80=99re missing a semicolon in the= =E2=80=9Calias=E2=80=9D > directive, and that directive is spit out directly as is. > > To address it, we could have record types for , , and all > the directives out there; it could be tedious, unless we automate it, > effectively creating a complete EDSL. > > Another approach would be to have an sexp representation of the nginx > configuration language. That=E2=80=99d effectively replace semicolons wi= th > parentheses :-), but more importantly, that would allow us to not paste > strings as-is in the resulting config file. The downside is that it=E2= =80=99s > very much =E2=80=9Cfree style=E2=80=9D compared to records, but we could = still > pattern-match the sexp to validate certain properties. > > I would most probably go for the sexp version. > Thoughts? > I would like to add some more information to this, which I encountered when trying to find a solution to the last-modified issue: 1. the nginx configuration can only be extended using server blocks, so it is not possible to inject a location or a nested location. 2. the meaning of the nginx configuration can dependent on the order of directives in the configuration. Either we should give and explicit mechanism for dealing with that, or disallow such configurations. If you feel these points to be off topic, then I can open a separate bug for that, but these seem to relate to the confgiuration mechanism, and should be considered when designing the new interface. Wdyt? > > Ludo=E2=80=99. > > > > Best regards, g_bor --=20 OpenPGP Key Fingerprint: 7988:3B9F:7D6A:4DBF:3719:0367:2506:A96C:CF63:0B21 --0000000000001aab6e05925a91a7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

Ludovic Court=C3=A8s <ludo@gnu.org> ezt =C3=ADrta (id=C5=91pont: 2019. szept= . 12., Cs, 9:58):
Thoughts?

I would like to add some more= information to this, which I encountered when trying to find a solution to= the last-modified issue:

1. the nginx configurati= on can only be extended using server blocks, so it is not possible to injec= t a location or a nested location.
2. the meaning of the nginx co= nfiguration can dependent on the order of directives in the configuration. = Either we should give
and explicit mechanism for dealing with tha= t, or disallow such configurations.

If you feel th= ese points to be off topic, then I can open a separate bug for that, but th= ese seem to relate to the confgiuration mechanism,
and should be = considered when designing the new interface. Wdyt?
=C2=A0

Ludo=E2=80=99.




Best regards,
g_bor

--
O= penPGP Key Fingerprint: 7988:3B9F:7D6A:4DBF:3719:0367:2506:A96C:CF63:0B21
--0000000000001aab6e05925a91a7--