Open darnir opened 7 years ago
That's a good point; it would be nice to be able to write these in octal. As insane as it has always seemed to me, a leading zero is the standard for denoting an octal literal.
We actually have special logic in the plugin to decipher numbers written in octal but parsed as decimal because they don't have a leading zero. It's also possible, I think, to use a YAML string like "0755"
to get the effect you want. I'm marking this as a feature request because it would be nice to also omit those quotes. At the very least, we should not throw an exception.
As a caveat, however, this might be a little tricky: because the YAML parser itself decides whether the number is octal or not, we'll have to guess after the fact which way it got parsed. The path of least resistance is probably to try parsing one way and, when that fails, fall back to the other way.
It looks like this bug has since been fixed by commit 890b9e8.
Recommending closing this issue.
It looks like this bug has since been fixed by commit 890b9e8.
Recommending closing this issue.
Pretty sure that this is not the case: The order of events is exactly reversed to what you imply, and a brief look at the code suggests that this specific issues is still present.
@wisp3rwind The commit I mentioned succeeds in converting int-type perm
values to string, after which it re-converts perm
to int with base 8. With this commit (and future ones that improve upon it, like 1ec87a3), users can specify 0-leading octal values in the YAML file by wrapping the values in quotes. How is this not the context of both the issue originator and follow-up by @sampsyo ?
Hello! This is what the current status looks like to me:
"0755"
works (we parse strings as octal).755
works (we reinterpret decimal numbers as octal numbers, per the commit you referenced).0755
does not work and produces the traceback from this issue. Unfortunately, YAML itself parses 0755
as octal, i.e., the integer 493 (written in decimal). We then try to "reinterpret" this value, which is of course impossible because the decimal representation contains a 9.
Problem
I'm using the "permissions" plugin to set the correct file permissions on my Music collection. However, when setting the permissions value in the yaml file to "0644" and "0755", the following stack trace occurs.
If I set the values to "644" and "755", note the missing zeroes, it works just fine. However, permission values in octal are almost always written with a leading 0 to set the sticky bit correctly as well. While, most should not care about the sticky bit in this program, we should be allowed to write the permissions value with the bit stated.
Led to this problem:
Here's a link to the music files that trigger the bug (if relevant):
Setup
My configuration (output of
beet config
) is: