Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Create login shell with coder sh#224

Merged
cmoog merged 1 commit intocoder:masterfromjawnsy:ch418
Jan 22, 2021
Merged

Create login shell with coder sh#224

cmoog merged 1 commit intocoder:masterfromjawnsy:ch418
Jan 22, 2021

Conversation

jawnsy
Copy link
Contributor

When creating a shell, we should use "exec -a" to set argv[0]
to the basename of the command being run, prefixing a hyphen.
This is how su --login creates login shells: it runs /bin/bash
as "-bash", causing bash to execute .bash_profile, etc.

We change the use of awk to cut, since cut is part of coreutils
and thus more likely to be installed than gawk. We also pass the
uid (from "id -u") instead of username to getent.

When creating a shell, we should use "exec -a" to set argv[0]to the basename of the command being run, prefixing a hyphen.This is how su --login creates login shells: it runs /bin/bashas "-bash", causing bash to execute .bash_profile, etc.We change the use of awk to cut, since cut is part of coreutilsand thus more likely to be installed than gawk. We also pass theuid (from "id -u") instead of username to getent.
@jawnsyjawnsy self-assigned thisJan 22, 2021
@shortcut-integration
Copy link

This pull request has been linked toClubhouse Story #418: Use a login shell for terminals.

@cmoog
Copy link
Contributor

cmoog commentedJan 22, 2021
edited
Loading

@jawnsy no need to use a fork. Ithink you should have the proper perms to push to a branch incdr/coder-cli. Let me know if that's not the case.

@jawnsy
Copy link
ContributorAuthor

@jawnsy no need to use a fork. Ithink you should have the proper perms to push to a branch incdr/coder-cli. Let me know if that's not the case.

Haha I like the forking workflow, though 😁

@cmoogcmoog merged commitdaa3f7a intocoder:masterJan 22, 2021
@jawnsyjawnsy deleted the ch418 branchJanuary 23, 2021 21:05
jawnsy added a commit that referenced this pull requestJan 24, 2021
This addresses a regression introduced by#224. POSIX sh does notdefine arguments to the exec built-in, resulting in an error whenusing 'exec -a' to set the process name (argv[0]).This change executes /bin/bash instead of sh, and also changesto use 'exec -l', which automatically handles the hyphen prefixrequired to trigger login shell behavior.This also explicitly runs /bin/sh, aligning the behavior of"coder sh" and the frontend Terminal application.
jawnsy added a commit that referenced this pull requestJan 25, 2021
This addresses a regression introduced by#224. POSIX sh does notdefine arguments to the exec built-in, resulting in an error whenusing 'exec -a' to set the process name (argv[0]).This change executes /bin/bash instead of sh, and also changesto use 'exec -l', which automatically handles the hyphen prefixrequired to trigger login shell behavior.This also explicitly runs /bin/sh, aligning the behavior of"coder sh" and the frontend Terminal application.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@cmoogcmoogcmoog approved these changes

@kylecarbskylecarbskylecarbs approved these changes

@tychoishtychoishAwaiting requested review from tychoish

Assignees

@jawnsyjawnsy

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@jawnsy@cmoog@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp