A) I localised the bug in /usr/sbin/ybin lines 1592 to 1597:
## also accept symlink names in quotes or with escaped characters
boot="`readlink -f \"$(eval echo ${boot})\"`"
bsd="`readlink -f \"$(eval echo ${bsd})\"`"
macos="`readlink -f \"$(eval echo ${macos})\"`"
macosx="`readlink -f \"$(eval echo ${macosx})\"`"
darwin="`readlink -f \"$(eval echo ${darwin})\"`"
=> This block seems to be a Debian diff, it is not in the original source!
I tested it for the variable ${macos}, line 1595 from ybin:
macos="`readlink -f \"$(eval echo ${macos})\"`"
At this point, ${macos} may contain an Open Firmware path (like "hd:7") as well
as an Unix device path ("/dev/*").
I used 4 test cases for ${macos} :
1. "/dev/sdc7" a
standard Unix device name
2. "/dev/disk/by-id/scsi-SATA_SAMSUNG_SV1204H0504J1BW706040-part7" a Unix
device symbolic link
3. "/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7" an Open
Firmware path name
4. "hd:7" an Open
Firmware symbolic link
For testing, I used test-ybin.sh (appended), which prints out ${macos}
before(1) and after(2) line 1595 (readlink), with the following result:
test-ybin1:/dev/sdc7
test-ybin2:/dev/sdc7
test-ybin1:/dev/disk/by-id/scsi-SATA_SAMSUNG_SV1204H0504J1BW706040-part7
test-ybin2:/dev/sdc7
test-ybin1:/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7
test-ybin2:
test-ybin1:hd:7
test-ybin2:/home/bernward/hd:7
The test cases 1. + 2. with Unix filenames are right, but the test cases 3. +
4. with Open Firmware pathes fail:
=> readlink is not apropriate to handle Open Firmware pathes!
B) Solution proposal:
The block from lines 1592 to 1597 ("## also accept symlink names in quotes or
with escaped characters") should only be applied, if the path names are given
as Unix device names.
It should not be applied for Open Firmware path names.
There is already a case command which does this selection in convertpath():
# from ybin line 644:
case "$macos" in
/dev/*)
If each of the lines 1592 to 1597 ("## also accept symlink names in quotes or
with escaped characters") is sorted in the apropriate case in function
convertpath(), things should be right.
I tested it for ${macos} in test-ybin-patch.sh (appended), which prints out
${macos}
before the case command (1),
after the readlink command (2), which was moved into the appropriate case
construction,
and after the case construction (3),
with the following result:
test-ybin-patch1:/dev/sdc7
test-ybin-patch2:/dev/sdc7
test-ybin-patch3:/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7
test-ybin-patch1:/dev/disk/by-id/scsi-SATA_SAMSUNG_SV1204H0504J1BW706040-part7
test-ybin-patch2:/dev/sdc7
test-ybin-patch3:/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7
test-ybin-patch1:/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7
test-ybin-patch3:/pci@80000000/pci-bridge@d/pci-ata@1/@0/@0:7
test-ybin-patch1:hd:7
test-ybin-patch3:hd:7
=> All 4 test cases are handled right!
test-ybin.sh
Description: application/shellscript
test-ybin-patch.sh
Description: application/shellscript

