Bug 230867

Summary: sysutils/smartmontools: error: use of undeclared identifier 'NVME_CMD_SET_OPC'
Product: Ports & Packages Reporter: O. Hartmann <ohartmann>
Component: Individual Port(s)Assignee: Fernando Apesteguía <fernape>
Status: Closed FIXED    
Severity: Affects Only Me CC: KOT, fernape, ndowens04, samm, sbruno, swills
Priority: --- Flags: bugzilla: maintainer-feedback? (samm)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Fix for current none

Description O. Hartmann 2018-08-24 17:22:10 UTC
On recent 12-CURRENT (FreeBSD 12.0-ALPHA3 #450 r338290: Fri Aug 24 07:37:10 CEST 2018 amd64; ports tree at Revision: 477934), compilation of port sysutils/smartmontools fail with the error shown below:

[...]
c++ -DHAVE_CONFIG_H -I.  -DBUILD_INFO='"(local build)"' -DSMARTMONTOOLS_SYSCONFDIR='"/usr/local/etc"' -DSMARTMONTOOLS_SMARTDSCRIPTDIR='"/usr/local/etc"' -DSMARTMONTOOLS_DRIVEDBDIR='"/usr/local/share/smartmontools"'        -O2 -pipe -fstack-protector -fno-strict-aliasing  -Wall -W -c -o smartd.o smartd.cpp
/bin/sh ./config.status --file=update-smart-drivedb
In file included from os_freebsd.cpp:45:
./atacmds.h:96:9: warning: 'ATA_WRITE_LOG_EXT' macro redefined [-Wmacro-redefined]
#define ATA_WRITE_LOG_EXT               0x3F
        ^
/usr/include/sys/ata.h:387:9: note: previous definition is here
#define ATA_WRITE_LOG_EXT               0x3f
        ^
os_freebsd.cpp:527:10: error: no member named 'opc_fuse' in 'nvme_command'
  pt.cmd.opc_fuse = NVME_CMD_SET_OPC(in.opcode);
  ~~~~~~ ^
/bin/sh ./config.status --file=smartd_warning.sh
os_freebsd.cpp:527:21: error: use of undeclared identifier 'NVME_CMD_SET_OPC'
  pt.cmd.opc_fuse = NVME_CMD_SET_OPC(in.opcode);
Comment 1 Fernando Apesteguía freebsd_committer freebsd_triage 2018-08-25 17:38:40 UTC
(In reply to O. Hartmann from comment #0)
It builds fine in not so recent 12-CURRENT r332309.

Responsible commit is most likely r338182 (https://svnweb.freebsd.org/base/head/sys/dev/nvme/nvme.h?r1=334200&r2=338182)
Comment 2 Fernando Apesteguía freebsd_committer freebsd_triage 2018-08-25 18:18:38 UTC
Created attachment 196536 [details]
Fix for current

Trying to fix the build in 12-CURRENT.
Comment 3 Fernando Apesteguía freebsd_committer freebsd_triage 2018-08-25 18:21:35 UTC
Would you try this patch? I don't have a 12-CURRENT as updated as yours, but this builds in {10.4,11.2}{amd64,i386} and 12i386@332309

The  most recent CURRENT has (again) opc and fuse as two separate fields so it should build.
Comment 4 O. Hartmann 2018-08-25 18:36:28 UTC
(In reply to Fernando Apesteguía from comment #3)
The patch of yours builds the port on FreeBSD 12.0-ALPHA3 #458 r338317: Sat Aug 25 18:58:28 CEST 2018 amd64.

Thank you very much.

oh
Comment 5 Nathan 2018-08-28 22:47:29 UTC
Confirming patch does work with 12.0-ALPHA3 FreeBSD 12.0-ALPHA3 #0 r338331
Comment 6 Fernando Apesteguía freebsd_committer freebsd_triage 2018-08-29 15:29:13 UTC
Thanks for the feedback. I'll commit it ASAP
Comment 7 Dmitry Afanasiev 2018-08-30 07:36:45 UTC
Patch works for me too (12.0-ALPHA3 r338342).
Thanks you!
Comment 8 commit-hook freebsd_committer freebsd_triage 2018-09-07 15:45:47 UTC
A commit references this bug:

Author: fernape
Date: Fri Sep  7 15:45:15 UTC 2018
New revision: 479196
URL: https://svnweb.freebsd.org/changeset/ports/479196

Log:
  sysutils/smartmontools: unbreak in 12-CURRENT

  Between __FreeBSD_version 1200058 and 1200081 fields opc and fuse of
  struct nvme_command (sys/dev/nvme/nvme.h) where merged under opc_fuse, but
  in r338182 this change was undone and this port broke.

  Update patch to fix it so it works regardless of the revision we check out.

  PR:	230867
  Submitted by:	ohartmann@walstatt.org
  Approved by:	tcberner (mentor), maintainer (timeout, 2 weeks)
  Differential Revision:	https://reviews.freebsd.org/D16908

Changes:
  head/sysutils/smartmontools/files/patch-os__freebsd.cpp
Comment 9 Fernando Apesteguía freebsd_committer freebsd_triage 2018-09-07 15:46:46 UTC
Committed,

Thanks for reporting and testing.