[SRU] update-pciids in pciutils fails to create hard link

Bug #1915923 reported by C.Schmidbauer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pciutils (Ubuntu)
Fix Released
Undecided
Unassigned
Focal
Fix Released
High
Erich Eickmeyer

Bug Description

[Impact]

 * People who use update-pciids more than once are unable to run it a second time without errors due to a missing "-f" in the "ln" line being called as the symlink already exists. This was identified upstream and fixed in later versions, but was not implemented in Focal. The patch in question is fixed in a new upload and attached patch.

[Test Plan]

 * Install pciutils
 * Run 'sudo update-pciids'
 * Run 'sudo update-pciids' a second time.
 * "ln" will return an error explaining the hardlink already exists.

[Where problems could occur]

 * If this patch is in error, then the entire command will cause the same problem or the link of the '.old' file will be erased entirely. This is highly unlikely.

[Other Info]

 * Corrected patch is attached to this bug.

------
Original bug report:

Running on Ubuntu 20.04 LTS, the `.old` file does not seem to be cleaned up properly.

It seems someone forgot to add the "-f" from the respective upstream commit: https://github.com/pciutils/pciutils/commit/b6a0091e4a17dcc01c84dfe233e861fe6e82b1c4

First run:
```
$ sudo sh -x /usr/sbin/update-pciids
+ set -e
+ SRC=https://pci-ids.ucw.cz/v2.2/pci.ids
+ DEST=/usr/share/misc/pci.ids
+ PCI_COMPRESSED_IDS=
+ GREP=grep
+ [ = -q ]
+ quiet=false
+ touch /usr/share/misc/pci.ids
+ [ = 1 ]
+ which bzip2
+ DECOMP=bzip2 -d
+ SRC=https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
+ which curl
+ DL=curl -o /usr/share/misc/pci.ids.new https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
+ false
+ curl -o /usr/share/misc/pci.ids.new https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 265k 100 265k 0 0 634k 0 --:--:-- --:--:-- --:--:-- 635k
+ bzip2 -d
+ grep ^C /usr/share/misc/pci.ids.neww
+ [ -f /usr/share/misc/pci.ids ]
+ ln /usr/share/misc/pci.ids /usr/share/misc/pci.ids.old
+ chmod -f --reference=/usr/share/misc/pci.ids.old /usr/share/misc/pci.ids.neww
+ mv /usr/share/misc/pci.ids.neww /usr/share/misc/pci.ids
+ rm /usr/share/misc/pci.ids.new
+ [ /usr/share/misc/pci.ids != /usr/share/misc/pci.ids ]
+ false
+ echo Done.
Done.
```

Second run:
```
$ sudo sh -x /usr/sbin/update-pciids
+ set -e
+ SRC=https://pci-ids.ucw.cz/v2.2/pci.ids
+ DEST=/usr/share/misc/pci.ids
+ PCI_COMPRESSED_IDS=
+ GREP=grep
+ [ = -q ]
+ quiet=false
+ touch /usr/share/misc/pci.ids
+ [ = 1 ]
+ which bzip2
+ DECOMP=bzip2 -d
+ SRC=https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
+ which curl
+ DL=curl -o /usr/share/misc/pci.ids.new https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
+ false
+ curl -o /usr/share/misc/pci.ids.new https://pci-ids.ucw.cz/v2.2/pci.ids.bz2
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 265k 100 265k 0 0 420k 0 --:--:-- --:--:-- --:--:-- 419k
+ bzip2 -d
+ grep ^C /usr/share/misc/pci.ids.neww
+ [ -f /usr/share/misc/pci.ids ]
+ ln /usr/share/misc/pci.ids /usr/share/misc/pci.ids.old
ln: failed to create hard link '/usr/share/misc/pci.ids.old': File exists
```

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1915923/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
C.Schmidbauer (csgc)
affects: ubuntu → pciutils (Ubuntu)
tags: added: rls-ff-incoming
tags: added: fr-1144
tags: removed: rls-ff-incoming
Changed in pciutils (Ubuntu Focal):
importance: Undecided → High
status: New → Triaged
Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

Corrected patch to have "ln -f" instead of simple "ln".

description: updated
description: updated
summary: - update-pciids in pciutils fails to create hard link
+ [SRU] update-pciids in pciutils fails to create hard link
Changed in pciutils (Ubuntu Focal):
status: Triaged → In Progress
assignee: nobody → Erich Eickmeyer  (eeickmeyer)
Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

Debdiff attached.

Revision history for this message
Brian Murray (brian-murray) wrote :

I've sponsored this for Focal.

Changed in pciutils (Ubuntu):
status: New → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello C.Schmidbauer, or anyone else affected,

Accepted pciutils into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pciutils/1:3.6.4-1ubuntu0.20.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in pciutils (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
C.Schmidbauer (csgc) wrote :

> This was identified upstream and fixed in later versions, but was not implemented in Focal.

To clarify: This bug was never present upstream, as upstream v3.6.4 used "mv" instead of "ln". The version in Ubuntu seemed to have deviated from the original upstream version which introduced the bug:
https://github.com/pciutils/pciutils/blob/v3.6.4/update-pciids.sh#L62

With the patched version 3.6.4-1ubuntu0.20.04.1 of pciutils, the problem does seems to have been fixed:

```
wget http://launchpadlibrarian.net/532095078/pciutils_3.6.4-1ubuntu0.20.04.1_amd64.deb
wget http://launchpadlibrarian.net/532095077/libpci3_3.6.4-1ubuntu0.20.04.1_amd64.deb
dpkg -i pciutils_3.6.4-1ubuntu0.20.04.1_amd64.deb libpci3_3.6.4-1ubuntu0.20.04.1_amd64.deb
```

Revision history for this message
Erich Eickmeyer (eeickmeyer) wrote :

> To clarify: This bug was never present upstream, as upstream v3.6.4 used "mv" instead of "ln".

Upstream refers to Debian having made the initial patch which I corrected, and the patch was apparently to implement a new feature of the upstream functionality in the source. Ubuntu had no direct involvement in this package up to correcting and uploading this patch in a new build (hence the "-1ubuntu0.20.04.1" suffix).

tags: added: verification-done verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
C.Schmidbauer (csgc) wrote :

> Upstream refers to Debian

Ah, thanks for clarifying!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pciutils - 1:3.6.4-1ubuntu0.20.04.1

---------------
pciutils (1:3.6.4-1ubuntu0.20.04.1) focal; urgency=medium

  * Fix patch to ln -f (LP: #1915923)

 -- Erich Eickmeyer <email address hidden> Wed, 31 Mar 2021 15:55:11 -0700

Changed in pciutils (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for pciutils has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.