Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87pltc63rt.fsf@vuxu.org>
Date: Thu, 23 May 2024 15:45:10 +0200
From: Leah Neukirchen <leah@...u.org>
To: Rich Felker <dalias@...c.org>
Cc: Collin Funk <collin.funk1@...il.com>,  musl@...ts.openwall.com
Subject: Re: getusershell should ignore comments and empty lines.

Rich Felker <dalias@...c.org> writes:

> It says:
>
>     "A hash mark (``#'') indicates the beginning of a comment;
>     subsequent characters up to the end of the line are not
>     interpreted by the routines which search the file."
>
> This isn't very clear whether # is only a comment on the beginning of
> a line (after potential whitespace?) or whether # appearing in a line
> with a shell pathname is a comment or part of the pathname. If it's a
> comment, it's not clear if whitespace before it is part of the shell
> pathname -- e.g. does "/bin/sh # best shell" define "/bin/sh" or
> "/bin/sh " as the shell pathname?
>
> It sounds like nobody ever thought about whitespace, quoting, or
> rigorous comment syntax here...

True:

OpenBSD drops the rest of the line with "#" and ignores lines not
starting with a "/".

glibc drops the rest of the line with "#", elides spaces after the
entry, and skips everything before the first "/" (quite bold).

pam_shells skips all lines that don't start with a "/" and doesn't
handle "#" specially.

gnome-terminal just tries to find one line that matches exactly the
the shell

util-linux skips lines from getusershell that start with "#".
Likewise "seunshare".

-- 
Leah Neukirchen  <leah@...u.org>  https://leahneukirchen.org/

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.