From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31745 invoked from network); 15 Sep 2021 23:39:10 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 15 Sep 2021 23:39:10 -0000 Received: (qmail 20188 invoked by uid 550); 15 Sep 2021 23:39:00 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 20323 invoked from network); 15 Sep 2021 22:12:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=PpRTtwNKYf470 /eB9LUE//oucAijyqrKFm/6Ggo77go=; b=WSnDkUlk9aIlPAUZzwB4BwJw8Mmdt hyhLmJA/MAGY1pDiroDbV9jRVFpJiS40sX8+i+EtrRqGACHdjdZhu9yIu8fkkYWE 5L9uuDmGUxyw67CT80lUVohVtRouo1eXtCGyvr854ki1S2f/aXc6S5vKvuran33T Ph3NglgEPUMGLIrxa1kyO0/9OzTgh2/U3rSNydZD+qs1G2uG8Zg9W6HXdBBuSMJD ich1dm7W34tDW4f1fzpPucyuqA7H+eAKQxG3X5IgQbrm1U5YFn8UVNwFSaQJvKGk 8s1ulP9uKRhWOXHMGcWf9Xy1ZMSuGOrU5wJUWeaZUGNIwjrL7qU56SzCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=PpRTtwNKYf470/eB9LUE//oucAijyqrKFm/6Ggo77go=; b=WJOslLOR U1bD2J9wSvHZcGu1U/U/9GqMH2MjLklvxin3SBV2zL7x6a7sxs0X3EsAJSh07Yga n57KxgUfzox4+ty3Ycz2rXGn4Ts/Uw9pGpZxZQQWdLj4y7WMAj76sKD3+D5L5gPD nDu3jJYduOMxqfpaznT5SiIHODuEDQ+or5ZQSKfSy8FxY3WwL97pin0tjAaNGX37 H0IH7We0oYd3ln6cZJWoWvkk7JH8fPYAUFHiiZrs/FH/8dhih6BZ+Makpejy2HwI a+TdOyjNVU9QztpWGu7oquJtegypSjGtgORF3NTTapmw6JwAbyW9wn6MrdRSGNET CQkeSGHXppWKUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudehfedgtdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhi sheqnecuggftrfgrthhtvghrnhepgfefudekvdelieelledufeevheeglefggedvudejvd dtffeuueevffehleejkedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepqhihlhhishhsseigvddvtddrqhihlhhishhsrdhnvght X-ME-Proxy: From: Alyssa Ross To: musl@lists.openwall.com Cc: =?UTF-8?q?=C3=89rico=20Nogueira?= , Rich Felker Date: Wed, 15 Sep 2021 22:11:54 +0000 Message-Id: <20210915221155.3977763-3-hi@alyssa.is> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210915221155.3977763-1-hi@alyssa.is> References: <20210915221155.3977763-1-hi@alyssa.is> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH libc-test v2 2/3] functional: add mntent test for single-field line Glibc only requires a single field to be present in an fstab line to parse it, and will initialize all other string fields to the empty string. This test checks for that behaviour. --- I'm providing this test as a seperate patch to make it easy to pass on this test while still accepting the rest, because I'm not sure whether it's a good thing or not for Musl to allow fstab lines like this, even though Glibc does. src/functional/mntent.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/functional/mntent.c b/src/functional/mntent.c index 59d816a..caa7d33 100644 --- a/src/functional/mntent.c +++ b/src/functional/mntent.c @@ -31,6 +31,18 @@ void test_getmntent_empty(void) ASSERT(endmntent(f) == 1); } +void test_getmntent_short(void) +{ + char fstab[] = "1\n"; + FILE *f = fmemopen((void *)fstab, sizeof fstab - 1, "r"); + if (!f) ERR("fmemopen"); + struct mntent *m = getmntent(f); + ASSERT(m); + ASSERT(!strcmp(m->mnt_fsname, "1")); + ASSERT(!*m->mnt_dir); + ASSERT(endmntent(f) == 1); +} + void test_getmntent(void) { // Checks that the fifth and sixth fields default to 0. @@ -71,6 +83,7 @@ void test_getmntent_r(void) int main(void) { test_getmntent_empty(); + test_getmntent_short(); test_getmntent(); test_getmntent_r(); } -- 2.32.0