Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 426986

Summary: sys-fs/cryptsetup: initscript ignores last line of config file when missing final newline
Product: Gentoo Linux Reporter: klamp <klampiar>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: kripton
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Example config files
Example config files

Description klamp 2012-07-17 12:04:29 UTC
/etc/init.d/dmcrypt script ignores lines of /etc/conf.d/dmcrypt that are not terminated with newline character = last line. I think so such behavior should be either removed, or user should be explicitly warned about it, at place where he will most likely encounter it - end of preinstalled /etc/conf.d/dmcrypt file.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-01-17 23:26:12 UTC
I don't follow, please provide an example that triggers the problem.
Comment 2 klamp 2013-01-18 08:03:49 UTC
Created attachment 336012 [details]
Example config files

dmcrypt.ok works as expected, dmcrypt.bad does not.
Comment 3 klamp 2013-01-18 08:16:46 UTC
Created attachment 336014 [details]
Example config files

Output with dmcrypt.ok:

desktop conf.d # /etc/init.d/dmcrypt restart
 * Removing dm-crypt mappings
 *   crypt-home ...
Device crypt-home is not active. [ !! ]
 * Setting up dm-crypt mappings ...
 * /dev/sda1 will not be decrypted ...
 * Reason: keyfile /full/path/to/homekey does not exist. 

Output with dmcrypt.bad:

desktop conf.d # /etc/init.d/dmcrypt restart
 * Removing dm-crypt mappings
 *   crypt-home ...
Device crypt-home is not active. [ !! ]
 * Setting up dm-crypt mappings ...
 *   crypt-home using:   create crypt-home /dev/sda1 ...
Enter passphrase:

Lack of new-line character after line "key='/full/path/to/homekey'" causes it to be ignored and passphrase being implicitly used.
Comment 4 SpanKY gentoo-dev 2015-04-12 20:32:48 UTC
should be all set now in the tree; thanks for the report!

Commit message: Note that the config file must be terminated by a newline
http://sources.gentoo.org/sys-fs/cryptsetup/files/1.0.6-dmcrypt.confd?r1=1.5&r2=1.6