FS#39066 - [cryptsetup] Device names containing : cannot be used for cryptkey

Attached to Project: Arch Linux
Opened by Charles Duffy (charles-dyfis-net) - Thursday, 27 February 2014, 20:08 GMT
Last edited by Christian Hesse (eworm) - Saturday, 04 November 2017, 22:53 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To No-one
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

mdadm devices with explicit hostnames set have entries created in /dev/disk/by-id as follows:

/dev/disk/by-id/md-name-hostname:mdname

The code used for parsing cryptkey reads as follows:

IFS=: read ckdev ckarg1 ckarg2 <<EOF
$cryptkey
EOF

If cryptkey contains something of the form:

/dev/disk/by-id/md-name-hostname:mdname:ext2:/secret.key

...then the read code will parse it as follows:

ckdev=/dev/disk/by-id/md-name-hostname
ckarg1=mdname
ckarg2=ext2:/secret.key

...whereas the desired behavior would be:

ckdev=/dev/disk/by-id/md-name-hostname:mdname
ckarg1=ext2
ckarg2=/secret.key

An implementation allowing colons within ckdev might look like the following:

ckdev=${cmd%:*:*}
rest=${cmd#${ckdev}:}
ckarg1=${rest%:*}
ckarg2=${rest##*:}

Additional info:
* cryptsetup 1.6.3-2

Steps to reproduce:
* Generate a device with a hostname built-in using mdadm --name
* Try to pass a stable name for this device on the command line.
This task depends upon

Closed by  Christian Hesse (eworm)
Saturday, 04 November 2017, 22:53 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Works as expected with escaped colon.
Comment by Charles Duffy (charles-dyfis-net) - Wednesday, 05 March 2014, 00:55 GMT
Since the -r flag to read is not in use, field separators can be backslash-escaped. Thus, with the original unmodified code, the following works:

/dev/disk/by-id/md-name-hostname\:mdname

This issue thus can probably be closed, possibly with a documentation patch.
Comment by Doug Newgard (Scimmia) - Wednesday, 13 May 2015, 21:16 GMT
ping brain0...

Loading...