Opened 11 years ago

Closed 2 years ago

#16900 closed enhancement (wontfix)

guide: return values for tcl extensions such as existsuser and adduser

Reported by: dweber@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: guide Version:
Keywords: Cc:
Port:

Description

Can we update the guide to indicate the return values for many of the tcl extensions listed here: http://guide.macports.org/#reference.tcl-extensions

For example, there is no indication that existsuser returns the UID for a user that exists - what does it return when no user exists - 0? Also, it would be helpful to know whether adduser skips, replaces, or updates specific fields for any user that already exists. Does adduser provide any return values to indicate success or failure (or otherwise - like UID)?

Thanks, Darren

Change History (6)

comment:1 Changed 11 years ago by blb@…

existsuser description improved in r40978.

comment:2 Changed 11 years ago by dweber@…

If it's of any interest, I created a small test port to investigate how the system manages the postgres user account. This could be used as a template to adapt and extend it for use with any port that requires user or group management. I would love some further explanation of how the tcl extensions work and a short note on the general utilities availabe on OSX for management of users (eg, command line utilities would be most useful as 'see also' items in the guide).

PortSystem 1.0

name            adduser
version         0.1
categories      test
description     test tcl extensions

fetch           {}
checksum        {}
extract         {}
use_configure   no
build           {}
destroot        {}

set usr      postgres
set grp      postgres

post-destroot {

    # Check if the user and group already exist and replace them?
    set uid [existsuser ${usr}]
    set gid [existsgroup ${grp}]

    ui_msg  "${uid}:${gid}"
    
    if {!${uid}} {
        ui_msg "Creating user:\t ${usr}"
    } else {
        ui_msg "User ${usr} exists,\t uid=${uid}"
    }

    if {!${gid}} {
        ui_msg "Creating group:\t ${grp}"
    } else {
        ui_msg "Group ${grp} exists,\t gid=${gid}"
    }

}

comment:3 Changed 10 years ago by (none)

Milestone: Website & Documentation

Milestone Website & Documentation deleted

comment:4 Changed 6 years ago by cooljeanius (Eric Gallager)

I think #38440 might be related to and/or a duplicate of this ticket.

Edit: nvm

Last edited 6 years ago by cooljeanius (Eric Gallager) (previous) (diff)

comment:5 Changed 5 years ago by mf2k (Frank Schima)

Owner: changed from markd@… to macports-tickets@…
Type: defectenhancement
Version: 1.6.0

markd has retired. See #44782.

comment:6 Changed 2 years ago by raimue (Rainer Müller)

Resolution: wontfix
Status: newclosed

We should focus on Tcl extensions Portfile authors are supposed to use. In this case, this was replaced by add_users as requests in #38440.

Note: See TracTickets for help on using tickets.