Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 509330 - /lib64/rc/sh/tmpfiles.sh incorrectly parses tmpfiles.d conf files that use the '!' notation
Summary: /lib64/rc/sh/tmpfiles.sh incorrectly parses tmpfiles.d conf files that use th...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: OpenRC (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: OpenRC Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 481182
  Show dependency tree
 
Reported: 2014-05-01 22:05 UTC by Michael J Coss
Modified: 2014-05-08 07:09 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael J Coss 2014-05-01 22:05:51 UTC
During system boot, /etc/init.d/tmpfiles.setup uses /lib64/rc/sh/tmpfiles.sh to parse all files in /usr/lib/tmpfiles.d/*.conf, as well as a number of other directories.  The problem is that the script reads the files, extracts the command token, and checks it against a list of valid tokens.  Unfortunately, the command can have a suffix, an '!' which indicates that the command is only valid during boot.  I fixed this via adding an additional case, and checking rc-status to see if the run level is boot, if it is then I strip the !, and proceed with the command processing.  Otherwise, it continues.  While this fixed the problem, it introduced a bug, in that the commands that were failing, one in systemd-nologin.conf creates the file /run/nologin.  Unfortunately, since I don't run systemd as I prefer openRC, there is no service that removes /run/nologin when the system can allow logins.  Normally this is done by a systemd service.

Reproducible: Always

Steps to Reproduce:
1. Boot system
Actual Results:  
On screen and in rc.log the following text is displayed:
tmpfiles: ignoring invalid entry on line 11 of `/usr/lib/tmpfiles.d//systemd-nologin.conf'
tmpfiles: ignoring invalid entry on line 18 of `/usr/lib/tmpfiles.d//x11.conf' 

Expected Results:  
No errors from tmpfiles.sh parsing system *.conf files

Code change for tmpfiles.sh 

*** /tmp/r1     2014-05-01 18:02:14.000000000 -0400
--- /tmp/r2     2014-05-01 18:02:24.000000000 -0400
*************** for FILE in $tmpfiles_d ; do
*** 295,300 ****
--- 295,308 ----
                # whine about invalid entries
                case $cmd in
                        f|F|w|d|D|p|L|c|b|x|X|r|R|z|Z) ;;
+                       f!|F!|w!|d!|D!|p!|L!|c!|b!|x!|X!|r!|R!|z!|Z!)
+                               rcstate=$(rc-status -r);
+                               if [ "$rcstate" = "boot" ]; then
+                                       cmd=${cmd:0:1};
+                               else
+                                       continue;
+                               fi
+                               ;;
                        \#) continue ;;
                        *) warninvalid ; continue ;;
                esac

This, of course, doesn't address the secondary issue of handling cleanup of the /run/nologon file which the bug masks
Comment 1 William Hubbs gentoo-dev 2014-05-08 07:09:23 UTC
This is actually already available in git and will be included in
openrc-0.13. See commit 686ee62.