[Bug 262334] su(1) does not set correct argv[0]

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 04 Mar 2022 06:14:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=262334

            Bug ID: 262334
           Summary: su(1) does not set correct argv[0]
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: rajeev_v_pillai@yahoo.com

Created attachment 232243
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=232243&action=edit
patch to set correct argv[0] in invoked shell

su(1) does not set the correct argv[0]. It should set argv[0] corresponding to
the
shell that will be invoked instead of always setting it to "su"/"-su"/"_su".

$ su
Password:
root@x202e:/tmp # echo $0
su
root@x202e:/tmp # ^D
$ su -l
Password:
root@x202e:~ # echo $0
-su
root@x202e:~ # ^D
$ 

The attached patch sets argv[0] to "shell"/"-shell" according to the invoked
shell.

-- 
You are receiving this mail because:
You are the assignee for the bug.