From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 291B46DE10E8 for ; Sat, 26 Nov 2016 01:20:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.285 X-Spam-Level: X-Spam-Status: No, score=0.285 tagged_above=-999 required=5 tests=[AWL=0.305, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GPqo4XpIwQ2o for ; Sat, 26 Nov 2016 01:20:16 -0800 (PST) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id 8794F6DE1016 for ; Sat, 26 Nov 2016 01:20:15 -0800 (PST) Received: by mail-lf0-f68.google.com with SMTP id o141so5063129lff.1 for ; Sat, 26 Nov 2016 01:20:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pvlW9Mod01qgRO9yiYdMCo6+fUdb/16kDmSiqAWI6KI=; b=B+uxUm+4O93MweeiUsl8leG2Bfwcchp32WOEXUonZhrxa6QfwT9iMZkXB/RsHXW5hN Degsfy9AGEKfWInONgarUYmx0aYp/O0AJuZDVTDwGSQWRk9ZqBqAeJvFOiNvxXqls79y HzQdXzCoQHDb/xfvZPkVcqXsk6ekilOyJfjbpVgRSdgam8p0QrmR3Bk6gJn0MA6k4tHM 9tpAXL1UHBHM56AJnUo1eM2Uj3ES0LOlcAVMGg4Gv95Z3Vg1mpdOsuc/hHNdZmGbN1P9 RMVFUoj3xe/4doGh4dzswRZlVfgd4q+Ka+vmZKDQQAfqy0oT3Y6IWYhwM54rJmABeRSn oepA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pvlW9Mod01qgRO9yiYdMCo6+fUdb/16kDmSiqAWI6KI=; b=kJCjFZUYGaAn5Aouf92900ozqt2NFjbqz0moTg5Cn6GY89PECStjEG45DsUrzHto9v 0mGnWSgXPtNe43UvV+Tzon8MVcT/nmpAV0w0mM91k13FiS3S3Lm2ZSvVwbtsQeC+c6sA x4SXbJbq/kxStrHSZT77CQ3Ilxn4wa59E7wf4nGivyoCSzmwX2tBbCoOlRlOeirdoYfv RqBaTwok0HeX9/8roNo4Rv7w+ZWnvDE6gTOGoEEp3Oh9/nqEmd7Kmx3ykuPrDL+4wpQ7 3K21j20NG9AygrZ1p/qckqkcKNIhSULzoQ2sVhpnb47OfazvSnHiNtjryL1VYZn6CAhc Cwuw== X-Gm-Message-State: AKaTC01TLvvNqqXNlzqh2x8pHD5bRQcdHfYoiKLT01cFrfbn4pvbEnCng/bpV4hFZYjjxA== X-Received: by 10.46.74.26 with SMTP id x26mr2189747lja.51.1480152013787; Sat, 26 Nov 2016 01:20:13 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c368-70.dhcp.inet.fi. [88.195.104.70]) by smtp.gmail.com with ESMTPSA id 23sm10356675ljf.48.2016.11.26.01.20.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Nov 2016 01:20:13 -0800 (PST) From: Jani Nikula To: David Bremner , notmuch@notmuchmail.org Subject: [PATCH] test: check the handling of files vanishing between scandir and indexing Date: Sat, 26 Nov 2016 11:18:18 +0200 Message-Id: <1480151898-17278-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <87shqer46p.fsf@nikula.org> References: <87shqer46p.fsf@nikula.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sat, 26 Nov 2016 09:20:17 -0000 Add a file for scandir to find, but use gdb to remove it before it gets indexed. --- The ugly part is that this should require gdb as external dep... but we shouldn't skip all of T050-new.sh if gdb isn't there. I'm in a hurry, any good ideas? --- test/T050-new.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/T050-new.sh b/test/T050-new.sh index beeb574a3b30..072b63a148cc 100755 --- a/test/T050-new.sh +++ b/test/T050-new.sh @@ -298,4 +298,34 @@ output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' ) chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.${db_ending} test_expect_equal "$output" "A Xapian exception occurred opening database" + +test_begin_subtest "Handle files vanishing between scandir and add_file" + +# A file for scandir to find. It won't get indexed, so can be empty. +touch ${MAIL_DIR}/vanish + +# Breakpoint to remove the file before indexing +cat < notmuch-new-vanish.gdb +set breakpoint pending on +set logging file notmuch-new-vanish-gdb.log +set logging on +break add_file +commands +shell rm -f ${MAIL_DIR}/vanish +continue +end +run +EOF + +gdb --batch-silent --return-child-result -x notmuch-new-vanish.gdb \ + --args notmuch new 2>OUTPUT 1>/dev/null +echo "exit status: $?" >> OUTPUT +cat < EXPECTED +Unexpected error with file ${MAIL_DIR}/vanish +add_file: Something went wrong trying to read or write a file +Error opening ${MAIL_DIR}/vanish: No such file or directory +exit status: 75 +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done -- 2.1.4