From owner-freebsd-bugs@FreeBSD.ORG Sun Feb 20 23:00:23 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DDC2A1065697 for ; Sun, 20 Feb 2011 23:00:23 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9E5208FC23 for ; Sun, 20 Feb 2011 23:00:23 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p1KN0N87058195 for ; Sun, 20 Feb 2011 23:00:23 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p1KN0NrB058172; Sun, 20 Feb 2011 23:00:23 GMT (envelope-from gnats) Resent-Date: Sun, 20 Feb 2011 23:00:23 GMT Resent-Message-Id: <201102202300.p1KN0NrB058172@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Julian Fagir Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D60411065670 for ; Sun, 20 Feb 2011 22:51:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id C35458FC19 for ; Sun, 20 Feb 2011 22:51:06 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1KMp6BS097856 for ; Sun, 20 Feb 2011 22:51:06 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p1KMp673097855; Sun, 20 Feb 2011 22:51:06 GMT (envelope-from nobody) Message-Id: <201102202251.p1KMp673097855@red.freebsd.org> Date: Sun, 20 Feb 2011 22:51:06 GMT From: Julian Fagir To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/154922: jail_getid(3) does not work; jexec(8) does not work with names X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Feb 2011 23:00:23 -0000 >Number: 154922 >Category: misc >Synopsis: jail_getid(3) does not work; jexec(8) does not work with names >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 20 23:00:23 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Julian Fagir >Release: 8.1-RELEASE >Organization: >Environment: FreeBSD zweihorn1 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC 2010 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: jail_getid(3) returns just the same jid as a string. jail_getname(3) returns only the jid of the jid you give (as a string). As far as I see, it is not a problem of my understanding, as the jexec(8)-manpage explicitly states that the jail can be supplied as a name or jid. jls does return the right name of the jail as ezjail is configured to create, and indeed both of them are doing fine when asking for the name or starting a shell in the jail. `ezjail-admin console` does use the id of the jail, anyway. >How-To-Repeat: Just `jls`, pick any jailname $JAILNAME and then run `jexec $JAILNAME sh`. It will fail as it does not find the name of the jail. Alternatively, compile the following program with -ljail and run it with the only parameter the name of the jail: #include #include #include #include #include #include int main(int argc, char* argv[]) { int jid; if (argc != 2) return(1); jid = jail_getid(argv[1]); printf("Jail %s is running: %d\n", argv[1], jid); return(0); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: