Bug 644330

Summary: udevadm info --query=env doesn't quote responses
Product: Red Hat Enterprise Linux 6 Reporter: Mike Burns <mburns>
Component: udevAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: apevec, azelinka, ovirt-maint, pknirsch, vbian
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: udev-147-2.34.el6 Doc Type: Bug Fix
Doc Text:
Previously, the output of the command "udevadm info --query=property" could not be used as input to shell interpreters. This update adds "--query=property --export", which changes the output to be shell parseable.
Story Points: ---
Clone Of:
: 644341 (view as bug list) Environment:
Last Closed: 2011-05-19 11:48:20 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 644341    

Description Mike Burns 2010-10-19 13:17:46 UTC
Description of problem:
When running udevadm info --query=env, I get a list of values back that are not quoted.  For most, this isn't a problem, but something like DEVLINKS, which is a space separated list, it doesn't get set correctly.


Version-Release number of selected component (if applicable):
udev-147-2.29.el6.x86_64

How reproducible:


Steps to Reproduce:
1. udevadm info --query=env --name=sda
2. Results in DEVLINKS=<space separated list with no quotes)
3.
  
Actual results:
# eval $(udevadm info --query=env --name=sda)
bash: /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001: Permission denied

Note:
DEVLINKS=/dev/block/8:0 /dev/disk/by-id/ata-QEMU_HARDDISK_QM00001 /dev/disk/by-id/scsi-SATA_QEMU_HARDDISK_QM00001 /dev/disk/by-path/pci-0000:00:01.1-scsi-0:0:0:0

Expected results:
No Error


Additional info:

This is being used in RHEV-H in an eval call like above.  We are working around it by manually inserting quotes with a sed script

Comment 1 Mike Burns 2010-10-19 13:18:17 UTC
This was also reproduced upstream in udev-153-4.fc13.x86_64

Comment 5 Harald Hoyer 2010-12-09 14:31:01 UTC
I added a new query type "shproperty" alias "shenv":

$ udevadm info --query=shproperty --name=/dev/sda
UDEV_LOG='3'
DEVPATH='/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'
...
UDISKS_ATA_SMART_IS_AVAILABLE='1'
DEVLINKS='/dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0'

$ eval $(udevadm info --query=shenv --name=/dev/sda)
$ echo $DEVLINKS
/dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0

Comment 7 Harald Hoyer 2011-02-16 14:12:08 UTC
(In reply to comment #5)
> I added a new query type "shproperty" alias "shenv":
> 
> $ udevadm info --query=shproperty --name=/dev/sda
> UDEV_LOG='3'
> DEVPATH='/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda'
> ...
> UDISKS_ATA_SMART_IS_AVAILABLE='1'
> DEVLINKS='/dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ
> /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ
> /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0'
> 
> $ eval $(udevadm info --query=shenv --name=/dev/sda)
> $ echo $DEVLINKS
> /dev/block/8:0 /dev/disk/by-id/ata-APPLE_SSD_TS128B_60CS105MT4RZ
> /dev/disk/by-id/scsi-SATA_APPLE_SSD_TS128_60CS105MT4RZ
> /dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0

Changed the parameter to be in sync with upstream. It is now:
--query=property --export

$ udevadm info --query=property --export --name=/dev/sda
...

Comment 8 Harald Hoyer 2011-02-16 14:12:36 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Previously, the output of the command "udevadm info --query=property" could not be used as input to shell interpreters. This update adds "--query=property --export", which changes the output to be shell parseable.

Comment 10 errata-xmlrpc 2011-05-19 11:48:20 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0525.html