Bug 266185 - sysutils/smartmontools update-smart-drivedb ends with sed failure
Summary: sysutils/smartmontools update-smart-drivedb ends with sed failure
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Oleksii Samorukov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-03 00:16 UTC by knezour
Modified: 2023-06-05 20:16 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (samm)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description knezour 2022-09-03 00:16:05 UTC
update-smart-drivedb --no-verify
sed: 1: "/^[ {]*"VERSION: *[^"]* ...": extra characters at the end of q command

I guess that it is some GNU sed whatever on line 545 in get_db_version() function, quick googling returned that semicolon may be cure and really, changing

  x=$(sed -n '/^[ {]*"VERSION: *[^"]*"/{s,^[ {]*"VERSION: \([1-9][./0-9]* [^"]*\)".*$,\1,p;q}' "$1") \

to

  x=$(sed -n '/^[ {]*"VERSION: *[^"]*"/{s,^[ {]*"VERSION: \([1-9][./0-9]* [^"]*\)".*$,\1,p;q;SEMICOLON ADDED HERE}' "$1") \

resulted with

/usr/local/share/smartmontools/drivedb.h 7.3/5319 updated to 7.3/5405 (NOT VERIFIED)

I have no clue if this is right solution or ugly patch :)
Comment 1 Jim D. 2023-02-27 16:27:57 UTC
2023-02-27 Encountered the same problem. Applied the suggested ";" patch. Re-ran update-smart-drivedb with no errors. This confirms the suggested patch. Updated to 7.3/5440.

smartctl --version
smartctl 7.3 2022-02-28 r5338 [FreeBSD 12.3-RELEASE-p9 amd64] (local build)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-06-05 20:15:13 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bcfaccea10e8c273ae693a051a75b53c3a4147ee

commit bcfaccea10e8c273ae693a051a75b53c3a4147ee
Author:     Oleksii Samorukov <samm@FreeBSD.org>
AuthorDate: 2023-06-05 20:12:23 +0000
Commit:     Oleksii Samorukov <samm@FreeBSD.org>
CommitDate: 2023-06-05 20:14:24 +0000

    sysutils/smartmontools: fix update-drive-db and hanlde nda(4) devices

    PR: 269535, 266185

 sysutils/smartmontools/Makefile                    |  1 +
 .../files/patch-update-smart-drivedb.in (new)      | 56 ++++++++++++++++++++++
 sysutils/smartmontools/files/smart.in              |  2 +-
 3 files changed, 58 insertions(+), 1 deletion(-)
Comment 3 Oleksii Samorukov freebsd_committer freebsd_triage 2023-06-05 20:16:32 UTC
Thank you, fixed