]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: fix utcnow deprecation warning in xfs_scrub_all.py
authorChristian Kujau <lists@nerdbynature.de>
Tue, 26 Aug 2025 16:06:26 +0000 (18:06 +0200)
committerAndrey Albershteyn <aalbersh@kernel.org>
Mon, 8 Sep 2025 11:25:52 +0000 (13:25 +0200)
commit9c83bdfeef71dbba32440ff7f3f63b295425ad35
treeccf6b6d3a080e82209c69055961f66e0fb871d06
parent9bd2142c5e354c9c490e819f017fa95b6b7f661f
xfsprogs: fix utcnow deprecation warning in xfs_scrub_all.py

Running xfs_scrub_all under Python 3.13.5 prints the following warning:

----------------------------------------------
$ /usr/sbin/xfs_scrub_all --auto-media-scan-stamp \
   /var/lib/xfsprogs/xfs_scrub_all_media.stamp \
   --auto-media-scan-interval 1d
/usr/sbin/xfs_scrub_all:489: DeprecationWarning:
datetime.datetime.utcnow() is deprecated and scheduled for removal in a
future version. Use timezone-aware objects to represent datetimes in UTC:
datetime.datetime.now(datetime.UTC).
  dt = datetime.utcnow()
Automatically enabling file data scrub.
----------------------------------------------

Python documentation for context:
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Fix this by using datetime.now() instead.

NB: Debian/13 ships Python 3.13.5 and has a xfs_scrub_all.timer active,
I'd assume that many systems will have that warning now in their logs :-)

Signed-off-by: Christian Kujau <lists@nerdbynature.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
scrub/xfs_scrub_all.py.in