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 state: leading zeros in mode cause unexpected results #661

Closed
terminalmage opened this issue Feb 8, 2012 · 4 comments
Closed

file state: leading zeros in mode cause unexpected results #661

terminalmage opened this issue Feb 8, 2012 · 4 comments
Milestone

Comments

@terminalmage
Copy link
Contributor

when the data is loaded by yaml.safe_load, a leading zero (which is valid and not uncommon in file modes) will cause the number to be read in as octal, causing "- mode: 0644" to result in a file with mode 420.

Python 2.7.2 (default, Jan 31 2012, 13:19:49)
[GCC 4.6.2 20120120 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0644
420
>>>

If possible, we should find a way to make make "- mode: 0644" work the way it looks like it should.

@thatch45
Copy link
Contributor

thatch45 commented Feb 8, 2012

slated for 0.9.7

@thatch45
Copy link
Contributor

thatch45 commented Feb 9, 2012

Ok, now you can pass a string with a 0, aka:

/etc/foobar:
file:
- managed
- mode: '0644'

@gravyboat
Copy link
Contributor

Did this issue ever get updated to a point where the system could handle the leading zero without quotes? I searched through the issues and didn't see anything (unless I just didn't find the right term).

@ohartl
Copy link

ohartl commented Apr 15, 2024

This was about a problem in python2, its currently working as expected in python3 and current salt version.

agraul pushed a commit to agraul/salt that referenced this issue Sep 5, 2024
* test_system: prevent errors when systemd-timesyncd service is masked

* test_custom_module: disable tests when running on Salt Bundle

* Fix debian 12 package tests

* pam: use sys.executable in case /usr/bin/python3 does not exist

* pam: add unit test to ensure sys.executable is used

* Use proper method to calculate the path to Python interpreter

---------

Co-authored-by: Megan Wilhite <mwilhite@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants