From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] edit: Friendlier error message. Date: Thu, 05 Nov 2015 12:08:35 +0100 Message-ID: <874mh0900c.fsf@gnu.org> References: <1446676935-11602-1-git-send-email-benno@bmevers.de> 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]:45336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZuIPK-0003dK-HU for guix-devel@gnu.org; Thu, 05 Nov 2015 06:08:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZuIPG-0005rk-HN for guix-devel@gnu.org; Thu, 05 Nov 2015 06:08:42 -0500 In-Reply-To: <1446676935-11602-1-git-send-email-benno@bmevers.de> (benno@bmevers.de's message of "Wed, 4 Nov 2015 23:42:15 +0100") 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: benno@bmevers.de Cc: guix-devel@gnu.org benno@bmevers.de skribis: > From: Benno Evers > > * guix/scripts/edit.scm (guix-edit): Check if %editor exists. > --- > These are my first lines of guile, so probably there is a much > better way to do this :D > > The previous error message ("execlp: No such file or directory") > had me confused for a while, though. Indeed. You=E2=80=99re doing OK Scheme-wise, no worries! ;-) > + (unless (search-path (parse-path (getenv "PATH")) (%editor)) > + (leave (_ "Couldn't find editor '~a'. Please check $EDITOR and $PA= TH.") > + (%editor))) In commit 650f161, I did things slightly differently by catching the actual =E2=80=98execl=E2=80=99 exception and reporting it. This is more ac= curate than using =E2=80=98search-path=E2=80=99 because there could be other errors (in= valid permissions, etc.) and possibly TOCTTOU races. Thank you! Ludo=E2=80=99.