Skip to content

Unify error codes #1592

@alejandro-colomar

Description

@alejandro-colomar

I had a look into unifying error codes (which I'd need for unifying locking). It's a mess. Here's a list of the errors we have:

#define E_SUCCESS	EXIT_SUCCESS
#define E_NOPERM	1	/* permission denied */
#define E_USAGE		1
#define E_PW_UPDATE	1	/* can't update password file */
#define E_USAGE		2	/* invalid command syntax */
#define E_BAD_ENTRY	2
#define E_BAD_ARG	3	/* invalid argument to option */
#define E_FAILURE	3	/* unexpected failure, nothing done */
#define E_CANT_OPEN	3
#define E_CANT_LOCK	4
#define E_GID_IN_USE	4	/* gid already in use (and no -o) */
#define E_UID_IN_USE	4	/* UID already in use (and no -o) */
#define E_MISSING	4	/* unexpected failure, passwd file missing */
#define E_CANT_UPDATE	5
#define E_PWDBUSY	5	/* passwd file busy, try again later */
#define E_BAD_ARG	6	/* invalid argument to option */
#define E_BAD_ENTRY	6	/* bad shadow entry */
#define E_CANT_SORT	6
#define E_NOTFOUND	6	/* specified user/group doesn't exist */
#define E_GROUP_BUSY	8	/* can't remove user's primary group */
#define E_USER_BUSY	8	/* user currently logged in */
#define E_NAME_IN_USE	9	/* username or group name already in use */
#define E_GRP_UPDATE	10	/* can't update group file */
#define E_PAM_ERR	10	/* PAM returned an error */
#define E_CLEANUP_SERVICE	11	/* can't setup cleanup service */
#define E_HOMEDIR	12	/* can't create/move/remove home dir */
#define E_PAM_USERNAME	12	/* can't determine your username for use with pam */
#define E_MAILBOXFILE	13	/* can't create mailbox file */
#define E_PAM_ERROR	13	/* pam returned an error, see Syslog facility id groupmod */
#define E_SE_UPDATE	13	/* can't update SELinux user mapping */
#define E_SE_UPDATE	14	/* can't update SELinux user mapping */
#define E_PASSWD_NOTFOUND	14	/* not found password file */
#define E_SHADOW_NOTFOUND	15	/* not found shadow password file */
#define E_GROUP_NOTFOUND	16	/* not found group file */
#define E_SUB_UID_UPDATE	16	/* can't update the subordinate uid file */
#define E_GSHADOW_NOTFOUND	17	/* not found shadow group file */
#define E_SUB_GID_UPDATE	18	/* can't update the subordinate gid file */
#define E_BAD_NAME	19	/* Bad login name */
#define E_PASSWORDLESS	20	/* would result in a passwordless account */
#define E_CMD_NOEXEC		126	/* can't run command/shell */
#define E_CMD_NOTFOUND		127	/* can't find command/shell to run */
//#define E_BAD_PWFILE	5	/* passwd file contains errors */
//#define E_NOSPACE	11	/* insufficient space to move home dir */

There are several collisions, and several names have more than one number. Do you have any preference for how to fix this? For solving the collisions, I guess we'll have to break some code; otherwise, I don't see a clear solution.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions