mount provider fails when paths have a trailing slash
|Status:||Merged - Pending Release||Start date:||03/21/2011|
|Affected Puppet version:||2.6.6||Branch:||https://github.com/puppetlabs/puppet/pull/1699|
A resource like “/mnt/foo” works fine, but “/mnt/foo/” only works on the first mount. On subsequent runs, puppet incorrectly determines the state as unmounted, tries to mount it, and fails.
This is because of puppet/provider/mount.rb function “mounted?” which searches for resource[:name] in the output of mount. Mount never prints the trailing slash, so puppet things the mount isn’t there.
It should either reject as invalid resources with a trailing slash, or make sure that they are correctly recognised when mounted.
#2 Updated by Ben Hughes about 2 years ago
- Status changed from Unreviewed to Needs Decision
- Assignee set to Nigel Kersten
Thank you for doing the ground work with the problem, very helpful. While it’s only a small change to do the right thing, mounts are the kind of things you really don’t want to break!
I guess the options are:
- warn/error in the parser about a “/” on the end.
- Make the regexp take in to account a trailing “/” in lib/puppet/provider/mount.rb
- Keep the current, safer mechanism and document it accordingly.
The reason I say the latter is safe as there’s less “magic” involved.
Perhaps even taking this to puppet-users?
#3 Updated by Nigel Kersten about 2 years ago
- Status changed from Needs Decision to Accepted
- Assignee deleted (
- Target version set to 2.7.x
We’re going to prohibit trailing slashes in the type, because of the uncertain semantics on exotic platforms when it is supplied.
This will mean that existing resources with a trailing slash will no longer parse, but they were causing the above issue for users anyway.
This must be called out loudly in the release notes.
#4 Updated by Christian Ruppert 7 months ago
I think, trailing slashes should just be removed/ignored when parsing it.
Actually any directory path should have a trailing slash to make it easier for other, to know whether it’s a file or a directory. For mount, ok.. it’s actually ok to not add a trailing slash because mount is pretty clear although I think it wouldn’t hurt to just ignore/strip it anyway. But that should be really be made in the parser as it will also add duplicate fstab entries.