From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#37388: can lead to syntactically invalid configs Date: Sat, 14 Sep 2019 14:26:27 +0200 Message-ID: <87r24j3vyk.fsf@gnu.org> References: <87d0g6q752.fsf@inria.fr> <87d0g3nqjw.fsf@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:60545) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i978r-0001hv-DX for bug-guix@gnu.org; Sat, 14 Sep 2019 08:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i978p-0003jz-Gd for bug-guix@gnu.org; Sat, 14 Sep 2019 08:27:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37161) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i978o-0003iI-5c for bug-guix@gnu.org; Sat, 14 Sep 2019 08:27:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i978o-0001cR-0v for bug-guix@gnu.org; Sat, 14 Sep 2019 08:27:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87d0g3nqjw.fsf@cbaines.net> (Christopher Baines's message of "Sat, 14 Sep 2019 11:02:59 +0100") 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: Christopher Baines Cc: 37388@debbugs.gnu.org Hi, Christopher Baines skribis: > 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 possi= ble 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. 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.