Hello.
Long story short. The GNU coreutils had (as released: have)
a autoconf test to detect and then work around an OpenBSD 7.2
(git commit as below: 7.7) bug regarding the update of a file's
change time after *chown(2) system calls.
The standard says
Upon successful completion, chown( ) shall mark for update the
last file status change timestamp of the file, except that if
owner is (uid_t)−1 and group is (gid_t)−1, the file status
change timestamp need not be marked for update.
The test they use(d) is
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/stat.h>
int
main (void)
{
struct stat st1, st2;
if (close (creat ("conftest.file", 0600))) return 1;
if (stat ("conftest.file", &st1)) return 2;
sleep (1);
if (chown ("conftest.file", st1.st_uid, st1.st_gid)) return 3;
if (stat ("conftest.file", &st2)) return 4;
if (st2.st_ctime <= st1.st_ctime) return 5;
}
It seems on bugs@ this issue did not come up shall the marc.info
search be correct.
--- Forwarded from Steffen Nurpmeso <[email protected]> ---
Author: Steffen Nurpmeso <[email protected]>
From: Steffen Nurpmeso <[email protected]>
To: Paul Eggert <[email protected]>
Cc: [email protected], [email protected], Alexey Gladkov
<[email protected]>, [email protected], Steffen Nurpmeso <[email protected]>
Subject: Re: bug#79433: kbd 2.9.0: build error (under fakeroot(1) environment)
Date: Mon, 22 Sep 2025 18:21:25 +0200
Message-ID: <20250922162125.A4LThpqh@steffen%sdaoden.eu>
Mail-Followup-To: Paul Eggert <[email protected]>, [email protected],
[email protected], Alexey Gladkov <[email protected]>, [email protected],
Steffen Nurpmeso <[email protected]>
Paul Eggert wrote in
<[email protected]>:
|On 2025-09-20 13:43, Steffen Nurpmeso wrote:
|>|Anyway, I'm looking into a Gnulib workaround for the fakeroot bug - and
|>|it is a bug, in that fakeroot chown does not conform to POSIX here. That
|>|should fix coreutils as well. It's not a bug in coreutils itself.
|>
|> Thank you!
|
|I pushed what I hope is a workaround for the fakeroot bug into Gnulib, \
|here:
|
|https://cgit.git.savannah.gnu.org/cgit/gnulib.git/commit/?id=162ce0b783b\
|a837e5e690a5bde812341853e109b
That is great! Yes.
|https://cgit.git.savannah.gnu.org/cgit/gnulib.git/commit/?id=12171837a9f\
|94971bb0c91de193543145ef68e65
|
|These patches also fix unlikely security races in OpenBSD.
|
|Fixes along these lines should appear in a future coreutils release.
|It's not clear whether this will be the next release (which is due
|shortly), but at least by the release after that.
|
|You should be able to test the fix now by doing something along these
|lines (but it may take a while):
|
|git clone https://git.savannah.gnu.org/git/coreutils.git
|cd coreutils
|./bootstrap
|git checkout -b testbranch
|git submodule foreach git pull origin master
|git commit -m 'build: update gnulib submodule to latest' gnulib
|./bootstrap --skip-po
|./configure
|make check
|
|Closing the coreutils bug report.
|
|PS. Any word on fixes for the actual bug here? The bug that's in
|fakeroot *ch(mod|own)* emulation?
I had Bcc'd him several times (maybe too often even), and now
place him in Cc. I have heard nothing back until now; i think the
"if user owns, and chowns to root, and EPERM happens, updating
timestamp" would not be too fragile; it, however, is only
a guess whether it would succeed without fakeroot, so...
By the way, was this bug ever reported to OpenBSD?
I do not see anything alike in since 2013?
https://marc.info/?l=openbsd-bug
I Bcc: [email protected] and ensure it gets posted (somehow), maybe
just a miss that chown() does not update the file change time.
--End of <[email protected]>
-- End forward <20250922162125.A4LThpqh@steffen%sdaoden.eu>
--steffen
|
|Der Kragenbaer, The moon bear,
|der holt sich munter he cheerfully and one by one
|einen nach dem anderen runter wa.ks himself off
|(By Robert Gernhardt)