Vincent McIntyre
2008-Dec-14 21:48 UTC
Bug#508740: adduser: confusing message regarding format of group names
Package: adduser Version: 3.102 Severity: minor *** Please type your report below this line *** I tried to do this: # adduser --group --system fu_bar and got this result: addgroup: Please enter a username matching the regular expression configured via the NAME_REGEX configuration variable. Use the `--force-badname'' option to relax this check or reconfigure NAME_REGEX. # echo $? 1 What this error message means, in translation, is "I don''t like underscores in group names". However it takes quite a bit of looking at it to "get" this meaning. Is there some way to make this meaning clearer to the reader? I looked at the adduser manpage and NAME_REGEX is not mentioned. Nor is it a variable that appears in /etc/adduser.conf. So I was at a loss about what to do here, to do things "properly". I was able to work around by using the suggestion in the message: # adduser --group --system --force-badname fu_bar That worked fine. I went and read the code and became more confused. The config hash has the element ''name_regex'', not ''NAME_REGEX'', but this is a minor confusion. I also found that in subroutine ''checkname'', underscores should be allowed in group names: sub checkname { my ($name) = @_; if ($name !~ /^[_.A-Za-z0-9][-\@_.A-Za-z0-9]*\$?$/) { printf STDERR (gtx("%s: To avoid problems, the username should consist only of letters, digits, underscores, periods, at signs and dashes, and not start with a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba machine accounts \$ is also supported at the end of the username\n"), $0); exit 1; } ... So it looks like, on my system, the NAME_REGEX variable is not being defined? I hacked the code to print all the keys & values in %config and found that ''name_regex'' was set to ''^[a-z][-a-z0-9]*$''. I find where this occurs. I assume it should be defined in /etc/adduser.conf, is that correct? If NAME_REGEX is defined, it appears to be inconsistent with the first check in subroutine ''checkname'' shown above. When responding to this bug, could you please address: 1. this apparent inconsistency between the code and the default ''name_regex''? 2. mentioning NAME_REXEX in the manpage? I''ve attached a tentative patch. Thanks, Vince -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, ''stable'') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.24-etchnhalf.1-686-bigmem Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8) Versions of packages adduser depends on: ii debconf [debconf-2.0] 1.5.11etch2 Debian configuration management sy ii passwd 1:4.0.18.1-7 change and administer password and ii perl-base 5.8.8-7etch5 The Pathologically Eclectic Rubbis adduser recommends no packages. -- debconf information: adduser/homedir-permission: true _______________________________________________ Adduser-devel mailing list Adduser-devel@lists.alioth.debian.org http://lists.alioth.debian.org/mailman/listinfo/adduser-devel
Michelle Konzack
2008-Dec-23 08:02 UTC
[Adduser-devel] Bug#508740: adduser: confusing message regarding format of group names
Am 2008-12-15 08:48:50, schrieb Vincent McIntyre:> What this error message means, in translation, is > "I don''t like underscores in group names". > However it takes quite a bit of looking at it to "get" this meaning. > Is there some way to make this meaning clearer to the reader? > > I looked at the adduser manpage and NAME_REGEX is not mentioned. > Nor is it a variable that appears in /etc/adduser.conf. > So I was at a loss about what to do here, to do things "properly".man 5 adduser.conf Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ ##################### Debian GNU/Linux Consultant ##################### Michelle Konzack Apt. 917 ICQ #328449886 +49/177/9351947 50, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com) -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20081223/f715db4b/attachment.pgp
Marc Haber
2011-Nov-23 10:44 UTC
[Adduser-devel] Bug#508740: adduser: confusing message regarding format of group names
On Mon, Dec 15, 2008 at 08:48:50AM +1100, Vincent McIntyre wrote:> addgroup: Please enter a username matching the regular expression configured > via the NAME_REGEX configuration variable. Use the `--force-badname'' > option to relax this check or reconfigure NAME_REGEX.NAME_REGEX is mentioned in the man page for adduser.conf, which is referenced in the adduser man page. I can offer to include NAME_REGEX into the default configuration file, if that helps for people who cannot find the man page. Would that help?> What this error message means, in translation, is > "I don''t like underscores in group names". > However it takes quite a bit of looking at it to "get" this meaning. > Is there some way to make this meaning clearer to the reader?Not easily. I think there was a reason to avoid printing the actual regex in the error message, but I don''t remember. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 31958061 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 31958062
Vincent McIntyre
2011-Nov-23 20:39 UTC
[Adduser-devel] Bug#508740: adduser: confusing message regarding format of group names
On Wed, Nov 23, 2011 at 09:44:11PM +1100, Marc Haber wrote:> > On Mon, Dec 15, 2008 at 08:48:50AM +1100, Vincent McIntyre wrote: > > addgroup: Please enter a username matching the regular expression configured > > via the NAME_REGEX configuration variable. Use the `--force-badname'' > > option to relax this check or reconfigure NAME_REGEX. > > NAME_REGEX is mentioned in the man page for adduser.conf, which is > referenced in the adduser man page. > > I can offer to include NAME_REGEX into the default configuration file, > if that helps for people who cannot find the man page. Would that help? >I think it would. In fact this was done before I even reported the bug, http://anonscm.debian.org/viewvc/adduser/trunk/adduser.conf?r1=738&r2=744 Ah, the joy of running stable. The relevant lines are there in my copy of /usr/share/adduser/adduser.conf, and the postinst copies this to /etc/adduser.conf if the latter is missing. So I think this bug can be closed. I suspect that I did not see the regex in my copy of /etc/adduser.conf because I had an old version, kept there across upgrades. Looking at the manpage text again, it seems that I must not have made the connection "configuration file" == "/etc/adduser.conf". Which was lame of me. The only change I can think of that would have avoided my confusion would be more explicitly pointing to the manpage for the config file, eg --- usr/share/man/man8/adduser.8.orig 2011-11-24 07:27:43.407629520 +1100 +++ usr/share/man/man8/adduser.8 2011-11-24 07:31:14.739404373 +1100 @@ -199,6 +199,8 @@ and .B addgroup to apply only a weak check for validity of the name. +.B NAME_REGEX +is described in adduser.conf(5). .TP .B \-\-gecos GECOS Set the gecos field for the new entry generated. Thanks for your care of this package. Kind regards, Vince