From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: dmd: [PATCH] Improve socket connection errors handling. Date: Thu, 10 Apr 2014 16:52:35 +0200 Message-ID: <87k3ax6xu4.fsf@gnu.org> References: <20140410081446.GF9248@kubera.prv.maison> 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]:46857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYGLK-0000Ll-MX for guix-devel@gnu.org; Thu, 10 Apr 2014 10:52:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYGLF-0008Ju-MM for guix-devel@gnu.org; Thu, 10 Apr 2014 10:52:42 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:44137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYGLF-0008Jk-FI for guix-devel@gnu.org; Thu, 10 Apr 2014 10:52:37 -0400 In-Reply-To: <20140410081446.GF9248@kubera.prv.maison> (Cyprien Nicolas's message of "Thu, 10 Apr 2014 10:14:46 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Cyprien Nicolas Cc: guix-devel@gnu.org Cyprien Nicolas skribis: > My first patch for dmd :-) Very cool, welcome! :-) Those backtraces had been bothering me for a while too, so thanks for looking at it. > From 6e8f871198b661b631a319f3abaef71bc6269fb7 Mon Sep 17 00:00:00 2001 > From: Cyprien Nicolas > Date: Thu, 10 Apr 2014 10:07:06 +0200 > Subject: [PATCH] Improve socket connection errors handling. > > If the user running `deco' does not have the rights privileges to open > the unix socket, the raised exception produces a backtrace. > > * modules/dmd/comm.scm (open-connection): Add a (catch > 'system-error...) guard around the connect function call. > The handler will abort the program in case of error. I pushed a couple of patches that achieve the same result slightly differently: =E2=80=98open-connection=E2=80=99 is left unchanged and it=E2= =80=99s the caller=E2=80=99s responsibility to handle any errors; clients use the new =E2=80=98with-system-error-handling=E2=80=99 macro do handle all =E2=80=98s= ystem-error=E2=80=99 exceptions gracefully. One remark: > + (lambda (key . args) > + (display (format #f "Error: Cannot connect to socket `~a': ~a\= n" > + file (apply format #f (cadr args) (caddr args= ))) > + (current-error-port)) This could be directly (format (current-error-port) ...). Also, we avoid uses of =E2=80=98car=E2=80=99, =E2=80=98cadr=E2=80=99 etc. i= n favor of =E2=80=98match=E2=80=99 (at least in new code.) Thanks! Ludo=E2=80=99.