Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2C7CB431FDB for ; Thu, 24 May 2012 14:09:01 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OWP8UL8fsM8Y for ; Thu, 24 May 2012 14:09:00 -0700 (PDT) Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5C23F431FBD for ; Thu, 24 May 2012 14:09:00 -0700 (PDT) Received: by lagu2 with SMTP id u2so180288lag.26 for ; Thu, 24 May 2012 14:08:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:x-gm-message-state; bh=QWGkLaCJcx6tAYGKXDWNczs6wqW6D9oiErUOjt47wyY=; b=V+dVYbBRruEmHKV8CFKwTVL4rRNafwBRlwOFp29n3ymluVBpM3P/eoO3Z2rMNwqmTz aJOqkE8zs+mucX1iJo0XdJUMnoJj6VGspebVg2ECufwiHcLhKcxLOX+T1Bhs76gRecbY LU8imchtKcielLST6eeRKBtXVi1iIQtch8d+xTzJFSNgeCdiri2ukVx3ZulteJ1UHe7X SFLlm8Vg8yVYwkIxDTN+WA1e+D5592fnPih0jG/r8O2O7m55nhS7R2VqH+BzaOiwAuyc ZKg2LC0AcFJaB03MDVYPiyKxvLgqB0VnbOHX8teimRFcMbOtQtWbJRNc19u0/mFPgo1A TuKQ== Received: by 10.112.40.36 with SMTP id u4mr390266lbk.70.1337893738716; Thu, 24 May 2012 14:08:58 -0700 (PDT) Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi. [80.220.80.68]) by mx.google.com with ESMTPS id k4sm1888807lbb.12.2012.05.24.14.08.56 (version=SSLv3 cipher=OTHER); Thu, 24 May 2012 14:08:57 -0700 (PDT) From: Jani Nikula To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH v3 3/4] new: Merge error checks from add_files and add_files_recursive In-Reply-To: <87vcjl5mba.fsf@nikula.org> References: <1336429240-1114-1-git-send-email-amdragon@mit.edu> <1337887922-13163-1-git-send-email-amdragon@mit.edu> <1337887922-13163-4-git-send-email-amdragon@mit.edu> <87vcjl5mba.fsf@nikula.org> User-Agent: Notmuch/0.13+13~gc259b9a (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Fri, 25 May 2012 00:08:55 +0300 Message-ID: <87sjep5lso.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQknAn49lUPiNRjduXdvlOTD3UOUGDakMwsINEak1XOHMGUpCMUMKMvCge7PVsWKRRxUVwS1 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 21:09:01 -0000 Grrh, sorry for the spam. My favourite MUA told me: "Sending...failed to WARNING: gnome-keyring:: couldn't connect to: /tmp/keyring-Ky8i5h/pkcs11: No such file or directory" but sent the message anyway. Apparently msmpt tries to chat with the gnome-keyring-daemon even though that should not happen per the man page, and would be unnecessary and useless anyway. J. On Thu, 24 May 2012, Jani Nikula wrote: > On Thu, 24 May 2012, Austin Clements wrote: >> Before XXX, add_files_recursive could have been called on a symlink to >> a non-directory. Hence, calling it on a non-directory was not an >> error, so a separate function, add_files, existed to fail loudly in >> situations where the path had to be a directory. > > "Before XXX"? > > Otherwise, this 3/4 and following 4/4 patch LGTM. I didn't bother > looking at 1/4 and 2/4 again, as you say there were no changes. > > > BR, > Jani. > > >> >> With the new stat-ing logic, add_files_recursive is always called on >> directories, so the separation of this logic is no longer necessary. >> Hence, this patch moves the strict error checking previously done by >> add_files into add_files_recursive. >> --- >> notmuch-new.c | 27 +++++---------------------- >> 1 file changed, 5 insertions(+), 22 deletions(-) >> >> diff --git a/notmuch-new.c b/notmuch-new.c >> index c64f1a7..2b05605 100644 >> --- a/notmuch-new.c >> +++ b/notmuch-new.c >> @@ -308,11 +308,10 @@ add_files_recursive (notmuch_database_t *notmuch, >> } >> stat_time = time (NULL); >> >> - /* This is not an error since we may have recursed based on a >> - * symlink to a regular file, not a directory, and we don't know >> - * that until this stat. */ >> - if (! S_ISDIR (st.st_mode)) >> - return NOTMUCH_STATUS_SUCCESS; >> + if (! S_ISDIR (st.st_mode)) { >> + fprintf (stderr, "Error: %s is not a directory.\n", path); >> + return NOTMUCH_STATUS_FILE_ERROR; >> + } >> >> fs_mtime = st.st_mtime; >> >> @@ -655,23 +654,7 @@ add_files (notmuch_database_t *notmuch, >> const char *path, >> add_files_state_t *state) >> { >> - notmuch_status_t status; >> - struct stat st; >> - >> - if (stat (path, &st)) { >> - fprintf (stderr, "Error reading directory %s: %s\n", >> - path, strerror (errno)); >> - return NOTMUCH_STATUS_FILE_ERROR; >> - } >> - >> - if (! S_ISDIR (st.st_mode)) { >> - fprintf (stderr, "Error: %s is not a directory.\n", path); >> - return NOTMUCH_STATUS_FILE_ERROR; >> - } >> - >> - status = add_files_recursive (notmuch, path, state); >> - >> - return status; >> + return add_files_recursive (notmuch, path, state); >> } >> >> /* XXX: This should be merged with the add_files function since it >> -- >> 1.7.10 >> >> _______________________________________________ >> notmuch mailing list >> notmuch@notmuchmail.org >> http://notmuchmail.org/mailman/listinfo/notmuch