Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file resource's inspect_existing_fs_entry prevents managing permissions on char/dev files #4599

Open
jaymzh opened this issue Feb 18, 2016 · 9 comments
Labels

Comments

@jaymzh
Copy link
Collaborator

jaymzh commented Feb 18, 2016

Description

It is desired to use the file resource to manage permissions on files we are not creating, ala:

file '/dev/foo' do
  mode '0644'
end

The inspect_existing_fs_entry check in the file provider prevents this saying that it's the wrong type and can't manage it. This makes sense if we're trying to write contents, but otherwise, it doesn't.

Chef Version

12.6.0

Platform Version

CentOS 6 and CentOS7

Replication Case

file '/dev/vcs1' do  # pick any char device here
  mode '0640'
end

Client Output

Chef::Exceptions::FileTypeMismatch: file[/dev/vcs] ((irb#1) line 1) had an error: Chef::Exceptions::FileTypeMismatch: File /dev/vcs exists, but is a char device, set force_unlink to true to remove
@lamont-granquist lamont-granquist added this to the Accepted Minor milestone Feb 19, 2016
@jaymzh
Copy link
Collaborator Author

jaymzh commented Jul 6, 2016

Ping?

@jaymzh
Copy link
Collaborator Author

jaymzh commented Dec 20, 2016

piiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiing?

@coderanger
Copy link
Contributor

@jaymzh Please don't do that.

@thommay thommay added Type: Bug Does not work as expected. Priority: Medium and removed Bug labels Jan 25, 2017
@jaymzh
Copy link
Collaborator Author

jaymzh commented Mar 29, 2017

@coderanger or @lamont-granquist - what would you like to be the solution here... this continues to bite us and depending on how you think it should be fixed I may be able to allocate resources to fix it.

@coderanger
Copy link
Contributor

@jaymzh I just meant to not ping on tickets, fixing the issue is cool but I have no input on that :)

@lamont-granquist
Copy link
Contributor

Well the thing I'm vaguely worried about is if you start managing file perms on non-files with the file resource its a slippery slope to wanting to create them with mknod and extend the file resource with flags for device and character special files and that makes me lean towards wanting a different resource for it.

@lamont-granquist
Copy link
Contributor

so can you fix the logic in a generic way so it literally read in the code like you explained it -- where those checks get bypassed when we don't have content and aren't creating a tempfile?

that does make sense to me and then i can just go 'lalalalalalalalala i can't hear you' about char devices and not worry about it...

@jaymzh
Copy link
Collaborator Author

jaymzh commented May 16, 2019

@lamont-granquist if there's no content, then what's the problem? I think the check should only come into play if someone specified content

@lamont-granquist lamont-granquist removed this from the Accepted Minor milestone Oct 14, 2019
@jaymzh
Copy link
Collaborator Author

jaymzh commented Jan 20, 2024

this is related to #6704 I believe... and unless it was fixed recently, I think it's still broken.

@jaymzh jaymzh reopened this Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants