From patchwork Sat Aug 30 04:06:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Vladimir A. Nazarenko" X-Patchwork-Id: 384430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6A4FE14008F for ; Sat, 30 Aug 2014 14:07:09 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=GYASEY3+vf5aO48W 2t0GeG4/47AXVS+DNlTOIaD/Ys+Nl4TI+X01kzLnHKuqpTDznl5PEOKwQVLR9cio CN9zb/R6J9IG5ZLrVubgnbL9yzGQL+kA5j6CpKrQrS63q4pcRZyf3nZd6HAepI7Y 9IxJr1Mb2wPg+sAirckA8yNdan4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; s=default; bh=img1ZZXyI9cAMb2sf9Pf+2 rp/jU=; b=ogro9iTlswqfuUnKW+JhnVaxL5WMD4VrG0PVG1DSUMqaoMSw/M7sx3 OSj808brz7QM0iNMDIjZukPVWDbexYKR2yGAkZqAZYWf0X6xb9wvPqSm8UW/PKQj Xy/bii/6n/MUkTcOypztexg6+2BxdDXljTimF2cRZdEt/+0Q8tZVU= Received: (qmail 7469 invoked by alias); 30 Aug 2014 04:07:02 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 7456 invoked by uid 89); 30 Aug 2014 04:07:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: forward2h.mail.yandex.net X-Yandex-Uniq: 15a1a92f-faf8-4374-a452-39df60147f98 Authentication-Results: smtp2h.mail.yandex.net; dkim=pass header.i=@ya.ru Message-ID: <54014DDC.7090005@ya.ru> Date: Sat, 30 Aug 2014 15:06:52 +1100 From: "Vladimir A. Nazarenko" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Roland McGrath CC: "GNU C. Library" , "Vladimir A. Nazarenko" Subject: Re: [PATCH] [BZ 17273] fix incorrect mount table entry parsing in __getmntent_r() References: <1409319124-31716-1-git-send-email-naszar@ya.ru> <20140829215816.D05202C3A30@topped-with-meat.com> In-Reply-To: <20140829215816.D05202C3A30@topped-with-meat.com> On 30.08.2014 08:58, Roland McGrath wrote: > Please write a test case. > Can I modify existing test or I must create new one? Is following patch OK? Can I resend fixed patch and test case as *one* patch? > > This should look like: > how about that: [BZ #17273] * misc/mntent_r.c (__getmntent_r): cut off trailing spaces and tabs from bufer before parsing fstab entry. * misc/tst-mntent.c(main): add test for mount entry with trailing spaces and tabs. diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c index 802b56e..f568ba8 100644 --- a/misc/tst-mntent.c +++ b/misc/tst-mntent.c @@ -73,7 +73,21 @@ main (int argc, char *argv[]) puts ("Error while reading written entry back in"); result = 1; } - } + + /*part III: test if entry with trailing whitespaces*/ + fputs("/foo\\040dir /bar\\040dir auto bind \t \n", fp); + + rewind (fp); + + mnt = getmntent(fp); + mnt = getmntent(fp); + if (mnt->mnt_freq != 0 || mnt->mnt_passno != 0) + { + printf("Error mnt_freq = %d and mnt_opts = %d, but zero expected\n", + mnt->mnt_freq, mnt->mnt_passno); + result = 1; + } + } return result; }