Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 683104 - sys-apps/smartmontools: Merging new version doesn't update existing drivedb.h
Summary: sys-apps/smartmontools: Merging new version doesn't update existing drivedb.h
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2019-04-11 16:16 UTC by Will Simoneau
Modified: 2022-03-12 03:45 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
patch for sys-apps/smartmontools-7.0-r1 ebuild (smartmontools-7.0-r1_update-drivedb-using-timestamp.patch,2.29 KB, patch)
2019-04-11 16:16 UTC, Will Simoneau
Details | Diff
patch against sys-apps/smartmontools-7.2.ebuild (smartmontools-7.2-update-drivedb-intelligently.patch,4.82 KB, patch)
2021-01-26 16:45 UTC, Will Simoneau
Details | Diff
patch for sys-apps/smartmontools-7.2 (smartmontools-7.2-update-drivedb-intelligently.patch,5.02 KB, patch)
2021-01-26 17:23 UTC, Will Simoneau
Details | Diff
smartmontools-7.3-r1.patch (file_683104.txt,16.85 KB, patch)
2022-03-12 03:45 UTC, Sam James
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will Simoneau 2019-04-11 16:16:54 UTC
Created attachment 572452 [details, diff]
patch for sys-apps/smartmontools-7.0-r1 ebuild

If USE=-update_drivedb, then the /var/db/smartmontools/drivedb.h first installed on the system never gets updated by subsequent merges of sys-apps/smartmontools:

# genlop smartmontools | tail
     Tue Dec  5 05:43:39 2017 >>> sys-apps/smartmontools-6.6
     Fri Dec 29 00:01:01 2017 >>> sys-apps/smartmontools-6.6
     Thu Jan 25 02:16:04 2018 >>> sys-apps/smartmontools-6.6
     Thu Jan 25 04:48:47 2018 >>> sys-apps/smartmontools-6.6
     Tue Mar 27 04:05:44 2018 >>> sys-apps/smartmontools-6.6
     Tue Mar 27 07:17:10 2018 >>> sys-apps/smartmontools-6.6
     Tue Apr  9 09:30:51 2019 >>> sys-apps/smartmontools-7.0-r1
# ll /var/db/smartmontools/drivedb.h                     
-rw-r--r-- 1 root root 176K Dec  5  2017 /var/db/smartmontools/drivedb.h

The ebuild prints a warning message that recommends manually updating /var/db/smartmontools/drivedb.h. However, this is not a maintainable solution from a sysadmin's POV. On top of that, the warning message itself is easy to miss.

If USE=update_drivedb, sys-apps/smartmontools-7.0-r1.ebuild installs a monthly cron job that runs /usr/sbin/update-smart-drivedb. The cron job is not necessarily desirable, so just setting the USE-flag is not a solution.

I propose changing the logic in the ebuild to update /var/db/smartmontools/drivedb.h if the timestamp of the shipped file is newer than the existing file. This should result in reasonable behavior regardless of the state of the 'update_drivedb' USE-flag.
Comment 1 Lars Wendler (Polynomial-C) gentoo-dev 2019-04-11 16:31:04 UTC
We chose this solution because we cannot add a file to the package database that is supposed to change between package upgrades. This would lead to incorrect file checksums in the package database.
Comment 2 Will Simoneau 2019-04-11 16:50:50 UTC
(In reply to Lars Wendler (Polynomial-C) from comment #1)
> We chose this solution because we cannot add a file to the package database
> that is supposed to change between package upgrades. This would lead to
> incorrect file checksums in the package database.

The patch was written with that existing behavior in mind and shouldn't break it, unless I've misunderstood something.
Comment 3 Lars Wendler (Polynomial-C) gentoo-dev 2021-01-02 20:27:46 UTC
Can you please rebase your patch against sys-apps/smartmontools-7.2?
Comment 4 Will Simoneau 2021-01-26 16:45:59 UTC
Created attachment 684732 [details, diff]
patch against sys-apps/smartmontools-7.2.ebuild

Here's an improved version of the patch rebased against 7.2. If there's a better/canned way to do this without losing any corner-case coverage, please let me know.
Comment 5 Will Simoneau 2021-01-26 17:23:31 UTC
Created attachment 684816 [details, diff]
patch for sys-apps/smartmontools-7.2

The writability check in the previous patch was not implemented correctly. Here's a corrected version of the patch which should hopefully work as intended.

Apologies for the mistake and additional noise.
Comment 6 Pacho Ramos gentoo-dev 2021-07-07 06:48:54 UTC
I would also not print the warning is the cron file is installed
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-03-12 03:45:47 UTC
Created attachment 766807 [details, diff]
smartmontools-7.3-r1.patch

Attaching the patch from https://github.com/gentoo/gentoo/pull/24394. I'm not going with this (we're going to do CONFIG_PROTECT instead), but wanted to post it here for posterity.