[Adduser-devel] Bug#508740: adduser: confusing message regarding format of group names

Vincent McIntyre Vince.McIntyre at atnf.csiro.au
Sun Dec 14 21:48:50 UTC 2008

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 $?

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 
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

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.


-- 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: 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adduser.8.patch
Type: text/x-diff
Size: 682 bytes
Url : http://lists.alioth.debian.org/pipermail/adduser-devel/attachments/20081215/5ab1cf17/attachment.patch 

More information about the Adduser-devel mailing list