From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 117686 invoked by alias); 6 Jun 2017 11:55:12 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 117515 invoked by uid 89); 6 Jun 2017 11:55:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=amazingly X-HELO: rgout06.bt.lon5.cpcloud.co.uk Received: from rgout0607.bt.lon5.cpcloud.co.uk (HELO rgout06.bt.lon5.cpcloud.co.uk) (65.20.0.134) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Jun 2017 11:55:09 +0000 X-OWM-Source-IP: 86.141.128.130 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=8/50,refid=2.7.2:2017.6.2.221216:17:8.707,ip=,rules=NO_URI_FOUND, NO_CTA_URI_FOUND, NO_MESSAGE_ID, NO_URI_HTTPS, TO_MALFORMED Received: from localhost.localdomain (86.141.128.130) by rgout06.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 58F7952B05224736; Tue, 6 Jun 2017 12:55:13 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 8/9] Fix useless error message Date: Tue, 06 Jun 2017 11:55:00 -0000 Message-Id: <20170606115432.105020-9-jon.turney@dronecode.org.uk> In-Reply-To: <20170606115432.105020-1-jon.turney@dronecode.org.uk> References: <20170606115432.105020-1-jon.turney@dronecode.org.uk> X-SW-Source: 2017-06/txt/msg00012.txt.bz2 If source.Cached() is empty, we produce the amazingly helpful error message "Can't open (null) for reading: No such file". Improve the error message so it reports that we can't open the archive since we don't know a filename for the locally cached archive file. This can occur if download failed for an archive, but we chose to continue. --- install.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/install.cc b/install.cc index 79ddd20..f8f0b59 100644 --- a/install.cc +++ b/install.cc @@ -366,7 +366,14 @@ Installer::installOne (packagemeta &pkgm, const packageversion &ver, io_stream *pkgfile = NULL; - if (!source.Cached() || !io_stream::exists (source.Cached ()) + if (!source.Cached()) + { + note (NULL, IDS_ERR_OPEN_READ, source.Canonical (), "Unknown filename"); + ++errors; + return; + } + + if (!io_stream::exists (source.Cached ()) || !(pkgfile = io_stream::open (source.Cached (), "rb", 0))) { note (NULL, IDS_ERR_OPEN_READ, source.Cached (), "No such file"); -- 2.12.3