RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1727393 - lshw SQLite dump fails unless using absolute path
Summary: lshw SQLite dump fails unless using absolute path
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: lshw
Version: 8.1
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: 8.3
Assignee: lijiang
QA Contact: Jeff Bastian
URL:
Whiteboard:
Depends On: 1702735
Blocks: 1674330
TreeView+ depends on / blocked
 
Reported: 2019-07-05 20:36 UTC by Jeff Bastian
Modified: 2020-11-04 01:59 UTC (History)
2 users (show)

Fixed In Version: lshw-B.02.19.2-2.el8
Doc Type: No Doc Update
Doc Text:
Clone Of: 1702735
Environment:
Last Closed: 2020-11-04 01:57:49 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4533 0 None None None 2020-11-04 01:58:06 UTC

Description Jeff Bastian 2019-07-05 20:36:54 UTC
+++ This bug was initially created as a clone of Bug #1702735 +++

Description of problem:
lshw fails to create a SQLite database unless you give it a full and absolute path to the dump file.

[root@localhost ~]# lshw -dump lshw.sql >/dev/null
                            
[root@localhost ~]# file lshw.sql
lshw.sql: cannot open `lshw.sql' (No such file or directory)

[root@localhost ~]# lshw -dump /root/lshw.sql >/dev/null
                            
[root@localhost ~]# file lshw.sql
lshw.sql: SQLite 3.x database, last written using SQLite version 3026000


Version-Release number of selected component (if applicable):
lshw-B.02.18-21.el8

How reproducible:
always

Steps to Reproduce:
1. lshw -dump lshw.sql

Actual results:
lshw fails to create a SQLite database file named lshw.sql

Expected results:
The output is saved to a SQLite database named lshw.sql

Additional info:
lshw is trying to create the database dump in /sys/bus/pnp/devices according to strace:

[root@localhost ~]# strace -e trace=file -o lshw.trace lshw -dump lshw.sql >/dev/null

[root@localhost ~]# grep lshw.sql lshw.trace
execve("/usr/sbin/lshw", ["lshw", "-dump", "lshw.sql"], 0x7ffdf2697a60 /* 42 vars */) = 0
lstat("lshw.sql", 0x7ffe34364af0)       = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/sys/bus/pnp/devices/lshw.sql", O_RDWR|O_CREAT|O_CLOEXEC, 0644) = -1 EACCES (Permission denied)
openat(AT_FDCWD, "/sys/bus/pnp/devices/lshw.sql", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Comment 2 lijiang 2020-02-11 03:31:16 UTC
This is too late for rhel8.2, I would move it to rhel8.3. Thanks.

Comment 8 Jeff Bastian 2020-08-05 22:11:42 UTC
Verified with lshw-B.02.19.2-2.el8

[root@intel-chiefriver-03 ~]# rpm -q lshw
lshw-B.02.19.2-2.el8.x86_64

[root@intel-chiefriver-03 ~]# ls lshw*
ls: cannot access 'lshw*': No such file or directory

[root@intel-chiefriver-03 ~]# lshw -dump lshw.sql >/dev/null

[root@intel-chiefriver-03 ~]# ls lshw*
lshw.sql

[root@intel-chiefriver-03 ~]# file lshw.sql 
lshw.sql: SQLite 3.x database, last written using SQLite version 3026000

[root@intel-chiefriver-03 ~]# sqlite3 -cmd .dump lshw.sql
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE META(key TEXT PRIMARY KEY COLLATE NOCASE, value BLOB);
INSERT INTO META VALUES('schema',1.0);
INSERT INTO META VALUES('application','org.ezix.lshw');
INSERT INTO META VALUES('creator','lshw/B.02.19.2');
INSERT INTO META VALUES('OS','Red Hat Enterprise Linux release 8.3 Beta (Ootpa) ; Linux 4.18.0-229.el8.x86_64+debug ; glibc 2.28');
INSERT INTO META VALUES('platform','x86_64');
CREATE TABLE nodes(path TEXT PRIMARY KEY, id TEXT NOT NULL COLLATE NOCASE, parent TEXT COLLATE NOCASE, class TEXT NOT NULL COLLATE NOCASE, enabled BOOL, claimed BOOL, description TEXT, vendor TEXT, product TEXT, version TEXT, serial TEXT, businfo TEXT, physid TEXT, slot TEXT, size INTEGER, capacity INTEGER, clock INTEGER, width INTEGER, dev TEXT);
INSERT INTO nodes VALUES('/','intel-chiefriver-03.khw1.lab.eng.bos.redhat.com',NULL,'system',1,1,'Laptop','Intel Corporation','2012 Client Platform (To be filled by O.E.M.)','To be filled by O.E.M.','To be filled by O.E.M.',NULL,NULL,NULL,NULL,NULL,NULL,64,NULL);
INSERT INTO nodes VALUES('/0','core','/','bus',1,1,'Motherboard','Intel Corporation','Emerald Lake 2','To be filled by O.E.M.','To be filled by O.E.M.',NULL,'0','To be filled by O.E.M.',NULL,NULL,NULL,NULL,NULL);
INSERT INTO nodes VALUES('/0/42','memory','/0','memory',1,1,'System Memory',NULL,NULL,NULL,NULL,NULL,'42','System board or motherboard',4294967296,NULL,NULL,NULL,NULL);
INSERT INTO nodes VALUES('/0/42/0','bank:0','/0/42','memory',1,1,'SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)','Hynix/Hyundai','HMT351S6BFR8C-PB',NULL,'29834EFF',NULL,'0','ChannelA-DIMM0',4294967296,NULL,1600000000,64,NULL);
INSERT INTO nodes VALUES('/0/42/1','bank:1','/0/42','memory',1,1,'DIMM [empty]','[Empty]','[Empty]',NULL,'[Empty]',NULL,'1','ChannelB-DIMM0',NULL,NULL,NULL,NULL,NULL);
INSERT INTO nodes VALUES('/0/4','cache:0','/0','memory',1,1,'L1 cache',NULL,NULL,NULL,NULL,NULL,'4',NULL,32768,32768,NULL,NULL,NULL);
INSERT INTO nodes VALUES('/0/5','cache:1','/0','memory',1,1,'L2 cache',NULL,NULL,NULL,NULL,NULL,'5',NULL,262144,262144,NULL,NULL,NULL);
...
...
...
INSERT INTO resources VALUES('/0/100/1f.3','irq','18');
INSERT INTO resources VALUES('/0/100/1f.3','memory','b2230000-b22300ff');
INSERT INTO resources VALUES('/0/100/1f.3','ioport','7000(size=32)');
CREATE VIEW unclaimed AS SELECT * FROM nodes WHERE NOT claimed;
CREATE VIEW disabled AS SELECT * FROM nodes WHERE NOT enabled;
COMMIT;
SQLite version 3.26.0 2018-12-01 12:34:55
Enter ".help" for usage hints.
sqlite> .quit

Comment 11 errata-xmlrpc 2020-11-04 01:57:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (lshw bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4533


Note You need to log in before you can comment on or make changes to this bug.