Public bug reported: pg_createcluster accepts options --user and --group to specify under which credentials a new database cluster should be created. According to the manual page, one may specify either a name or a UID/GID (as digits).
The implementation, however, tests whether there is a digit in the given string, not whether the entire string consists of digits. This causes problems for me: I have a development system where each developer creates databases and such per ticket. Users and groups are created for this purpose, named "ticketNNN" where NNN is the number of the ticket that the developer has been given to implement or bug fix. But pg_createcluster does not like these user and group names, for example "ticket123": it thinks I specified a UID/GID instead of a name, and does the wrong thing. It crashes later on when tries to use the string as a number. This is what it says on my Precise system specifically: Argument "ticket123" isn't numeric in getpwuid at /usr/share/postgresql-common/PgCommon.pm line 790. Argument "ticket123" isn't numeric in scalar assignment at /usr/share/postgresql-common/PgCommon.pm line 796. Argument "ticket123" isn't numeric in numeric ne (!=) at /usr/share/postgresql-common/PgCommon.pm line 799. This is because the test on line 237 of pg_createcluster: $owneruid = (getpwnam $owneruid)[2] unless $owneruid =~ /\d+/; is testing the wrong thing. I think it should read: $owneruid = (getpwnam $owneruid)[2] unless $owneruid =~ /^\d+$/; The same happens a few lines down with the group name. My Ubuntu version information: Description: Ubuntu 12.04.4 LTS Release: 12.04 I'm using postgresql-common version 129ubuntu1. ** Affects: postgresql-common (Ubuntu) Importance: Undecided Status: New ** Patch added: "Patch for user names and group names containing digits" https://bugs.launchpad.net/bugs/1329227/+attachment/4130196/+files/pg_createcluster.patch -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1329227 Title: pg_createcluster crashes when a username or group is specified that contains digits To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/postgresql-common/+bug/1329227/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs