From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#20720: Inconsistency in text fields for 'operating-system' Date: Fri, 05 Jun 2015 14:30:35 +0200 Message-ID: <874mmmjq1g.fsf@gnu.org> References: <87egludumx.fsf@gmail.com> <87r3ptw23a.fsf@gnu.org> <87y4jzwn2s.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0qm9-00035y-GJ for bug-guix@gnu.org; Fri, 05 Jun 2015 08:31:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0qm7-0007oM-Q0 for bug-guix@gnu.org; Fri, 05 Jun 2015 08:31:05 -0400 Received: from debbugs.gnu.org ([140.186.70.43]:59481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0qm7-0007o0-7z for bug-guix@gnu.org; Fri, 05 Jun 2015 08:31:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z0qm6-0001uo-GM for bug-guix@gnu.org; Fri, 05 Jun 2015 08:31:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87y4jzwn2s.fsf@gmail.com> (Alex Kost's message of "Thu, 04 Jun 2015 17:43:55 +0300") 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-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Alex Kost Cc: 20720@debbugs.gnu.org Alex Kost skribis: > Ludovic Court=C3=A8s (2015-06-03 12:52 +0300) wrote: [...] >> An important criterion is whether the file needs to contain references >> to store items or not. For =E2=80=98sudoers=E2=80=99 and =E2=80=98issue= =E2=80=99, that=E2=80=99s normally not >> the case, and these are usually small files or computable files, so I >> think it=E2=80=99s fine to use strings here (more convenient than files.) > > Well, I don't agree about =E2=80=98sudoers=E2=80=99. It may be a really = big file. Mine > is not so big, but it is 40 lines long (including some useful comments), > so I have to use some additional guile code to convert the contents of > the file into string. Ah, good point. So let=E2=80=99s turn =E2=80=98sudoers=E2=80=99 into a fil= e-like object. >> Using monadic values as for =E2=80=98hosts-file=E2=80=99 and #:motd is n= ot nice. These >> should be changed to use either a string or a file. >> >> The best would be to always use a file-like object. I=E2=80=99ve just a= dded >> =E2=80=98plain-file=E2=80=99 for that reason. Now I would change #:motd= and >> =E2=80=98hosts-file=E2=80=99 to take a file-like object rather than a mo= nadic value. >> >> WDYT? > > I beg a pardon, but if I inderstand it correctly (probably not), I don't > see a difference from the user point of view. Previously it was: > > (hosts-file (text-file "hosts" "...")) > > and now it would be: > > (hosts-file (plain-file "hosts" "...")) Right. But it could also be: (hosts-file (local-file "/home/foo/my-hosts-file.txt")) This form is pleasant when the file can be long or when it has special syntax and you=E2=80=99d rather use the editor=E2=80=99s syntax highlightin= g. > I think I'm not competent as I have a vague understanding of all this > stuff and of user's needs (except mine =E2=98=BA). What I would like to = have, > is a possibility to specify my configuration files for various services > and operating-system fields. I don't want to write text configs in my > os-config.scm file (as it happens now with =E2=80=98hosts-file=E2=80=99). OK. So that=E2=80=99s definitely in favor of using file-like objects pretty much everywhere. > I'm very happy with the current behaviour of =E2=80=98syslog-service=E2= =80=99, > =E2=80=98lirc-service=E2=80=99 and =E2=80=98console-keymap-service=E2=80= =99 where I just specify file > names, e.g.: > > (syslog-service #:config-file "/home/me/my-favourite-syslog.conf") > > and I like this =E2=86=91 way of specifying configurations very much! Th= at's > what I would like to see in =E2=80=98sudoers=E2=80=99 and =E2=80=98hosts-= file=E2=80=99 fields. OK. Note that this form (directly using a local file name) works somewhat by chance and should not be used because it defeats reproducibility. That is, your OS configuration actually depends on that file in /home, which may be modified or deleted anytime, thereby changing the syslogd behavior in unpredicable ways. The right thing to do is: (syslog-service #:config-file (local-file "/home/me/my-favourite-syslog.conf")) This means that the config file is automatically added to the store and made part of the closure of the OS config. Now if "/home/me/my-favourite-syslog.conf" is removed/modified, the OS behavior remains unchanged. I=E2=80=99ll prepare a patch for that and report back. Thank you! Ludo=E2=80=99.