Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpod: specify a detach keys sequence in libpod.conf #3324

Merged

Conversation

marcov
Copy link
Collaborator

@marcov marcov commented Jun 13, 2019

Add the ability of specifying a detach keys sequence in libpod.conf

Signed-off-by: Marco Vedovati mvedovati@suse.com

@openshift-ci-robot
Copy link
Collaborator

Hi @marcov. Thanks for your PR.

I'm waiting for a containers or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 13, 2019
@rh-atomic-bot
Copy link
Collaborator

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

sequence is `ctrl-p,ctrl-q`. You configure the key sequence using the --detach-keys option
sequence is `ctrl-p,ctrl-q`.
You configure the keys sequence using the **--detach-keys** option, or specifying
it in a libpod file: see **libpod.conf(5)** for more information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to specifying it in the **libpod.conf** file: see...

You configure the key sequence using the **--detach-keys** option or a configuration file.
See **config-json(5)** for documentation on using a configuration file.
You configure the keys sequence using the **--detach-keys** option, or specifying
it in a libpod file: see **libpod.conf(5)** for more information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same change as the run manpage

@@ -233,6 +237,8 @@ type RuntimeConfig struct {
EventsLogger string `toml:"events_logger"`
// EventsLogFilePath is where the events log is stored.
EventsLogFilePath string `toml:-"events_logfile_path"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely unrelated to this PR, but what is this - doing in the TOML string... @baude you added this, right?

@@ -59,11 +59,6 @@ var ErrDetach = errors.New("detached from container")

// CopyDetachable is similar to io.Copy but support a detach key sequence to break out.
func CopyDetachable(dst io.Writer, src io.Reader, keys []byte) (written int64, err error) {
if len(keys) == 0 {
// Default keys : ctrl-p,ctrl-q
keys = []byte{16, 17}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer it if we kept this around, but set it to the runtime's DetachKeys instead of hard-coding C-p C-q. That way, we don't have to unconditionally pass the keys in as part of StartAndAttach() - we get the defaults if not overridden.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how can I retrieve the runtime DetachKeys here without making an import loop

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pass then in as a separate argument, I think (keys, defaultKeys []byte)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, push determining the keys up the stack into attachContainerSocket(), which has a runtime available to get the keys

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get the default keys, rather

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I preferred moving the choice in attachContainerSocket, so that term.ToBytes can be called only once.

@mheon
Copy link
Member

mheon commented Jun 13, 2019

/ok-to-test
/approve

@openshift-ci-robot openshift-ci-robot added ok-to-test approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 13, 2019
@@ -181,12 +181,14 @@ detached container with **podman attach**.

When attached in the tty mode, you can detach from the container (and leave it
running) using a configurable key sequence. The default sequence is `ctrl-p,ctrl-q`.
You configure the key sequence using the **--detach-keys** option or a configuration file.
See **config-json(5)** for documentation on using a configuration file.
You configure the keys sequence using the **--detach-keys** option, or specifying
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of the word "You" in a man page. Can you drop it and just cap "Configure"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can drop this "You", note however that there are other "You" around in the doc.

@baude
Copy link
Member

baude commented Jun 17, 2019

this will need to also be implemented for the remote-client as well ... more specifically, reading from its conf file.

@marcov marcov force-pushed the detach-keys-configurable branch from d1042b1 to a5ec7f9 Compare June 17, 2019 13:24
@marcov
Copy link
Collaborator Author

marcov commented Jun 17, 2019

I have pushed one more commit to fix a bug found while testing these changes: when starting with attach (using podman run or podman start -a), podman would hang if attach fails before start, e.g. if the detach keys passed are invalid.

@marcov marcov force-pushed the detach-keys-configurable branch from a5ec7f9 to 79d1c6c Compare June 17, 2019 13:32
@mheon
Copy link
Member

mheon commented Jun 17, 2019

Prow failures look like infra flakes

@mheon
Copy link
Member

mheon commented Jun 17, 2019

Code LGTM

@marcov marcov force-pushed the detach-keys-configurable branch from 79d1c6c to 263ae52 Compare June 17, 2019 14:22
@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #3419) made this pull request unmergeable. Please resolve the merge conflicts.

Add the ability of specifying a detach keys sequence in libpod.conf

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
marcov added 2 commits June 26, 2019 10:12
Signed-off-by: Marco Vedovati <mvedovati@suse.com>
When a container is attached upon start, the WaitGroup counter may
never be decremented if an error is raised before start, causing
the caller to hang.
Synchronize with the start & attach goroutine using a channel, to be
able to detect failures before start.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
@marcov marcov force-pushed the detach-keys-configurable branch from 263ae52 to 4f56964 Compare June 26, 2019 08:17
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: marcov, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@marcov
Copy link
Collaborator Author

marcov commented Jun 26, 2019

@mheon @TomSweeneyRedHat, I updated and rebased this PR based on your reviews, let me know if you expect something else to be changed/added.

@TomSweeneyRedHat
Copy link
Member

Updated changes LGTM, thanks @marcov . Definitely need a head nod from @mheon though as I think he still had two open questions.

@mheon
Copy link
Member

mheon commented Jul 1, 2019

Sorry for the delay here.
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 1, 2019
@openshift-merge-robot openshift-merge-robot merged commit 1507788 into containers:master Jul 1, 2019
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. ok-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants