From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines Subject: bug#37388: can lead to syntactically invalid configs Date: Sat, 14 Sep 2019 11:02:59 +0100 Message-ID: <87d0g3nqjw.fsf@cbaines.net> References: <87d0g6q752.fsf@inria.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:44932) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i94uQ-0002g5-UZ for bug-guix@gnu.org; Sat, 14 Sep 2019 06:04:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i94uQ-0006zI-0B for bug-guix@gnu.org; Sat, 14 Sep 2019 06:04:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37077) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i94uP-0006zE-To for bug-guix@gnu.org; Sat, 14 Sep 2019 06:04:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i94uP-0002Qx-LL for bug-guix@gnu.org; Sat, 14 Sep 2019 06:04:01 -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: ludo@gnu.org Cc: 37388@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > 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. 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 , , 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----- --=-=-=--