Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 558582 - =sys-libs/efivar-0.21 fails to read/parse device minor number > 127
Summary: =sys-libs/efivar-0.21 fails to read/parse device minor number > 127
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Mike Gilbert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-24 12:12 UTC by Beelzebubbie
Modified: 2015-10-06 06:47 UTC (History)
0 users

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


Attachments
fixes wrong signed min device number (unsigned_dev_min.patch,353 bytes, patch)
2015-08-24 12:12 UTC, Beelzebubbie
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Beelzebubbie 2015-08-24 12:12:50 UTC
Created attachment 410110 [details, diff]
fixes wrong signed min device number

efibootmgr -c -d /dev/sdj -p 1 -L … -l … -u … fails when trying to create boot entry for device with min number > 127.

strace efibootmgr -c -d /dev/sdj -p 1 -L … -l … -u … :

open("/dev/sdj", O_RDONLY) = 3
fstat(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(8, 144), ...}) = 0
readlink("/sys/dev/block/8:-112", 0x7ffd5a0f9080, 4096) = -1 ENOENT

# lsblk | grep sdj
sdj 8:144 1 29.8G 0 disk
├─sdj1 8:145 1 1G 0 part /boot
└─sdj2 8:146 1 28.8G 0 part /

The bug is here: 8:144 turned into 8:-112. Trying to dig into a problem, I found in linux.c:62:
set_disk_and_part_name(struct disk_info *info)
…
rc = sysfs_readlink(&linkbuf, "/sys/dev/block/%"PRIu64":%hhd", info->major, info->minor); 

(%hhd prints unsigned info->minor as signed, which causes wrong device path if info->minor is greater than 127)

This bug was reported upstream:
https://github.com/rhinstaller/efivar/issues/33

Patch attached.
Comment 1 Mike Gilbert gentoo-dev 2015-08-27 02:31:51 UTC
Why are you submitting the patch here? Send it upstream.
Comment 2 Beelzebubbie 2015-08-27 10:06:44 UTC
Already done, but how long it will take for upstream to notice/merge patch and release new version? As for me, it is more appropriate to update sys-libs/efivar  to -r1 with suggested patch (sorry I was wrong in header, affected package is sys-libs/efivar.
Comment 3 Mike Gilbert gentoo-dev 2015-08-27 12:09:33 UTC
Oh, you included the patch in a github comment; I was expecting to see a pull request, so I missed it.
Comment 4 Beelzebubbie 2015-10-06 06:47:48 UTC
upstream applied a patch:
https://github.com/rhinstaller/efivar/commit/7d4b71fe88ecd647020118da9152741f553b54db