Bug 11561

Summary: Argument parsing in nsenter incorrect
Product: Busybox Reporter: hackintosh <penn.mackintosh>
Component: OtherAssignee: unassigned
Status: RESOLVED INVALID    
Severity: major CC: busybox-cvs
Priority: P5    
Version: 1.28.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description hackintosh 2018-12-11 14:58:41 UTC
The correct syntax for nsenter is

    BusyBox v1.27.2 (Ubuntu 1:1.27.2-2ubuntu3) multi-call binary.

    Usage: nsenter [OPTIONS] [PROG [ARGS]]

        -t,--target PID         Target process to get namespaces from
        -m,--mount[=FILE]       Enter mount namespace
        -u,--uts[=FILE]         Enter UTS namespace (hostname etc)
        -i,--ipc[=FILE]         Enter System V IPC namespace
        -n,--net[=FILE]         Enter network namespace
        -p,--pid[=FILE]         Enter pid namespace
        -U,--user[=FILE]        Enter user namespace
        -S,--setuid UID         Set uid in entered namespace
        -G,--setgid GID         Set gid in entered namespace
        --preserve-credentials  Don't touch uids or gids
        -r,--root[=DIR]         Set root directory
        -w,--wd[=DIR]           Set working directory
        -F,--no-fork            Don't fork before exec'ing PROG

However, running `busybox nsenter -t` opens a shell in the current namespace and `busybox nsenter -t $$` says `nsenter: can't execute '(my pid)': No such file or directory`.
On the util-linux of my ubuntu system, `busybox nsenter -t` fails with incorrect arguments and the latter command succeeds and changes namespace, as expected.
I have checked this and it exists both on arm64 Android and amd64 (both precompiled binaries from busybox.net). This makes it impossible to use nsenter, as arguments cannot be passed correctly.