Public bug reported:

The default /etc/adduser.conf contains the line:

    #NAME_REGEX="^[a-z][-.a-z0-9_]*\$"

Commenting this out in preparation of updating it does not work as
expected:

    pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
    NAME_REGEX="^[a-z][-a-z0-9_]*\$"
    adduser: Please enter a username matching the regular expression configured
    via the NAME_REGEX[_SYSTEM] configuration variable.  Use the 
`--force-badname'
    option to relax this check or reconfigure NAME_REGEX.
    pra@PABELN-X1E:~$

This is due to the overeager escaping of the dollar sign, which has the
undesired effect of requring that usernames end in `$`:

    pra@PABELN-X1E:~$ sudo adduser testuser$
    Adding user `testuser$' ...
    Adding new group `testuser$' (1002) ...
    Adding new user `testuser$' (1002) with group `testuser$' ...
    Creating home directory `/home/testuser$' ...
    Copying files from `/etc/skel' ...
    New password:

Removing the backslash escaping the terminal `$` corrects the issue:

    pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
    NAME_REGEX="^[a-z][-a-z0-9_]*$"
    Adding user `testuser' ...
    Adding new group `testuser' (1002) ...
    Adding new user `testuser' (1002) with group `testuser' ...
    Creating home directory `/home/testuser' ...
    Copying files from `/etc/skel' ...
    New password:

I reported this for the `adduser` package because it seemed the closest
match.  The file /etc/adduser.conf is not owned by any package.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: adduser 3.118ubuntu5
Uname: Linux 5.10.102.1-microsoft-standard-WSL2 x86_64
ApportVersion: 2.20.11-0ubuntu82.1
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Thu Jul 21 19:56:02 2022
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: adduser
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: adduser (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug jammy uec-images

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to adduser in Ubuntu.
https://bugs.launchpad.net/bugs/1982523

Title:
  error in commented-out NAME_REGEX

Status in adduser package in Ubuntu:
  New

Bug description:
  The default /etc/adduser.conf contains the line:

      #NAME_REGEX="^[a-z][-.a-z0-9_]*\$"

  Commenting this out in preparation of updating it does not work as
  expected:

      pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
      NAME_REGEX="^[a-z][-a-z0-9_]*\$"
      adduser: Please enter a username matching the regular expression 
configured
      via the NAME_REGEX[_SYSTEM] configuration variable.  Use the 
`--force-badname'
      option to relax this check or reconfigure NAME_REGEX.
      pra@PABELN-X1E:~$

  This is due to the overeager escaping of the dollar sign, which has
  the undesired effect of requring that usernames end in `$`:

      pra@PABELN-X1E:~$ sudo adduser testuser$
      Adding user `testuser$' ...
      Adding new group `testuser$' (1002) ...
      Adding new user `testuser$' (1002) with group `testuser$' ...
      Creating home directory `/home/testuser$' ...
      Copying files from `/etc/skel' ...
      New password:

  Removing the backslash escaping the terminal `$` corrects the issue:

      pra@PABELN-X1E:~$ grep NAME_REGEX /etc/adduser.conf; sudo adduser testuser
      NAME_REGEX="^[a-z][-a-z0-9_]*$"
      Adding user `testuser' ...
      Adding new group `testuser' (1002) ...
      Adding new user `testuser' (1002) with group `testuser' ...
      Creating home directory `/home/testuser' ...
      Copying files from `/etc/skel' ...
      New password:

  I reported this for the `adduser` package because it seemed the
  closest match.  The file /etc/adduser.conf is not owned by any
  package.

  ProblemType: Bug
  DistroRelease: Ubuntu 22.04
  Package: adduser 3.118ubuntu5
  Uname: Linux 5.10.102.1-microsoft-standard-WSL2 x86_64
  ApportVersion: 2.20.11-0ubuntu82.1
  Architecture: amd64
  CasperMD5CheckResult: unknown
  Date: Thu Jul 21 19:56:02 2022
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: adduser
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/adduser/+bug/1982523/+subscriptions


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to