From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id psH8ElD8BmDadQAA0tVLHw (envelope-from ) for ; Tue, 19 Jan 2021 15:35:44 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id KAeBDlD8BmDJRwAAB5/wlQ (envelope-from ) for ; Tue, 19 Jan 2021 15:35:44 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E26F594021E for ; Tue, 19 Jan 2021 15:35:43 +0000 (UTC) Received: from localhost ([::1]:33972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1t2k-0003ks-Lt for larch@yhetil.org; Tue, 19 Jan 2021 10:35:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1svN-0004Sw-Ha for guix-patches@gnu.org; Tue, 19 Jan 2021 10:28:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1svL-0003hl-5a for guix-patches@gnu.org; Tue, 19 Jan 2021 10:28:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l1svL-0004BQ-0l for guix-patches@gnu.org; Tue, 19 Jan 2021 10:28:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#45983] [PATCH 3/3] scripts: import: json: Fix error handling. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 19 Jan 2021 15:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45983 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45983@debbugs.gnu.org Received: via spool by 45983-submit@debbugs.gnu.org id=B45983.161107007316044 (code B ref 45983); Tue, 19 Jan 2021 15:28:02 +0000 Received: (at 45983) by debbugs.gnu.org; 19 Jan 2021 15:27:53 +0000 Received: from localhost ([127.0.0.1]:51306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1svA-0004Ad-Mq for submit@debbugs.gnu.org; Tue, 19 Jan 2021 10:27:52 -0500 Received: from mail-wr1-f42.google.com ([209.85.221.42]:46085) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1sv8-0004A2-9S for 45983@debbugs.gnu.org; Tue, 19 Jan 2021 10:27:51 -0500 Received: by mail-wr1-f42.google.com with SMTP id d13so20092627wrc.13 for <45983@debbugs.gnu.org>; Tue, 19 Jan 2021 07:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qfsn21dmQ4AocOiNLOUAVTZBrF0mc6D7Zo40/T57QNU=; b=m6ELhhCL+OCgQvNfzejzy8Nhw4sf0e0hzJuspryHVn7yFqBMBqxmk7jyBc3jsfMORB GaVCSezua+4TUINtVXYtg+KL3J+zH/xw4pDOAEoWxL9VrGUmGYaMCqlbHGZoo0JYEU8y EhdjkApuGycCtSDsXbvRtxwC2k2/m5CHNuzOl0ARMFQro4wN8wlgNCAT5twlTz8f75PK mFISKcwTas8IoheAv1TE9cVWM95NqFFzM8KAsVurmFGM55a+aAp8w9Y3/8YwSfXCWm+W IrYTZbP4n9dceRbL95pRQDz5VaJNqhSD0UZ8a/ETDV2DBxBl0jsK4ZixJpqtvV+ajLPP 1NyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qfsn21dmQ4AocOiNLOUAVTZBrF0mc6D7Zo40/T57QNU=; b=llSp0mji8pJEr6ZJY0aDazH2J++Wc+zfC/I976V/Hxefx6e0uNHIJ4thD+8sEMhCxL PSjzwzycDPFVaX0jl9OLXLcy3woWkQelcZ5U+Jqd3FCtoKZZBxrU7RlkFbHfvBezmHwM J2Ff6Y4XHS3i9IN+MTnXnWNcifQP1gt/8PhVsr6A3WFJwHOrpLLN6QQ4VVp63uPbG7Dg hP3HQXUn3AJNFkVvKLuc8N4vy9tQ/AY7zrVWDzm46cNpIr7Hd4uB0oANW7dP1P8yH1Ux 3u+6KqgzJDtFJhB7PTBx466njdKB7WTrp+4+SxowoB9hH/Aqz895I+bmhsNVypOD5C9/ HuNw== X-Gm-Message-State: AOAM530aWlIHfR+3n1KysuZ8AMTI2/ODNP9b7OKgwDL/MmYtrpUa9uA1 2kBjfAbFAkh02LVn12bIRQX16xcPXDA= X-Google-Smtp-Source: ABdhPJwiPDpVXn1sbxU7Q2ZAmRI9HtStsp/289Y7Ll7EEE/If1Inur6Llo/Bhz9hzpzys2fosDsVGQ== X-Received: by 2002:adf:f9d0:: with SMTP id w16mr2465843wrr.137.1611070064631; Tue, 19 Jan 2021 07:27:44 -0800 (PST) Received: from lili.univ-paris-diderot.fr ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id s1sm36909779wrv.97.2021.01.19.07.27.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 07:27:44 -0800 (PST) From: zimoun Date: Tue, 19 Jan 2021 16:27:37 +0100 Message-Id: <20210119152737.4344-3-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210119152737.4344-1-zimon.toutoune@gmail.com> References: <20210119152737.4344-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -1.25 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=m6ELhhCL; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: E26F594021E X-Spam-Score: -1.25 X-Migadu-Scanner: scn1.migadu.com X-TUID: go/U0FX1AZaQ Fixes partially . * guix/scripts/import/json.scm (guix-import-json): Handle error. --- guix/scripts/import/json.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guix/scripts/import/json.scm b/guix/scripts/import/json.scm index 778e5f4bc5..63fba260ae 100644 --- a/guix/scripts/import/json.scm +++ b/guix/scripts/import/json.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2015, 2017 Ricardo Wurmus +;;; Copyright © 2021 Simon Tournier ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,8 +89,10 @@ Import and convert the JSON package definition in PACKAGE-FILE.\n")) (reverse opts)))) (match args ((file-name) - (or (json->code file-name) - (leave (G_ "invalid JSON in file '~a'~%") file-name))) + (if (file-exists? file-name) + (or (json->code file-name) + (leave (G_ "invalid JSON in file '~a'~%") file-name)) + (leave (G_ "invalid file name~%")))) (() (leave (G_ "too few arguments~%"))) ((many ...) -- 2.29.2