3 ms·
What I find amusing is that the code for reading that .pam_environment file is broken: https://git.launchpad.net/ubuntu/+source/accountsservice/tree/debian/patc
by gcbirzan 6y ago
What I find amusing is that the code for reading that .pam_environment file is broken: https://git.launchpad.net/ubuntu/+source/accountsservice/tree/debian/patches/0010-set-language.patch?h=ubuntu/focal-updates&id=e0347185d4c5554b026c13ccca691577c239afd5#n387 https://git.launchpad.net/ubuntu/+source/accountsservice/tre...
Basically, if the LANG and LC_ALL appear are across two 50 byte regions of the file, it'll fail to find them.
- asddubs 6y agoit would be 50 byte regions of any given line, right?
- gcbirzan 6y agoThey don't even take that into account, which is another issue. They just look for those two strings in any 50 byte block, so if you have FOO=LANG\n that'll count as having LANG set.
- GoblinSlayer 6y agofgets reads a line, not 50 chars
- eMSF 6y agofgets reads until the next newline character, or at most size-1 characters. For arbitrary inputs, a loop like that sets ret to TRUE if the given prefix (i.e. LANG) is found at the beginning of any line, i.e. starting at the first column – or for longer lines, if it is found starting at the 50th column (or 99th column, etc.) I don't know enough of the format of the .pam_environment file to tell whether that may lead to unexpected results.