Issue #15837 has been updated by Lubomir Rintel.

Sorry it took so long to respond to this; I knew it would be lengthy so I sort
of procrastinated instead. Here's my explanation:

Certain options are not accepted by Linux (kernel) when specified redundantly.
rootcontext is one such example.
This the following won't work on Linux:

<pre>
mount -t ext4 -o 
rootcontext=system_u:object_r:rainbow_t:s0,rootcontext=system_u:object_r:rainbow_t:s0
 /dev/unicorn /mnt
</pre>

Now suppose my fstab looks like this:

<pre>
# Volume        Mountpoint      Type    Options                                 
                Idx
/dev/unicorn    /mnt            ext4    
rootcontext=system_u:object_r:rainbow_t:s0      0 0
</pre>

The behavour of Linux mount command with the fstab above is like this (sorry
for the somehow freaky style, I could not help it):

What would mount do? A Quick guide to Linux mount in examples
-------------------------------------------------------------

### Properly relying on fstab

* `mount /mnt`
  * Mounts using the options from fstab (fine)
* `mount /dev/unicorn`
  * Mounts using the options from fstab (fine)
* `mount -t ext4 /dev/unicorn /mnt`
  * Mounts using the options from fstab (fine)

### Append options from fstab when mount point or device is ommited

* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 /mnt`
  * Fail, redundant options (**this is what we do now**)
* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 /dev/unicorn`
  * Fail, redundant options
* `chmod -x /bin/chmod`
  * Not a wise idea

### Ignore fstab when both device and mount point are specified

* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 /dev/unicorn /mnt`
  * Mounts, ignoring fstab (even type, needs to be specified unless guessed)
* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 -t ext4 /dev/unicorn 
/mnt`
  ** Mounts, ignoring fstab

### Type without both device and mount path is always wrong (invalid arguments 
to mount)

* `mount -t ext4 /mnt`
  * Invalid arguments to mount
* `mount -t ext4 /dev/unicorn`
  * Invalid arguments to mount
* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 -t ext4 /mnt`
  * Invalid arguments to mount
* `mount -o rootcontext=system_u:object_r:rainbow_t:s0 -t ext4 /dev/unicorn`
  * Invalid arguments to mount

I can't check with Darwin, but if my patch works there, it's a better idea than 
Mikael's,
since it add's no platform specific trickery and constructs a reasonable 
command line
explicitly stating everything that's specified in the recipe. However, it might 
be that
mount there is too broken, it would be awesome if someone could test.

Also, I don't really know how to write a test for puppet at all; and would be 
very
thankful if someone could assist. Hopefully the text above is enough to cover 
all possible
use cases of Linux mount.

----------------------------------------
Bug #15837: [PATCH] Fix mount with options specified on Linux
https://projects.puppetlabs.com/issues/15837#change-76055

Author: Lubomir Rintel
Status: Needs More Information
Priority: High
Assignee: 
Category: mount
Target version: 
Affected Puppet version: 2.7.18
Keywords: 
Branch: https://github.com/puppetlabs/puppet/pull/1021


A hack around mount misbehavior on Mac OS X caused certain options to be set
redundantly, which is forbidden for some options on Linux; such as
"rootcontext".


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to