GNU bug report logs - #37388
<nginx-configuration> can lead to syntactically invalid configs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix; Reported by: Ludovic Courtès <ludo@HIDDEN>; dated Thu, 12 Sep 2019 07:58:01 UTC; Maintainer for guix is bug-guix@HIDDEN.

Message received at 37388 <at> debbugs.gnu.org:


Received: (at 37388) by debbugs.gnu.org; 14 Sep 2019 12:26:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 08:26:37 2019
Received: from localhost ([127.0.0.1]:45982 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i978P-0001bo-69
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 08:26:37 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52021)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1i978O-0001bc-21
 for 37388 <at> debbugs.gnu.org; Sat, 14 Sep 2019 08:26:36 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:51844)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1i978I-0003cw-U1; Sat, 14 Sep 2019 08:26:30 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58842 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1i978H-0000LC-V3; Sat, 14 Sep 2019 08:26:30 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Christopher Baines <mail@HIDDEN>
Subject: Re: bug#37388: <nginx-configuration> can lead to syntactically
 invalid configs
References: <87d0g6q752.fsf@HIDDEN> <87d0g3nqjw.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 28 Fructidor an 227 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Sat, 14 Sep 2019 14:26:27 +0200
In-Reply-To: <87d0g3nqjw.fsf@HIDDEN> (Christopher Baines's message of
 "Sat, 14 Sep 2019 11:02:59 +0100")
Message-ID: <87r24j3vyk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 37388
Cc: 37388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Christopher Baines <mail@HIDDEN> skribis:

> Ludovic Court=C3=A8s <ludo@HIDDEN> writes:
>
>> It=E2=80=99s nice that we have <nginx-configuration> but I noticed that,=
 unlike
>> most or all other configuration records that we have, it=E2=80=99s possi=
ble to
>> create an <nginx-configuration> 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.
>
> I wonder if some errors could be caught at build time, before attempting
> to start the service.
>
> If in the derivation to build the configuration file, nginx is run
> against the built config file with -t, that might spot errors at
> derivation build time.

Yeah, this is probably doable.

I would consider it a stop-gap measure though.  Fundamentally, I think
we should make it so that, by construction, invalid (or at least
syntactically-invalid) config files cannot be produced.

> An sexp representation sounds good, although I think records will work
> out better for the common and high level parts.

The way I see it, sexps and records could be almost indistinguishable
provided some appropriate macrology.  But sexps are definitely easier to
implement.

Thanks,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#37388; Package guix. Full text available.

Message received at 37388 <at> debbugs.gnu.org:


Received: (at 37388) by debbugs.gnu.org; 14 Sep 2019 10:03:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 06:03:06 2019
Received: from localhost ([127.0.0.1]:45898 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i94tV-0002Pk-TU
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 06:03:06 -0400
Received: from mira.cbaines.net ([212.71.252.8]:58642)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mail@HIDDEN>) id 1i94tT-0002Pb-Mu
 for 37388 <at> debbugs.gnu.org; Sat, 14 Sep 2019 06:03:04 -0400
Received: from localhost (cpc102582-walt20-2-0-cust14.13-2.cable.virginm.net
 [86.27.34.15])
 by mira.cbaines.net (Postfix) with ESMTPSA id 8F08617383;
 Sat, 14 Sep 2019 11:03:02 +0100 (BST)
Received: from capella (localhost [127.0.0.1])
 by localhost (OpenSMTPD) with ESMTP id 772f1c1b;
 Sat, 14 Sep 2019 10:03:01 +0000 (UTC)
References: <87d0g6q752.fsf@HIDDEN>
User-agent: mu4e 1.2.0; emacs 26.3
From: Christopher Baines <mail@HIDDEN>
To: ludo@HIDDEN
Subject: Re: bug#37388: <nginx-configuration> can lead to syntactically
 invalid configs
In-reply-to: <87d0g6q752.fsf@HIDDEN>
Date: Sat, 14 Sep 2019 11:02:59 +0100
Message-ID: <87d0g3nqjw.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 37388
Cc: 37388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable


Ludovic Court=C3=A8s <ludo@HIDDEN> writes:

> It=E2=80=99s nice that we have <nginx-configuration> but I noticed that, =
unlike
> most or all other configuration records that we have, it=E2=80=99s possib=
le to
> create an <nginx-configuration> 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.

I wonder if some errors could be caught at build time, before attempting
to start the service.

If in the derivation to build the configuration file, nginx is run
against the built config file with -t, that might spot errors at
derivation build time.

> 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 <alias>, <root>, 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.

An sexp representation sounds good, although I think records will work
out better for the common and high level parts.

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAl18utNfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcVaRAAkk2xc34iv59mrjjNpAS0GuHJXnWMMb5acwt5ZQuiCDBbdemEgeV18j++
cyo99sXIYzzcz83nOsSirN+5ztrPdFDWxFuv0yloickkzNP6Pek89J9n8Ulbik+a
nA1OtypJdyv3v/cCVXybJo8neSIwK6dJ0/7hPZcc4ogYSO2WF2WKQXk15Oueypw/
Q1ceCL80BSvevYBQpKkVte81Oc8rARBHiyGsTOkHfiM3ffcB6naD2lkv+GLl46L/
bI/YRsbrLhARAd1V6gPCBe61KCJmakaq204qvSAIuTLbTIc78/eGTSHPQK/oEoaT
qjjMkiQDQYD4fqrUiq6Yr70lwImOZj3OFQJ6MfBA9r1ZIwhxBlAy48BbAqycNxED
4AnaFO9+pzuSZVJdV7XMjkqnU562nt+/0EkK5GElp41Cn74s8dTbEcH7HN4OZWeS
HJcpjbHD0IgNudisaBvZgbTFwIURSpVlz/pRtVlaBlbJAvz4fnMFiwalbCR1kQU+
p6mDvxPA2l8xOY0MsP3b8dkSe1E/8EYh5KsRhqtVapq8qACelAgtw1tvZD05iQmg
ObJao0yfgLSc0D5drgjem9RbieIqn+/k795gmUUAfCH2AdcILGkRMC5z4MGx+QMy
DZBAQzlsoDpr4DmCXnI+Tirvxlmb+dNjh1jCUINqL9t0DB2rqDw=
=/B6t
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-guix@HIDDEN:
bug#37388; Package guix. Full text available.

Message received at 37388 <at> debbugs.gnu.org:


Received: (at 37388) by debbugs.gnu.org; 14 Sep 2019 09:48:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 14 05:48:22 2019
Received: from localhost ([127.0.0.1]:45886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i94fE-00023E-6f
	for submit <at> debbugs.gnu.org; Sat, 14 Sep 2019 05:48:22 -0400
Received: from eggs.gnu.org ([209.51.188.92]:34941)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1i94fD-000233-5l
 for 37388 <at> debbugs.gnu.org; Sat, 14 Sep 2019 05:48:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49599)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1i94f8-0005BB-02; Sat, 14 Sep 2019 05:48:14 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58484 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1i94f7-00028P-AT; Sat, 14 Sep 2019 05:48:13 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: =?utf-8?Q?G=C3=A1bor?= Boskovits <boskovits@HIDDEN>
Subject: Re: bug#37388: <nginx-configuration> can lead to syntactically
 invalid configs
References: <87d0g6q752.fsf@HIDDEN>
 <CAE4v=piOdgg0wSL2VDJYo07nMPSYYUMvYvPhGnnBVQ_nVzHc+Q@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 28 Fructidor an 227 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Sat, 14 Sep 2019 11:48:11 +0200
In-Reply-To: <CAE4v=piOdgg0wSL2VDJYo07nMPSYYUMvYvPhGnnBVQ_nVzHc+Q@HIDDEN>
 (=?utf-8?Q?=22G=C3=A1bor?= Boskovits"'s message of "Thu, 12 Sep 2019
 14:49:10 +0200")
Message-ID: <87lfur5hus.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 37388
Cc: 37388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi G=C3=A1bor,

G=C3=A1bor Boskovits <boskovits@HIDDEN> skribis:

> I would like to add some more information to this, which I encountered wh=
en
> 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?

I think it would deserve a separate issue, but I agree that extension of
<nginx-configuration> is tricky due to ordering.

Thanks for your feedback,
Ludo=E2=80=99.




Information forwarded to bug-guix@HIDDEN:
bug#37388; Package guix. Full text available.

Message received at 37388 <at> debbugs.gnu.org:


Received: (at 37388) by debbugs.gnu.org; 12 Sep 2019 12:49:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 12 08:49:31 2019
Received: from localhost ([127.0.0.1]:43158 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i8OXS-0002AX-Ur
	for submit <at> debbugs.gnu.org; Thu, 12 Sep 2019 08:49:31 -0400
Received: from mail-ed1-f54.google.com ([209.85.208.54]:38343)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <boskovits@HIDDEN>) id 1i8OXQ-0002AJ-Nf
 for 37388 <at> debbugs.gnu.org; Thu, 12 Sep 2019 08:49:29 -0400
Received: by mail-ed1-f54.google.com with SMTP id a23so21602134edv.5
 for <37388 <at> debbugs.gnu.org>; Thu, 12 Sep 2019 05:49:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=sIxNWLG/ESKVmXoEkFprxvbImvo+7RVORsHM2t0xafU=;
 b=b70l8HJjCmUyJevXAuEmbNLzrAccqD2pLW3zZrDk9cPwdjOfOppfhaASNMSZKKDy+V
 VPoETCnmEE6Vd8hM1O4bd3IPBo20EyauYR8YSBB1Ft1hy3UZd0U4TjmP4JNECNGF24+l
 48j6wMtH9Y8pgCzd/RTpLA6WWHC414cX0mHBF/R3cQOluOOctejPj2r5vxfpGgJeYtne
 ak1dBTjD/ylZvVfF/AMoJhuMWSHrAO1xAjsEt/ZmzeJTvQ+07NlLZWrsC4CryT2iQYvT
 YqbWBOlRUpYD0WwZnhWA3+uX1wmgu46UfkoMlMWIW8YAwperpP4dqakjYTi7m2SyBHaf
 fI+Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=sIxNWLG/ESKVmXoEkFprxvbImvo+7RVORsHM2t0xafU=;
 b=UD5rGFIiLZrimsslvJR9zqUgAUGmqTmM+7HeLmKXN0rR9s5j9RwstTS7cwAKcIj3t9
 NJskEp8/i/SS5dcke469ulobP56P2x05jX22Vwz+MuqLjVEXT37lB1qrwRWNKRmy62z9
 5dowCqxfXg28m4TwqdIPg/vWKQa85pWNRRHyROeAE6GpLkCFf0DTtqJcNOHflle3ihEM
 /Gga6cGiN/dVsMaktsEDOlNioJHGU4eWJvzSO2lFdYdBTgCS3Cxfla80B45D02/VFOb4
 uWihOExPUDvG7r3pJLP9CfxEYp9E5XIKD0CACCjXeg3HCG038uT768Akniet/Pj+xvsy
 6ZzA==
X-Gm-Message-State: APjAAAWUHApP4JXpI0IwojV9isILNf3lxr3lxOLpRRsE9JWBfm7r7H+f
 T5ye9WRr3aHtIesbbc9w7rYdEs/NazjrlNJpvA==
X-Google-Smtp-Source: APXvYqzQRzEDJk4maQRUUAvXjyYc4WQbPqvSVo2s1aMAOgOR6wBi0Wth2EsZc5wiCzXRuiY+uOa7IO6QB52Bm8/f6BA=
X-Received: by 2002:aa7:da01:: with SMTP id r1mr42016750eds.87.1568292562707; 
 Thu, 12 Sep 2019 05:49:22 -0700 (PDT)
MIME-Version: 1.0
References: <87d0g6q752.fsf@HIDDEN>
In-Reply-To: <87d0g6q752.fsf@HIDDEN>
From: =?UTF-8?Q?G=C3=A1bor_Boskovits?= <boskovits@HIDDEN>
Date: Thu, 12 Sep 2019 14:49:10 +0200
Message-ID: <CAE4v=piOdgg0wSL2VDJYo07nMPSYYUMvYvPhGnnBVQ_nVzHc+Q@HIDDEN>
Subject: Re: bug#37388: <nginx-configuration> can lead to syntactically
 invalid configs
To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000001aab6e05925a91a7"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 37388
Cc: 37388 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000001aab6e05925a91a7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hello,

Ludovic Court=C3=A8s <ludo@HIDDEN> ezt =C3=ADrta (id=C5=91pont: 2019. szep=
t. 12., Cs,
9:58):

> Hello Guix!
>
> It=E2=80=99s nice that we have <nginx-configuration> but I noticed that, =
unlike
> most or all other configuration records that we have, it=E2=80=99s possib=
le to
> create an <nginx-configuration> 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 <alias>, <root>, 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

<div dir=3D"ltr"><div>Hello,<br></div><br><div class=3D"gmail_quote"><div d=
ir=3D"ltr" class=3D"gmail_attr">Ludovic Court=C3=A8s &lt;<a href=3D"mailto:=
ludo@HIDDEN">ludo@HIDDEN</a>&gt; ezt =C3=ADrta (id=C5=91pont: 2019. szept=
. 12., Cs, 9:58):<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">Hello Guix!<br>
<br>
It=E2=80=99s nice that we have &lt;nginx-configuration&gt; but I noticed th=
at, unlike<br>
most or all other configuration records that we have, it=E2=80=99s possible=
 to<br>
create an &lt;nginx-configuration&gt; record that leads to a syntactically<=
br>
invalid nginx config file.<br>
<br>
For example, if you have a location block like this:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (nginx-location-configuration<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (uri &quot;/manual/&quot;)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (body (list &quot;alias /srv/guix-manual=
&quot;)))<br>
<br>
Guix will silently create an invalid nginx config file, which you=E2=80=99l=
l<br>
only notice once you=E2=80=99ve reconfigured and nginx fails to start.<br>
<br>
See why?=C2=A0 That=E2=80=99s because we=E2=80=99re missing a semicolon in =
the =E2=80=9Calias=E2=80=9D<br>
directive, and that directive is spit out directly as is.<br>
<br>
To address it, we could have record types for &lt;alias&gt;, &lt;root&gt;, =
and all<br>
the directives out there; it could be tedious, unless we automate it,<br>
effectively creating a complete EDSL.<br>
<br>
Another approach would be to have an sexp representation of the nginx<br>
configuration language.=C2=A0 That=E2=80=99d effectively replace semicolons=
 with<br>
parentheses :-), but more importantly, that would allow us to not paste<br>
strings as-is in the resulting config file.=C2=A0 The downside is that it=
=E2=80=99s<br>
very much =E2=80=9Cfree style=E2=80=9D compared to records, but we could st=
ill<br>
pattern-match the sexp to validate certain properties.<br>
<br></blockquote><div><br></div><div>I would most probably go for the sexp =
version.<br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">
Thoughts?<br></blockquote><div><br></div><div>I would like to add some more=
 information to this, which I encountered when trying to find a solution to=
 the last-modified issue:</div><div><br></div><div>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.</div><div>2. the meaning of the nginx co=
nfiguration can dependent on the order of directives in the configuration. =
Either we should give</div><div>and explicit mechanism for dealing with tha=
t, or disallow such configurations.</div><div><br></div><div>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,</div><div>and should be =
considered when designing the new interface. Wdyt?<br></div><div>=C2=A0</di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;borde=
r-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Ludo=E2=80=99.<br>
<br>
<br>
<br>
</blockquote></div><div><br></div><div>Best regards,</div><div>g_bor<br></d=
iv><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature"><div dir=3D"ltr">O=
penPGP Key Fingerprint: 7988:3B9F:7D6A:4DBF:3719:0367:2506:A96C:CF63:0B21<b=
r></div></div></div>

--0000000000001aab6e05925a91a7--




Information forwarded to bug-guix@HIDDEN:
bug#37388; Package guix. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Sep 2019 07:57:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 12 03:57:21 2019
Received: from localhost ([127.0.0.1]:43000 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1i8Jyj-0004N1-7I
	for submit <at> debbugs.gnu.org; Thu, 12 Sep 2019 03:57:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:53393)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1i8Jyh-0004Mu-Jc
 for submit <at> debbugs.gnu.org; Thu, 12 Sep 2019 03:57:19 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:56303)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>) id 1i8Jyg-000154-GD
 for bug-Guix@HIDDEN; Thu, 12 Sep 2019 03:57:19 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.2 required=5.0 tests=ALL_TRUSTED,BAYES_50
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58175)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <ludo@HIDDEN>)
 id 1i8Jyg-0001kh-Cy
 for bug-Guix@HIDDEN; Thu, 12 Sep 2019 03:57:18 -0400
Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=38356 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>) id 1i8Jye-0003S4-Hb
 for bug-Guix@HIDDEN; Thu, 12 Sep 2019 03:57:17 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: bug-Guix@HIDDEN
Subject: <nginx-configuration> can lead to syntactically invalid configs
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 26 Fructidor an 227 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Thu, 12 Sep 2019 09:57:13 +0200
Message-ID: <87d0g6q752.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hello Guix!

It=E2=80=99s nice that we have <nginx-configuration> but I noticed that, un=
like
most or all other configuration records that we have, it=E2=80=99s possible=
 to
create an <nginx-configuration> 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 <alias>, <root>, 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 with
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 st=
ill
pattern-match the sexp to validate certain properties.

Thoughts?

Ludo=E2=80=99.




Acknowledgement sent to Ludovic Courtès <ludo@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-guix@HIDDEN. Full text available.
Report forwarded to bug-guix@HIDDEN:
bug#37388; Package guix. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 14 Sep 2019 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.