Summary: | improper handling of comments in /etc/portage/package.* | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Zack Elan <zackelan> |
Component: | Core - Configuration | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED INVALID | ||
Severity: | minor | CC: | deduktionstheorem, gentoo, jonas |
Priority: | High | ||
Version: | 2.1 | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Zack Elan
2006-07-25 19:38:21 UTC
Improper by what standards? The current code only allows for comments starting on the first character of a line. As far as I know, there's nothing that says otherwise. I think it's improper by the standard of almost every other comment syntax in existence, including that of bash and python - the foundation of portage - which both allow line comments on lines with uncommented text as well. package.* files having a different standard, particularly if that standard is not documented (man portage just says "comments begin with #, one DEPEND atom per line followed by additional KEYWORDS, lines without any KEYWORDS imply unstable host arch") If the code really allowed comments only at the start of a line, then "sys-devel/gcc ~x86 #somecomment" would be invalid syntax as well, but portage is happy with that - see the first test case I posted. This is even handled inconsistently across the various package.* files. I added "=sys-devel/gcc-4.1.1 #test" to package.mask and 'emerge -s %^gcc$' spits out an "--- Invalid atom in /etc/portage/package.mask: =sys-devel/gcc-4.1.1 #test" error. However, none of the test cases above give any errors, even with invalid atoms. (In reply to comment #0) > Portage doesn't like comments on the same line as depend atoms in > package.keywords, if the keyword for that atom (such as ~x86) is omitted. As already stated, this is the case for all package.* files. > echo -e "sys-devel/gcc ~x86 #" > package.keywords Unmask sys-devel/gcc versions with keywords '~x86' or '#' > echo -e "sys-devel/gcc\t" > package.keywords Unmask sys-devel/gcc versions with keyword ~${ARCH} > echo -e "sys-devel/gcc\t#" > package.keywords Unmask sys-devel/gcc versions with keyword '#' > echo -e "sys-devel/gcc " > package.keywords > echo -e "sys-devel/gcc #" > package.keywords Both the same as the \t versions as whitespace is stripped and simplified before parsing. (In reply to comment #2) > If the code really allowed comments only at the start of a line, then > "sys-devel/gcc ~x86 #somecomment" would be invalid syntax as well, but portage > is happy with that - see the first test case I posted. As per the docs and my explanation, one atom followed by a number of keywords. > I added > "=sys-devel/gcc-4.1.1 #test" to package.mask and 'emerge -s %^gcc$' spits out > an "--- Invalid atom in /etc/portage/package.mask: =sys-devel/gcc-4.1.1 #test" > error. One atom per line... I don't really care whether end-of-line comments are implemented either way, but the current comment handling is definitely consistent already. It just wasn't doing what you thought it was. As Jason explained this is expected behavior. Don't see the benefit of extending the format to allow EOL comments, this would prevent us from ever using # in use flags or atoms (not that I think we will use them, but I'd like to have the option). *** Bug 192690 has been marked as a duplicate of this bug. *** *** Bug 270538 has been marked as a duplicate of this bug. *** *** Bug 159515 has been marked as a duplicate of this bug. *** |