From nobody Mon Oct 13 09:27:20 2025 X-Original-To: current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4clX7N1jkrz6CFkm; Mon, 13 Oct 2025 09:27:28 +0000 (UTC) (envelope-from ivy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4clX7N12hcz3qf1; Mon, 13 Oct 2025 09:27:28 +0000 (UTC) (envelope-from ivy@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760347648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lwQFiHFBAvRadYRKmNTJ6sKCzSqUlju3lfKtRcaCepQ=; b=Fl5+YJRaFjnoaX9zBjRc8Tc86thKPV4X8pGf7ecdz9yCpFGwDJQOckAcl+EiOwXkh8ZS5F V8ENOcFVfw4LKHbx98Hwn98lxe3ZO3z1CvhvktIJW9OJCL1UavkTuGhOhhp8lELIjVywaG d67zkXqoBndp9hW9bN+ZRInoAP3K2QVQhfM0rSD6x8kUL85UKhlFuLdYz/wybHCgHRqm6V nhtd6RkryPQN1POT3c5UhFEiIdtQHrITiYlZa09EczPb2vQpavUlku7yKZH5b8fGYoYXYQ zVZ4TrFMQ65h+LCPk3t9EcsMf83VpwceZmudvhhzBthOsL8Lczmk5v8YU+mkNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1760347648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lwQFiHFBAvRadYRKmNTJ6sKCzSqUlju3lfKtRcaCepQ=; b=Medm8/cx0xFONi7J/vYWfssZJMvDmVQQwFVf2fCNUhCSM4C8XD6R1Z09Vks0dr50Bz505B O2T6Dint5HDRgK3hreWkj9TfwSJAMQjLIwN/TGd0f+bhPYsPByOWtkrjWfjDZU4DPRMuFi 0LWUk58socxyCh/VfTXWrzypTEyxN+hgFAONrIc40rzOKBMh0lzE86TptJg0O0j4gTtONW JPFgpKfPEAs+60XxwgLBOkctBHOEIk3Pm+CLDQnx3a8Fwo8+VJK+6WUUqJDhKJ+uJXS7nN yVXpXQttaNDDDQFRvOrkm+HjKz/a0Bjy2YGRACJOhIsQWukttFtPFmEeCdx0og== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1760347648; a=rsa-sha256; cv=none; b=By7BocHSivnTxfPUKwZuIGLb/TNcuHnPDcYr+ixInIQhcIm667tOwMn9J+bsah4qBG5qKo LNyW+fT6T+8SUEj5dcW+AJTVm2XW16leKQFFwKPErS01kHpMJ4PRWJV7SUSoFdDANFBcC0 ajv8h8zGtYWj8lBKLC0WpeSU5kP1lliA+iM87cTZgGzAg50K1SqLYoPJJ5t0Aq7sRX6Co1 RTo7I0FrHPx1yfMIZ2umRdc59d5qFjI/bmpFAqOq0+LWAtQfzW3/+1dLnuadE5iYYQoEX1 VQU+PGGE7AHQN+A2ffkmuTpeMqaKIqOfuMDMnTeLRA0H8fc42CV+0WWBjKkR4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from amaryllis.le-fay.org (amaryllis.le-fay.org [IPv6:2a00:1098:6b:400::9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: ivy/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4clX7M4yWWz1WB; Mon, 13 Oct 2025 09:27:27 +0000 (UTC) (envelope-from ivy@freebsd.org) Date: Mon, 13 Oct 2025 10:27:20 +0100 From: Lexi Winter To: Olivier Certner Cc: fs@freebsd.org, current@freebsd.org Subject: Re: openat("./...", O_CREAT) fails even though the directory exists Message-ID: Mail-Followup-To: Olivier Certner , fs@freebsd.org, current@freebsd.org References: <2507674.THHZn3L5Ee@ravel> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fCeECQ7M9wJ2QMlP" Content-Disposition: inline In-Reply-To: <2507674.THHZn3L5Ee@ravel> --fCeECQ7M9wJ2QMlP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Olivier Certner wrote in <2507674.THHZn3L5Ee@ravel>: > > 44288: fstatat(AT_FDCWD,"./df59D8I2px044288",0xecbda905210,0x0) ERR#2 '= No such file or directory' > > 44288: fstatat(AT_FDCWD,".",{ mode=3Ddrwxr-xr-x ,inode=3D129826,size=3D= 2,blksize=3D131072 },AT_SYMLINK_NOFOLLOW) =3D 0 (0x0) > > 44288: geteuid() =3D 0 (0x0) > > 44288: fstatat(AT_FDCWD,".",{ mode=3Ddrwxr-xr-x ,inode=3D129826,size=3D= 2,blksize=3D131072 },0x0) =3D 0 (0x0) > > 44288: openat(AT_FDCWD,"./df59D8I2px044288",O_RDWR|O_CREAT|O_EXCL,0600)= ERR#2 'No such file or directory' > >=20 > > this doesn't make sense to me: since "." exists, how can openat() return > > ENOENT here? >=20 > How do you come to this conclusion? In what you pasted above, and in > the full traces, the openat(AT_FDCWD) fails on the same file > ("./df59D8I2px044288") on which the fstatat(AT_FDCWD) just above > already failed with ENOENT. So the most plausible explanation is that > that file just does not exist at this point. the file should not exist, and this is expected. the truss output shows: - "./df59D8I2px044288" does not exist: fstatat() returns ENOENT. this is expected, because this is a new file we are trying to create (if it existed, this would be a different error). - "." exists: fstatat(AT_FDCWD, ".") returns 0 - trying to create "./df59D8I2px044288", which doesn't exist, with O_CREAT|O_EXCL fails with ENOENT. the issue is in the last item: since this file doesn't exist, and we're opening it with O_CREAT, how can this fail? after some more debugging, i think what's going on here is that pkg(8) is deleting and recreating /var/spool/mqueue on upgrade, which means smmsp's open fd to that directory is no longer valid, and therefore openat() returns this unusual error. i am not sure how to fix this, but the impact is that upgrading the FreeBSD-sendmail package breaks sendmail on a running system, so we need to fix this somehow for 15.0. i suspect the fix will be in pkgbase somewhere: for example, we could restart sendmail on upgrade, or tell the user to do that. --fCeECQ7M9wJ2QMlP Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQSyjTg96lp3RifySyn1nT63mIK/YAUCaOzF+AAKCRD1nT63mIK/ YGwNAP4nSy+NXEu+4RvsULeIXBTMPCqnXPm5JwCpOrL7Tev2cQD8DQ2XER2NRNHL 5fy8Eg7bCW/1gpdkF3w4YcAJYdXDZAQ= =AfG3 -----END PGP SIGNATURE----- --fCeECQ7M9wJ2QMlP--