From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id A5A0420C40 for ; Mon, 19 Aug 2024 16:46:39 +0200 (CEST) Received: (qmail 21598 invoked by uid 550); 19 Aug 2024 14:46:33 -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 21556 invoked from network); 19 Aug 2024 14:46:32 -0000 ARC-Seal: i=1; a=rsa-sha256; t=1724078784; cv=none; d=strato.com; s=strato-dkim-0002; b=Lt4Q/T5IagqLVWa1FrY0E7kAx0+9aHmZljF4juvUYN4ZyArn1gGUzV0xAa6m/FAXUE fMJtR7wfFcjvSxtlWjvGPoy11K9sU9BKXmSZyTH1MBt6+P4p/a4eRO0iCMoeDWcinCt0 lDBV8Y5kCnBvYRNPDuRrw6gqdaP7LotwdWqHyMrMOYeo0sqtZG6sHtGsQw8TtBCUYKN/ Nopyjya35QmjQAVikdhs4KqhL4T50Yh03VmfVgD+01rfPYMrRYOf5g8rEdk8utx5UVDF iV6Hfg1Tyg8CI+APvcnNrGfV9o17bIw03q7b9LqgB6TZavBJajmslqgIb5PU7vGdeCNY ylVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1724078784; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=BwIewaZz7G3sCNC5lAdlYz6fvfiFCfv1v7P6/EWGkiw=; b=EueR0u9CwZq72dMZTX8SzDzqrFUBMcs+R0a+LDWyo0+xD1gAlu9gTbhPMYez6ZXfgm l372g5iCxgknwKLHamYtj0mHfVIUpdey24yNdcKdjlfQHjCQ+qoF/WlK6C201G23x2Yb 38w5yhM1ECg5yXq4V0sqOpJT3aEum2CUywQDgFrsLnnqJrv9wJMY8pS7w6AKHc0lZjRj siiy9SLwoFDBpGdUBkJ3eWmFNz+v5WW2co9EBeabtWeQkQmXXMuUjSDEBee7FSYwPMuD r4lelqNM2yH4CaJpHXtHSKoSyld0J36JaPXlH9xipb6C8ZE426HQsh0uoxVauxb4uiXl 27tA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1724078784; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=BwIewaZz7G3sCNC5lAdlYz6fvfiFCfv1v7P6/EWGkiw=; b=pwsPVH9yq+be2ieSyfNQ045J2gxI+FhIu8tJES8NFjL3g5I5lkTXSlGJdoCUSp5m13 MhD9ioRKhA6sNPE3rtMfQ2quZonSSB+hLv5hm1yBtHqVfWT05VI3vasSgleKfvqrJDVF a/WW3HqJ4uEzHxWfcWDp7C8lJdYmYoalBjn2IdtzrEOo6EG33dQHUo4DP2oc+em+4Mfh mZZ26kuTp58Fjp4rOyQSI1oupQP3VDcrgGIkG4oBhtRluUqN1xxe6RaMLiKKqlkpKrK7 xoE8mXWpNAMHP/P1rZ5FstfFIuJNTT6cCrJtgLisvLWQTjOjTLSweSr7/bRwlFIIgGnE BODA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1724078784; s=strato-dkim-0003; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=BwIewaZz7G3sCNC5lAdlYz6fvfiFCfv1v7P6/EWGkiw=; b=btz7UtdPLZPBG5b7HotU7k5+hXlqgXCxM2iEu5+YZ2rBe+7DxgwBNPazU9G2fmgC1h 4DTV1hH+nxD25hQ091AQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqjuaRzupfC51R9Qla2ITEhGePITO" From: Bruno Haible To: musl@lists.openwall.com Date: Mon, 19 Aug 2024 16:46:23 +0200 Message-ID: <7665137.oDFzTOozpa@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: [musl] hasmntopt function returns non-NULL when it shouldn't Hi, The hasmntopt() function is documented in https://www.gnu.org/software/libc/manual/html_node/mtab.html and https://man7.org/linux/man-pages/man3/hasmntopt.3.html The implementation of this function in musl libc 1.2.5 returns a non-NULL value also for some options that do *not* occur in the mount options string. How to reproduce: =============================== has.c =============================== #include #include #include int main () { char options[] = "rw,nosuid,nodev,noexec,noatime,size=5120k,inode64"; struct mntent me; me.mnt_opts = options; assert (hasmntopt (&me, "ro") == NULL); assert (hasmntopt (&me, "rw") == options + 0); assert (hasmntopt (&me, "atime") == NULL); assert (hasmntopt (&me, "no") == NULL); assert (hasmntopt (&me, "noatime") == options + 23); assert (hasmntopt (&me, "size") == options + 31); assert (hasmntopt (&me, "size=512") == NULL); assert (hasmntopt (&me, "size=5120k") == options + 31); assert (hasmntopt (&me, "inode64") == options + 42); return 0; } ===================================================================== $ gcc -Wall has.c $ ./a.out Expected result: No assertion failure. Like on glibc. Actual result: Assertion failed: hasmntopt (&me, "atime") == NULL (has.c: main: 14) The mount options "atime" and "noatime" are pretty much the opposite of each other (see https://man7.org/linux/man-pages/man8/mount.8.html). Therefore in a program that tests for the "atime" option, it is wrong to return the equivalent of true when the options string contains "noatime", not "atime". Bruno